The most important thing to handle is, the line number for the delivery lines. The logic needs to be created if you want to use custom line number else you can stick to the standard line numbering.
static void CreateDLVSchedule(Args _args) { List newScheduleLines = new List(Types::Container); PurchLine purchLine, purchLineNew; PurchDeliverySchedule purchDeliverySchedule; PurchTableForm_DeliverySchedule purchTableForm_DeliverySchedule; select purchLine where purchLine.PurchId == "PurchId" && purchLine.LineNumber == 10; purchTableForm_DeliverySchedule = PurchTableForm::construct(PurchTableFormId::DeliverySchedule, purchLine); purchLineNew.setTmp(); purchLineNew.data(purchLine.data()); purchTableForm_DeliverySchedule.purchLine_Init(purchLineNew); purchLineNew.LineNumber = purchLine.LineNumber + 1; // Add your logic to spcify line number purchTableForm_DeliverySchedule.purchLine_CreatePreSuper(purchLineNew); newScheduleLines.addEnd([purchLineNew]); purchTableForm_DeliverySchedule.parmScheduleLines(newScheduleLines); purchTableForm_DeliverySchedule.parmMarkupConversionMode(DlvScheduleMarkupConversionMode::Copy); purchTableForm_DeliverySchedule.updateSchedule(); info("Done"); }
This comment has been removed by the author.
ReplyDeleteHi! I used this code and in the first run it works good. Now, I have to modify this first schedule version and when I execute de same code change the quantity of the original purchLine. I try several changes into your code but I could not get the key to modifiy the schedule.
ReplyDeleteFor example, In a situation I need to delete all schedules and create new ones.
Did you have to do this any time? Could you please help me? Thanks