cancel
Showing results for 
Search instead for 
Did you mean: 

OData 4 and C# consuming Service Layer 2108HF1+ and greater throws -5002 error on Document create?

0 Kudos

Can anyone confirm when using Service Layer 2108HF1 or higher and creating a "Document" , in my case a Delivery Note, that the property present in the XML metadata from Service Layer named "DocFreightEBooksDetails" will cause Service Layer to respond with -5002 error unless removed from the OData service completely. I have replicated this behaviour on 2108HF1 and 2308HF1 (last weeks release). Commenting the entire "DocFreightEBooksDetails" section in the schema results in successful Service Layer document creation (code 201 returned).

Using an older SL XML (version 10 PL02) without "DocFreightEBooksDetails" present also results in successful document creation up to and including 2308HF1.

Clearly some kind of SL problem when passing this property as empty array (default OData behaviour).

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi andrew.mademtzidis,

  • What is the SAP Business One version and patch where the issue is reproducible?
  • Can you reproduce the issue in the DEMO database? If yes, kindly specify the localization of the DEMO database.
  • Please mention the steps to reproduce the issue. Specially, how to have the value in DocFreightEBooksDetails?

Kind regards,

ANKIT CHAUHAN

SAP Business One Support

0 Kudos

Hi Ankit,

The SAP B1 version and SL we are running is 2108HF1, the metadata consumed was from the 2108HF1 SL, and it has 3 "EBooks" type properties present. We previously used our PL02 XML metadata on 2108HF1 successfully, but had need to consume and update due to custom field changes and other minor issues. PL02 does not have these 'EBooks' fields.

Yes its reproducible on the demo database, the localization/language is EN-AU/English (is that what you mean?).

It seems any Service Layer action with any of the "EBooksDetails" properties present (remembering that OData WILL send empty arrays for collections as default) will have adverse effects. For a marketing document creation you'll get -5002 error, for a PATCH to a purchase order it will delete a line from POR2 related to OEXD if present if you have "LineFreightEBooksDetails" present as empty array in the PATCH data, again OData will send empty arrays for collections/objects.

This seems like some kind of serious bug, related to C#, OData, Consuming 2108HF1 SL and various SL functions thereafter, my development document now reflects as follows:

#8. ************* IMPORTANT NOTE ***********************

As of SAP 2108HF1 you must remove the following broken properties from the generated S2layer.cs:

LineFreightEBooksDetails from the DocumentLineAdditionalExpense object : will cause POR2 lines related to OEXD to disappear inexplicably

DocFreightEBooksDetails from the DocumentAdditionalExpense object : will cause ORDR to not create with -5002 error

EBooksDetails from the Document object : probably cause something bad like its brothers and sisters, so its gone!

Wondering if this is a known issue or you know of any KB notes, workarounds etc? Thanks.

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert

Hi andrew.mademtzidis,

Can you please help to share a short and simple JSON request to reproduce the issue?

Kind regards,

ANKIT CHAUHAN

SAP Business One Support

0 Kudos

Hi Ankit,

Below are 2 OData requests using Microsoft.OData.Client in C# .NET 7 having consumed the 2108HF1 Service Layer metadata.xml.

Here are the complete details of a failed request with the EBooksDetails field(s) present:

https://pastebin.com/by35SMHZ

Here are the complete details of a SUCCESSFUL request with the EBooksDetails field(s) REMOVED:

https://pastebin.com/0stEn90N

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi andrew.mademtzidis,

Unfortunately, I do not have access to Pastebin.

Better, if you can check/test the request using POSTMAN and provide the same request (used in POSTMAN) here itself.

Kind regards,

ANKIT CHAUHAN

SAP Business One Support

0 Kudos

Hi,

Unfortunately the two examples I have are long as they are real (live) queries minus the personal data I removed/changed. Best I can do.

C# OData and Service Layer , at least up to 2108HF1, don't play together particularly well out of the box, I am surprised there are not more users posting for help and about issues, I suspect most give up consuming SL via C# OData and simply create their own REST/JSON models manually.

Accepted Solutions (0)

Answers (0)