cancel
Showing results for 
Search instead for 
Did you mean: 

Add line additional expenses via DI API (entry already exists error)

Andre_S
Contributor
0 Kudos

Hi all,

I'm currently struggeling with adding line additional expenses to an existing Sales Order via B1iSN / DI API (This entry already exists in the following tables (ODBC -2035) error). My scenario: B1 sends SO to SAP ECC, SAP ECC confirms order back with prices and additional expenses.

Everything works in case I have just one additional expense (freight 1). It stops working once I have several lines in the SO and also several additional expenses per row (freight 1 & freight 2). My BOM BO:


<Document_LinesAdditionalExpenses>

<row>

<LineNumber>0</LineNumber>

<ExpenseCode>4</ExpenseCode>

<LineTotal>15.00</LineTotal>

</row>

<row>

<LineNumber>0</LineNumber>

<ExpenseCode>5</ExpenseCode>

<LineTotal>-2.58</LineTotal>

</row>

<row>

<LineNumber>1</LineNumber>

<ExpenseCode>4</ExpenseCode>

<LineTotal>7.55</LineTotal>

</row>

<row>

<LineNumber>1</LineNumber>

<ExpenseCode>5</ExpenseCode>

<LineTotal>-9.34</LineTotal>

</row>

</Document_LinesAdditionalExpenses>

Coding also works in case I first add the additional expenses manually in B1 to the SO and I just update the values. It finds and updates the correct fields for all 4 expenses. But somehow add is not working.

Any hints what I might be doing wrong? Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

Nussi
Active Contributor
0 Kudos

Hi,

Comparing your XML with how it works technically via DIAPI, the mistake should be that you add twice LineNumber 0 and 1.

For me - comparing it with DIAPI - you overwrite LineNumber 0 and LineNumer 1 twice with ExpenseCode 5

(both rows placed after you fill ExpsenseCode 4)

At the moment you have 4 rows -> reduce the XML to 2 rows.

One row with Expensecode 4 (LineNum 0) and one with ExpenseCode 5 (LineNum 1).

i hope this helps you fix the problem or at least guides you in the right direction.

From DIAPI Documentation:

For each type of additional expense you can add one row that summarizes all expenses of that type.

regards David

Andre_S
Contributor

Yes, you're right, already found the issue after my post.

Groupcode tag was missing.

Answers (0)