on 07-06-2012 8:11 AM
SAP Business One , Invoice Posting from SDK
Hi Dickson,
Dim oINV As SAPbobsCOM.Documents
oINV = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices)
oINV.CardCode = "TEST"
oINV.Add
Regards,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Dickson,
Go to your project properties, Add Reference, In COM tab there is a reference SAPbobsCOM. Use it. For entering the data.
Try this.
SAPbobsCOM.Documents Oje = (SAPbobsCOM.JournalEntries)SBO_Company.GetBusinessObject(BoObjectTypes.oInvoices);
SAPbobsCOM.Recordset oRecSet = (Recordset)this.SBO_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
string updating = "select U_IntlTtl from [@ChallanMaster] where U_TotalC1 = '" + ChallanNum + "'";
oRecSet.DoQuery(updating);
while (oRecSet.EoF == false)
{
double Amount = Convert.ToDouble(oRecSet.Fields.Item("U_IntlTtl").Value); // This is for if you have any UDF
Oje.Reference3 = ChallanNum;
Oje.Lines.AccountCode = "CH0000ALL";
Oje.Lines.Credit = Amount;
Oje.Lines.Add();
Oje.Lines.AccountCode = "LP0000ALL";
Oje.Lines.Debit = Amount;
Oje.Lines.Add();
int ith = 0;
try
{
ith = Oje.Add();
if (ith != 0)
{
int irrcode;
string errmsg;
SBO_Company.GetLastError(out irrcode, out errmsg);
Program.oMainSAPDI.ShowMessage(errmsg, BoStatusBarMessageType.smt_Error);
}
}
catch (Exception ex)
{
Program.oMainSAPDI.ShowMessage(ex.Message, BoStatusBarMessageType.smt_Error);
}
This code was for entering the data into Journal Entry through DIAPI. For invoices you can use Highlighted part above. While the other highlighted part is for entering the data into matrix line.
Hope it helps
Thanks
Hi Dickson,
With the SDK come a set of examples for all basic operations. If you have installed the SDK, look for this path: C:\Program Files\SAP\SAP Business One SDK\Samples\COM DI\CSharp
You will find examples for connecting to the company object, how to create documents, etc, etc.
Ankit already gave you ready code. For all documents the principles are the same. In his code, just replace JournalEntries with Invoices
Regards,
Johan
Sorry for not been clear , i meant this . See below . oINV.Lines.ItemCode = redLines["ItemCode"].ToString(); oINV.Lines.LineTotal = double.Parse(redLines["LineTotal"].ToString()); oINV.Lines.Price = double.Parse(redLines["Price"].ToString()); oINV.Lines.Quantity = int.Parse(redLines["Quantity"].ToString()); oINV.Lines.VatGroup = redLines["VATGroup"].ToString(); oINV.Lines.AccountCode = redLines["AccountCode"].ToString(); //IDocument_Lines k = IDocument_Lines redLines["LineNum"].ToString(); oINV.Lines.LineNum = redLines["LineNum"].ToString(); oINV.Lines.Add(); The LineNum is underlined . How do i assign LinNum ?
I have created , Kindly and assist me address the challenge . http://scn.sap.com/thread/3203711
User | Count |
---|---|
95 | |
11 | |
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.