In the code below I need to Count the values of the Shipment line and Document Number. I then need to Look at the shipment Line Quantity then Count the Quantity in the batch.
I'm thinking I then need to create 3 variables.
3) intQtyBatch
2)intShipmentLine
1) intAssignQty.
I then essentially need to state IF (1 + 3) > 2
Error
IF 3 < 2
ok...
Any ideas on how to write this? Please ask if you need any other information
Here's how I've started although I'm assuming it's wrong
*This post is locked for comments
Ok ill start again. Im trying to basically say if the Current Batch "WhseSerialBatchList, Quantity' Is <> the quantity on the Posted Sales Shipment Line Quantity then produce an error.
Try this.
intShipmentLine := recSerialNoInformation.Quantity; //take the quantity
Hi,
intShipmentLine := recSerialNoInformation."Shipment Line No",Quantity; is not accepted in C/AL.
intShipmentLine := recSerialNoInformation.Quantity; is legal. But what is the table referred by recSerialNoInformation?
Try this code and let us know, if you face any specific error with this code.
recWhseSerialBatchHeader.RESET;
recWhseSerialBatchHeader.SETFILTER(Quantity, '>%1',0);
frmWhseSerialBatchList.SETTABLEVIEW(recWhseSerialBatchHeader);
frmWhseSerialBatchList.LOOKUPMODE(TRUE);
IF frmWhseSerialBatchList.RUNMODAL = ACTION::LookupOK THEN BEGIN
frmWhseSerialBatchList.GETRECORD(recWhseSerialBatchHeader);
recSerialNoInformation.RESET;
recSerialNoInformation.SETRANGE("Batch No.", recWhseSerialBatchHeader."No.");
recSerialNoInformation.RESET;
recSerialNoInformation3 := recSerialNoInformation;
recSerialNoInformation3.SETRANGE("Shipment No.", recSalesShipmentLine."Document No.");
recSerialNoInformation3.SETRANGE("Shipment Line No.", recSalesShipmentLine."Line No.");
intQtyBatch := recWhseSerialBatchHeader.Quantity; //This should take the Quantity from the Whse Serial Batch List
intShipmentLine := recSerialNoInformation."Shipment Line No",Quantity; //take the quantity from the Posted Sales Shipment
intQtyAssign := recSalesShipmentLine.Quantity; //take the quantity from the Serial Number Information List
recWhseSerialBatchHeader.Quantity.COUNT //This should count the quanity
recSalesShipmentLine.Qantity.COUNT //This Should count the quantity
IF recSerialNoInformation.COUNT <> recSalesShipmentLine.Quantity THEN
IF (intAssignBatch + intQtyBatch) > intShipmentLine THEN
ERROR('Error'); //produce error message
IF intQtyAssign < intShipmentLine THEN
IF CONFIRM('Are you sure?',FALSE) = FALSE THEN
EXIT;
BEGIN
IF recSerialNoInformation.FINDSET(FALSE,FALSE) THEN
REPEAT
recSerialNoInformation2 := recSerialNoInformation;
recSerialNoInformation2."Shipment No." := recSalesShipmentLine."Document No.";
recSerialNoInformation2."Shipment Line No." := recSalesShipmentLine."Line No.";
recSerialNoInformation2."Batch No." := '';
recSerialNoInformation2.MODIFY;
UNTIL recSerialNoInformation.NEXT = 0;
recWhseSerialBatchHeader.CALCFIELDS(Quantity);
IF recWhseSerialBatchHeader.Quantity = 0 THEN;
recWhseSerialBatchHeader.DELETE;
END;
END;
This is my code so far. I've commented what I want tot ry and achieve on the lines im having difficulty with.
recWhseSerialBatchHeader.RESET;
recWhseSerialBatchHeader.SETFILTER(Quantity, '>%1',0);
frmWhseSerialBatchList.SETTABLEVIEW(recWhseSerialBatchHeader);
frmWhseSerialBatchList.LOOKUPMODE(TRUE);
IF frmWhseSerialBatchList.RUNMODAL = ACTION::LookupOK THEN BEGIN
frmWhseSerialBatchList.GETRECORD(recWhseSerialBatchHeader);
recSerialNoInformation.RESET;
recSerialNoInformation.SETRANGE("Batch No.", recWhseSerialBatchHeader."No.");
recSerialNoInformation.RESET;
recSerialNoInformation3 := recSerialNoInformation;
recSerialNoInformation3.SETRANGE("Shipment No.", recSalesShipmentLine."Document No.");
recSerialNoInformation3.SETRANGE("Shipment Line No.", recSalesShipmentLine."Line No.");
intQtyBatch := recWhseSerialBatchHeader.Quantity; //This should take the Quantity from the Whse Serial Batch List
intShipmentLine := recSerialNoInformation."Shipment Line No",Quantity; //take the quantity from the Posted Sales Shipment
intQtyAssign := recSalesShipmentLine.Quantity; //take the quantity from the Serial Number Information List
recWhseSerialBatchHeader.Quantity.COUNT //This should count the quanity
recSalesShipmentLine.Qantity.COUNT //This Should count the quantity
IF recSerialNoInformation.COUNT <> recSalesShipmentLine.Quantity THEN
IF (intAssignBatch + intQtyBatch) > intShipmentLine THEN
ERROR //produce error mmessage
IF intQtyAssign < intShipmentLine THEN
//contineue code
IF CONFIRM('Are you sure?',FALSE) = FALSE THEN
EXIT;
BEGIN
IF recSerialNoInformation.FINDSET(FALSE,FALSE) THEN REPEAT
recSerialNoInformation2 := recSerialNoInformation;
recSerialNoInformation2."Shipment No." := recSalesShipmentLine."Document No.";
recSerialNoInformation2."Shipment Line No." := recSalesShipmentLine."Line No.";
recSerialNoInformation2."Batch No." := '';
recSerialNoInformation2.MODIFY;
UNTIL recSerialNoInformation.NEXT = 0;
recWhseSerialBatchHeader.CALCFIELDS(Quantity);
IF recWhseSerialBatchHeader.Quantity = 0 THEN;
recWhseSerialBatchHeader.DELETE;
END;
END;
Pl. try to write some code based on the logic mentioned above.
If you face any issue / error within same, copy your code here so that we can help you.
IntQtyBatch should take the Quantity from the Whse Serial Batch List
IntShipmentLine is to take the quantity from the Posted Sales Shipment
IntAssignQty is to take the quantity from the Serial Number Information List
Pl. write the logic of all the three fields and related conditions. If you face any error, we can help.
As of now, we are not able to understand the logic of these fields.
Sohail Ahmed
2
mmv
2
Amol Salvi
2