Monday 25 November 2013

How to create Purchase Order through X++


In this post we will learn the below using X++ :

1) How to Create Purchase Order
2) How to Create Purchase Order Line
3) How to Post Purchase Order

static void PurchaseOrder(Args _args)
{
PurchTable pt;
PurchLine pline;
NumberSeq ns;
PurchID pid;
PurchFormLetter pl;
;
//Create Purchase Order
ns=NumberSeq::newGetNumFromCode(SalesParameters::numRefSalesId().NumberSequence);
pt.initValue();
pid=ns.num();
pt.PurchId=pid;
pt.OrderAccount="4202";
pt.initFromVendTable();
pt.insert();

//Create Purchase Line
pline.clear();
pline.PurchId=pid;
pline.ItemId="1109";
pline.createLine(NoYes::Yes,NoYes::Yes,NoYes::Yes,NoYes::Yes,NoYes::Yes,NoYes::Yes);
info("Purchase Order Created Sucessfully");

//Post the PO
pl=PurchFormLetter::construct(DocumentStatus::Invoice);
pl.update(PurchTable::find(sid),sid,SystemDateGet(),PurchUpdate::All,AccountOrder::None,false,true);
info("Posted Sucessfully");
}


No comments:

Post a Comment

SQL/SSRS Interview questions I thought of blogging some SQL/SSRS interview questions.

Below are some. I will add more, when I complete the compilation 1. What is OLTP(Online Transaction Processing)? OLTP stands ...