on 04-24-2015 7:59 AM
Hi,
What are the steps to create an AP Invoice based on a Purchase Order using DI API?
Which methods of which objects to use and what parameters to pass?
Thanks.
Hi Rajesh,
Here is a sample to create an Invoice based on a Sales Order. The same way you can change as per your requirement:
SAPbobsCOM.Documents oInvoice = default(SAPbobsCOM.Documents);
oInvoice = (SAPbobsCOM.Documents)SBO_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices);
oInvoice.CardCode = "C000003";
oInvoice.DocDueDate = DateAndTime.Now;
oInvoice.Lines.BaseType = Convert.ToInt32(SAPbobsCOM.BoObjectTypes.oOrders);
oInvoice.Lines.BaseEntry = Convert.ToInt32(3616);
oInvoice.Lines.BaseLine = 1;
oInvoice.Lines.Quantity = 3;
oInvoice.Lines.Add();
oInvoice.Lines.BaseType = Convert.ToInt32(SAPbobsCOM.BoObjectTypes.oOrders);
oInvoice.Lines.BaseEntry = Convert.ToInt32(3616);
oInvoice.Lines.BaseLine = 2;
int kth = 0;
kth = oInvoice.Add();
if (kth != 0)
{
int irrcode;
string errmsg;
SBO_Company.GetLastError(out irrcode, out errmsg);
Program.oMainSAPDI.ShowMessage(errmsg, BoStatusBarMessageType.smt_Error);
}
The main thing to remember is Base Type, Based Entry and Base Line.
Hope it helps.
Thanks & Regards
Ankit Chauhan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rajesh,
Yes, Base Entry will be the DocEntry of the Purchase Order by which you want to create the A/P Invoice.
Also for Base Line you can loop through all lines or can pick the information in the SQL Query.
It totally depends on you that how do you want to achieve it.
Also once your problem is resolved please help to close the thread.
Thanks & Regards
Ankit Chauhan
User | Count |
---|---|
107 | |
12 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.