Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

posting thru X++

153 views
Skip to first unread message

GK

unread,
May 10, 2006, 12:28:13 AM5/10/06
to
hi,
i want to post the purchase order thru X++ , and i should be able to
select the update quantity of the post.
i.e if i have the quantity of 100 in my purchase order ,but i am able
to post the invoice/packing slip for qty 50.

how can it be done thru X++.

thanks,
Gopal.

nitin

unread,
May 10, 2006, 8:20:27 AM5/10/06
to
Hi,
U can post the PO thru X++ code by first initialising four objects.
"PP = new PurchFormLetter_PackingSlip(true);
Then
purchParmUpdate
PurchParmTable
PurchParmLine"

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

Confuser

unread,
May 10, 2006, 9:30:02 PM5/10/06
to
hi,

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.

Daniel

unread,
Sep 1, 2010, 5:24:03 AM9/1/10
to
Hi
Did you get any solution until yet.
I have the same problem.

Regards,
Daniel

0 new messages