how can it be done thru X++.
thanks,
Gopal.
Then u cn call the following methods of PP
PP.purchParmUpdate(TmpPurchParmUpdate);
PP.PurchParmTable(TmpPurchParmTable);
PP.PurchParmLine(PurchParmLine1);
PP.parmId(TmpPurchParmUpdate.ParmId);
PP.run();
Method for initialising the "purchParmUpdate" Obj
void createParamUpdate()
{
NumberSequenceReference NumberSequenceReference;
;
NumberSequenceReference =
NumberSequenceReference::find(typeId2ExtendedTypeId(typeid(ParmId)));
TmpPurchParmUpdate.clear();
TmpPurchParmUpdate.initValue();
TmpPurchParmUpdate.ParmId =
NumberSeq::newGetNumFromCode(NumberSequenceReference.NumberSequence,true,true).num();
TmpPurchParmUpdate.DocumentStatus = DocumentStatus::Invoice;
TmpPurchParmUpdate.SpecQty = PurchUpdate::All;
TmpPurchParmUpdate.CheckCreditMax =
TypeofCreditMaxCheck::None;
TmpPurchParmUpdate.CreditRemaining = noyes::Yes;
TmpPurchParmUpdate.SumBy = AccountOrder::Account;
TmpPurchParmUpdate.StartDate = systemdateget();
TmpPurchParmUpdate.EndDate = systemdateget();
TmpPurchParmUpdate.insert();
}
Method for initialising the "PurchParmTable" Obj
void createParamTable(purchTable purchtable,Invoiceid _invoiceid )//
=invoiceid)
{
TmpPurchParmTable.clear();
TmpPurchParmTable.initFromPurchTable(purchTable);
TmpPurchParmTable.ParmId = TmpPurchParmUpdate.ParmId;
TmpPurchParmTable.Ordering = documentstatus::Invoice;
TmpPurchParmTable.TransDate = systemdateget();
TmpPurchParmTable.Approved = noyes::Yes;
TmpPurchParmTable.ApprovedBy = curuserid();
TmpPurchParmTable.ParmJobStatus = ParmJobStatus::Waiting;
TmpPurchParmTable.ReCalculate = noyes::Yes;
TmpPurchParmTable.Num =_invoiceid;
TmpPurchParmTable.insert();
}
Method for initialising the "PurchParmLine1" Obj
Here _qty is the actual quantity that u want to Packing Slip update.
As u said u want to update 50 rather than 100 as specified in PO.
void createParamLine(purchline purchline,qty _qty)
{
VendInvoiceTrans VendInvoiceTrans;
;
VendInvoiceTrans.clear();
select sum(qty) from VendInvoiceTrans
where VendInvoiceTrans.OrigPurchid ==purchline.PurchId
&&
VendInvoiceTrans.ItemId ==purchline.ItemId ;
PurchParmLine1.clear();
PurchParmLine1.initFromPurchLine(purchline);
PurchParmLine1.ParmId = TmpPurchParmUpdate.ParmId;
PurchParmLine1.PurchId = purchline.PurchId;
PurchParmLine1.RemainBeforeInvent =purchline.PurchQty -
VendInvoiceTrans.Qty;
PurchParmLine1.InventNow = _qty;
if((purchline.PurchQty - _qty) > 0)
PurchParmLine1.RemainAfterInvent =
(purchline.PurchQty - _qty) - VendInvoiceTrans.Qty;
else
PurchParmLine1.RemainAfterInvent = 0;
PurchParmLine1.RemainAfter =
PurchParmLine1.RemainAfterInvent;
PurchParmLine1.RemainBefore = purchline.PurchQty -
VendInvoiceTrans.qty;
PurchParmLine1.ReceiveNow = PurchParmLine1.InventNow;
PurchParmLine1.LineAmount =
PurchParmLine1.calcLineAmount(PurchParmLine1.InventNow);
PurchParmLine1.insert();
}
Hope this will solve ur problem :) :)
Regards,
Nitin Sharma
you can use the PurchFormLetter class to post your PO. you may search in the
discussion forum on this subject, there are couple of threads had been
posted.
Regards,
Daniel