Hi,
I need to do partial packing slip by x++ code.
please some one help.
Hi,
I need to do partial packing slip by x++ code.
please some one help.
there are many links , try to google it.
are you facing any specific issue in code?
Yes kunal.
am facing issue. i want to do partial packing slip item by item by mentioning item id in the code. But i search and change some alteration but it posting total item item only.
please find my below code :
/**************************
SalesFormLetter salesFormLetter = SalesFormLetter::construct(DocumentStatus::packingslip);
SalesTable salesTAble;
SalesParmLine parmLine;
;
salesTable = SalesTable::find(‘SO_0000022’);
salesFormLetter.salesTable(salesTAble);
salesFormLetter.transDate (systemDateGet());
salesFormLetter.specQty (SalesUpdate::packingslip);
salesFormLetter.createParmUpdateFromParmUpdateRecord(salesFormLetter.s alesParmUpdate());
salesFormLetter.initParmSalesTable(salesTAble);
salesFormLetter.initParameters(salesFormLetter.salesParmUpdate(),Printout::After);
// packing slip posted for all line
salesFormLetter.initLinesQuery();
while select forUpdate parmLine where parmLine.ParmId == salesFormLetter.parmId() && parmLine.itemid == ‘item1’
{
ttsBegin;
parmLine.DeliverNow = 1;
parmLine.setQty(parmLine.salesParmTable().ordering, salesFormLetter.SalesParmUpdate().creditRemaining);
parmLine.setInventDeliverNow();
parmLine.setLineAmount();
parmLine.update();
ttsCommit;
}
salesFormLetter.run();
***************/
for example, if i have 10 item with multiple quantity for each item and pass item id in where condition, then the particular item only affect the delivered quantity. other items post full packing slip by calling the method salesFormLetter.initLinesQuery();
Thanks
Please replace your piece of code at the end 'salesFormLetter.run(); ’ with the below and checkl
salesFormLetter.update(salesTAble, today(), SalesUpdate::DeliverNow);
Hi Krishna,
Thanks for you reply.
Not working. No item triggered.
Thanks
Please ignore my previous reply and replace your 4th line and let me know
salesFormLetter.specQty (SalesUpdate::packingslip); with SalesFormLetter.specQty (SalesUpdate::DeliverNow);
Hi Krishna,
Thanks for your time.
I feel, i may not clearly tel my issue.
My task is i need to do partial packing slip line by line(item by item).
if i use my above query it doing full packing slip.
I tried your above method, but it not affect anything.
Waiting for your response.
check in the packingslip , select all option , check the line details, you will find only remaining quantity.so it is partially done.
Once again thanks for you response
Sorry Kunal, for me its not working.
We are not passing any parameter to any line against sales order then how it will effect the lines ??. If possible can you send me little bit clearly?
Thanks
you are passing itemid in the below code
while select forUpdate parmLine where parmLine.ParmId == salesFormLetter.parmId() && parmLine.itemid == ‘item1’
and setting the quantity at delivery now
Parmline.deliveryline = 1
For your information, again i post the code by did the changes what you mentioned. But nothing will effect. if i change packing slip in the line (salesFormLetter.specQty (SalesUpdate::DeliverNow)) it post full packing slip
salesFormLetter salesFormLetter = SalesFormLetter::construct(DocumentStatus::PackingSlip);
SalesTable salesTAble;
salesLine salesline;
SalesParmLine parmLine;
;
salesTable = SalesTable::find(‘SO_00002727’);
salesFormLetter.salesTable(salesTAble);
salesFormLetter.transDate (systemDateGet());
salesFormLetter.specQty (SalesUpdate::DeliverNow);
salesFormLetter.createParmUpdateFromParmUpdateRecord(salesFormLetter.salesParmUpdate());
salesFormLetter.initParmSalesTable(salesTAble);
salesFormLetter.initParameters(salesFormLetter.salesParmUpdate(),Printout::After);
salesFormLetter.initLinesQuery();
while select forUpdate parmLine where parmLine.ParmId == salesFormLetter.parmId() && parmline.ItemId == ‘item1’
{
ttsBegin;
parmLine.DeliverNow = 1;
parmLine.setQty(parmLine.salesParmTable().ordering, salesFormLetter.SalesParmUpdate().creditRemaining);
parmLine.setInventDeliverNow();
parmLine.setLineAmount();
parmLine.update();
ttsCommit;
}
salesFormLetter.run();
}
Thanks
SalesFormLetter salesFormLetter = SalesFormLetter::construct(DocumentStatus::Invoice);
SalesTable salesTAble;
SalesParmLine parmLine;
;
salesTable = SalesTable::find(‘DSB-0000001065’);
salesFormLetter.salesTable(salesTAble);
salesFormLetter.transDate (systemDateGet());
salesFormLetter.specQty (SalesUpdate::All);
//If you want proforma you can enable the code
//salesFormLetter.proforma (true);
//salesFormLetter.printFormLetter (true);
salesFormLetter.createParmUpdateFromParmUpdateRecord(salesFormLetter.salesParmUpdate());
salesFormLetter.initParmSalesTable(salesTAble);
salesFormLetter.initParameters(salesFormLetter.salesParmUpdate(),Printout::After);
salesFormLetter.initLinesQuery();
while select forUpdate parmLine where parmLine.ParmId == salesFormLetter.parmId()
{
ttsBegin;
parmLine.DeliverNow = 2;
parmLine.setQty(parmLine.salesParmTable().ordering, salesFormLetter.SalesParmUpdate().creditRemaining);
parmLine.setInventDeliverNow();
parmLine.setLineAmount();
parmLine.update();
ttsCommit;
}
salesFormLetter.run();
Kunal,
The query you sent is using for invoice.
static void Job49(Args _args)
{
salesLine salesLine;
salesFormLetter salesFormLetter;
SalesTable salestable;
;
ttsbegin;
//update Sales Line
salestable = salestable::find(‘DSB-0000001089’);
salesLine = SalesLine::find(‘DSB-0000001089’, 1, true); // find your itemid.
salesLine.SalesDeliverNow = 1;
salesLine.setInventDeliverNow();
salesLine.doUpdate();
//Post the delivery note
salesFormLetter = SalesFormLetter::construct(DocumentStatus::PackingSlip);
//salesFormLetter.progressHide(); // Hide the progress bar.
salesFormLetter.update(salesTable, // SalesTable
SystemDateGet(), // Delivery date
SalesUpdate::DeliverNow, // Quantity to update (SpecQty)
AccountOrder::None, // AccountOrder
false, // Proforma only?
false); // Printout?
ttsCommit;
}
Mr.Kunal,
Thanks a lot. its perfectly working!! [:D][:D]
Just i create new method and pass sales item id instead of sales line number, that also working perfectly
Once again thanks a lot for your support