Skip to Content
0

inserting data in ORDR and RDR1 using DI API VB .net

Jan 11 at 09:46 PM

217

avatar image
Former Member

I want to know, how to create/enter new sale order record usin SAP B1 DI API using vb.net.

1. How we get new document number and fill all required field of ORDR Table

2. How we add/post multiple lines in RDR1 Table.

Kindly guide what is required steps to generate document. Where changes required, how many other tables will be update.

Thanks

Waqar

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Brendan Bell Jan 12 at 03:20 AM
0

Hi Waqar,

Firstly, have you checked in the SAP

C:\Program Files (x86)\SAP\SAP Business One SDK

There is a Help Folder with some help files

Second, there are also examples / samples in the same folder for various tasks to create documents in SAP.

In regards to document number, this is returned on successful posting of sat a sales order into SAP. You dont assign the number yourself.

Regards

Share
10 |10000 characters needed characters left characters exceeded
Johan Hakkesteegt Jan 12 at 09:20 AM
0

Hi Waqar,

"1. How we get new document number..."

The system assigns a new document number at the moment you add the order. Upon success, you can query the system like this to get the new document number, for example to show to the user:

Dim oDoc As SAPbobsCOM.Documents
oDoc = oCompany.GetBusinessObject(BoObjectTypes.oOrders)
If oDoc.GetByKey(oCompany.GetNewObjectKey) Then MsgBox(oDoc.DocNum.ToString)

"...and fill all required field of ORDR Table"

The only required field is CardCode. All other fields will be filled according to the default settings in B1. Any other fields should only be determined when they deviate from the default setting.

"2. How we add/post multiple lines in RDR1 Table."

The system in B1 is that when you create a new document, it automatically has a first line. You then proceed to fill this line, if necessary you then add a new empty line which you then fill, etc. In pseudo code:

  1. Create New Document.
  2. Set CardCode <-- required.
  3. Set optional fields like DocDueDate, NumAtCard, Comments, etc.
  4. Set the ItemCode for the existing first line <-- required.
  5. Set the Quantity for the existing first line <-- required.
  6. Set optional fields like Price, FreeTxt, row discount, etc.
  7. Check if more lines are needed and if yes, go to 8. else go to 13.
  8. Add new empty line
  9. Set the ItemCode for the newly added line <-- required.
  10. Set the Quantity for the newly added line <-- required.
  11. Set optional fields like Price, FreeTxt, row discount, etc.
  12. Go to 7.
  13. Add The Document.
  14. Retrieve The New Document Number.

Regards,

Johan

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Thanks for you reply.

is it possible? you can share vb.net / c# sample code.

secondly, I Notice that example only showing MSQL & MSSQL2005, but i have 2014.

also guide me same logic work with HANA?

Regards

Waqar

0

Hi Waqar,

"...you can share vb.net / c# sample code..."

As Former Member mentioned, once you install the SDK, you will get code examples for almost all operations, both in VB.NET and C#. Once you have written some code, and have more specific questions on how to do something, please post a new question here on SCN.

"...example only showing MSQL & MSSQL2005, but i have 2014..."

In your code, you need to connect to the company database. One of the steps is to determine the SQL version:

oCompany.DbServerType = BoDataServerTypes.dst_MSSQL2014

"...also guide me same logic work with HANA?"

To my knowledge, your code will also work with HANA. However, the sql syntax is different, and queries for MS SQL will not always work for HANA.

Regards,

Johan

0