-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCreatePurchaseRequisition.xpp
36 lines (30 loc) · 1.24 KB
/
CreatePurchaseRequisition.xpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//Author: Mafigu Huggins
//Email: mafiguhuggins@gmail.com
//Tel: +263 782 326 160
class CreatePurchaseRequisition
{
public static void main(Args _args)
{
PurchReqTable purchReqTable;
PurchReqLine purchReqLine;
ttsbegin;
//Purchase requisition header
purchReqTable.clear();
purchReqTable.initValue();
purchReqTable.PurchReqId = NumberSeq::newGetNum(PurchReqTable::numRefPurchReqId()).num();
purchReqTable.PurchReqName = 'PR from X++ Job';
purchReqTable.insert();
//Purchase requisition lines
purchReqLine.clear();
purchReqLine.initValue();
purchReqLine.initFromPurchReqTable(purchReqTable);
purchReqLine.ItemId = "PRD000711"; //Replace ItemId according to your system's data
purchReqLine.BuyingLegalEntity = CompanyInfo::find().RecId;
purchReqLine.InventDimIdDataArea = curext();
purchReqLine.PurchQty = 2;
purchReqLine.modifiedField(fieldNum(purchReqLine,ItemId));
purchReqLine.insert();
ttscommit;
info(strFmt("Purchase requisition '%1' created successfully",purchReqTable.PurchReqId));
}
}