cancel
Showing results for 
Search instead for 
Did you mean: 

Get exactly error lines when adding document - SAP B1 SDK

Former Member
0 Kudos

Hi ,

I used SDK to add a marketing document like this:

                   

                    lRetCode = oDraft.Add

                    If lRetCode <> 0 Then

                        oCompany.GetLastError(lRetCode, sErrMsg)

                    End if

And I received sErrMsg="No matching records found (ODBC -2028)". I can found Item doesn't exist manually . But with document have too many lines, how can I check it? Can I use SDK to get exactly error line ?

Accepted Solutions (1)

Accepted Solutions (1)

Johan_H
Active Contributor
0 Kudos

Hi Sancti,

This is a common problem with the error reporting system of B1, both in the client and with the SDK.

With the SDK we work around this problem by simply performing our own prechecks before adding a cardcode or an item to the document.

You can use a function with a query, or you can use the Item or BusinessPartner object's GetByKey method. Either way, you should check that the item exists, if it is frozen, and if there is a price for the given cardcode. And you can check for any other rules that you may have.

Regards,

Johan

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Sancti,

I think SDK does not provide the exact line number. I'd suggest you make function that checks if the item already exists and a counter for its line number. This way, you'd get the exact item which caused the 'No match' error.

Regards,

Ariel

edy_simon
Active Contributor
0 Kudos

Hi Sancti,

The same as this error message in the Application.

No it does not show you which line.

Regards

Edy

Former Member
0 Kudos

Thanks Edy,

I know it, but I want to get more tips or tricks from other developers . If you have any idea, share it! Plz.