CU 5921 -Programming question for a dummy

jannestigjannestig Member Posts: 1,000
Hej I am breaking my programming cherry at the moment as i am usually consulting.

I am trying to prove my architecture plan at the moment.

I am trying to let Service item components table copy across more then just items from a BOM
with Kitting Mod. In this regards i am looking to bring across Resources and Setup resource.

Just looking at a Helping tip or small example to help me to expand the imported objects
CU 5921 is below

ServItem.GET(Rec."No.");
ServItem.TESTFIELD("Item No.");

ServItemComponent.LOCKTABLE;
ServItemComponent.RESET;
ServItemComponent.SETRANGE(Active,TRUE);
ServItemComponent.SETRANGE("Parent Service Item No.",ServItem."No.");
IF ServItemComponent.FIND('+') THEN
LineNo := ServItemComponent."Line No."
ELSE
LineNo := 0;

Item.GET(ServItem."Item No.");
KitManagement.GetKitProdBOM(Item."Kit BOM No.",TempProdBOMLine,NoOfBOMComp);
TempProdBOMLine.SETRANGE(Type,TempProdBOMLine.Type::Item);
IF TempProdBOMLine.FINDSET THEN BEGIN
REPEAT
IF TempProdBOMLine."Quantity per" <> ROUND(TempProdBOMLine."Quantity per",1) THEN
ERROR(Text001,ServItem.TABLECAPTION,TempProdBOMLine.FIELDCAPTION("Quantity per"));
FOR Index := 1 TO TempProdBOMLine."Quantity per" DO BEGIN
LineNo := LineNo + 10000;
Item.GET(TempProdBOMLine."No.");
CLEAR(ServItemComponent);
ServItemComponent.Active := TRUE;
ServItemComponent.INIT;
ServItemComponent."Parent Service Item No.":= ServItem."No.";
ServItemComponent."Line No." := LineNo;
ServItemComponent.Type := ServItemComponent.Type::Item;
ServItemComponent."No." := TempProdBOMLine."No.";
ServItemComponent."Variant Code" := TempProdBOMLine."Variant Code";
ServItemComponent."Date Installed" := ServItem."Installation Date";
ServItemComponent.Description := Item.Description;
ServItemComponent."Description 2" := Item."Description 2";
ServItemComponent."From Line No." := 0;
IF NOT ServItemComponent.INSERT THEN
ServItemComponent.MODIFY;
END;
UNTIL TempProdBOMLine.NEXT = 0;
END ELSE
ERROR(
Text000,
TempProdBOMLine.TABLECAPTION,ServItem.FIELDCAPTION("Item No."),ServItem."Item No.");
Sign In or Register to comment.