on 11-05-2015 10:22 AM
Hi All,
I have a field in my entityset LIFNR (defined with standard data element of char type) . The problem I am facing is if there is value starting with 0's say"0000008" , in the xml output its shown as "8". Its removing the leading zero's while showing in xml.
I checked in debugging mode , the value in the internal table et_entityset , there its showing the value along with zero's but in the xml output in removes them. Please find the attached screenshots for the same. (One more screenshot is in reply to this thread since it does not allow more then 3 attachments)
Regards
Amber
Hello Amber,
Please open the Model Provider Class and there would be conversion exit which is called for that particular LIFNR property.
Disable that exit if you do not want leading zeros.
Code details are in the below ->
Disable Conversion Exits in Gateway | SCN
Regards,
Ashwin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you want leading you should not call any conversion. First check inside MPC class any conversion is called to remove zeros. If found then remove that.
To do that code details are already show in that blog ( to remove / add conversion accordingly ) all is needed is removal of any conversion called for that property.
Hi Ashwin,
In MPC class , the conversion is added to the property . Since its recommended not to alter the MPC class , i can try to disable that in MPC_EXT class as given in the link you sent.
But when i saw the available methods for the ODATA property interface , there is no method called DISABLE_CONVERSION() . Instead the only method related to conversion in the interface is SET_CONVERSION_EXIT . So how to call the DISABLE_CONVERSION method as told in that link.
Please find the screenshot for it
Not sure why you are unable to find this and version.
Check the below once ->
Conversion Handling in OData Channel - SAP Gateway Foundation (SAP_GWFND) - SAP Library
Last option would be manually remove this part of the code which is trimming off zeros by implementing Define method of the MPC_EXT class for that particular property LIFNR.
Maybe not so relevant but I had a similar problem. I created a service where there was a field that had the leading 0 missing in the XML, JSON payload. This field was of type Char10. I converted it to NUMC in the CDS the service was consuming and it kept the leading 0.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.