Skip to Content
0

How to deserialize XML-content to ABAP data fields properly?

Dec 02, 2017 at 07:58 AM

124

avatar image

When reading the XML content in ABAP internal table fields via XSLT, sometimes the value cannot be read or an exception appears: Error during deserialization.

1. How can I select the right data type for ABAP itab fields, if I now the XML data type?

2. Is there some table for XML to ABAP, where all data type are in detail listed?

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

1 Answer

Best Answer
Horst Keller
Dec 02, 2017 at 10:36 AM
1
Show 3 Share
10 |10000 characters needed characters left characters exceeded

Dear Mr. Keller,

Thank you for submitting the link with valuable information. On the other hand, my problem is not completely solved.

Can you please help me to fill the below table?

_________________________________________________________________

XML Data Type--------Format--------------------------------- ABAP Data Type

_________________________________________________________________

string 250--------------- Text---------------------------------------xstring

_________________________________________________________________

string 250-----------------Date yyyy-mm-dd --------------------XSDDATE_ISO

_________________________________________________________________

string 250 -----------------Date PARAM-4------------------------XSDDATE_ISO

---------------------------------------------------------------------------XSDDATE_D

_________________________________________________________________

string 250------------------Time hh:mm

_________________________________________________________________

string 250-------------------Number z9(4)

_________________________________________________________________

string 250-------------------Number 9(4)

_________________________________________________________________

string 250-------------------Number 9(7)

_________________________________________________________________

string 250-------------------Number 9(6)

_________________________________________________________________

string 250------------------Number z9(2)

_________________________________________________________________

string 250-------------------Number 9(5)

_________________________________________________________________

string 250-------------------Number d9(2)

_________________________________________________________________

string 250------------------Number 9(19)

_________________________________________________________________

string 250-------------------Number 9(17) v9(2)

_________________________________________________________________

string 250--------------------Number Delco price

_________________________________________________________________

string 250---------------------Number Delco amount

_________________________________________________________________

string 250---------------------Number customer invoice amount

_________________________________________________________________

string 250---------------------Number PARAM-3

_________________________________________________________________

Please note that

  • PARM-3 = Decimal separator used in field formats “,” or “.”
  • PARM-4 = Date format used in field formats “dd-mm-yyyy” or “yyyy-mm-dd”

Number format:

  • 9(X): an X-digit integer formatted with leading zeros and no sign e.g. 9(2) "01”
  • v: implicit decimal place e.g. 9(2)v9(2) formats 1.1 as “0110”
  • d: decimal mark as specified by PARM-3, either , or . e.g. 9(2)d9(2) formats 1.1 as “01,10” or “01.10”
  • z: supress leading zeros and include sign if negative e.g. z9(6)d9(2) “ -1.10” %: include per cent character e.g. z9(2)d9(2)% “ 20.00%”
  • Delco price: z9(X)d9(Y) where Y is BillingDocument/DeliverCompany/CurrencyPricingMinorUnits and X is the number of remaining digits in the field
  • Delco amount: z9(X)d9(Y) where Y is BillingDocument/DeliverCompany/CurrencyMinorUnits and X is the number of remaining digits in the field
  • Customer invoice amount: z9(X)d9(Y) where Y is BillingDocument/InvoiceCustomer/MinorUnits and X is the number of remaining digits in the field

Kind regards

P. S. my xml file head information <?xml version="1.0" encoding="UTF-8" standalone="true" ?>

0

The formats allowed in ABAP are explained in the ABAP documentation link provided by Horst.

As your formats seem to be a little bit different, then either you define your internal table with components of type STRING and you'll convert them after the transformation using ABAP code, or you adapt your XSLT to convert them into a valid ABAP format (XPATH substring, XSLT xsl:if, XSLT SAP sap:call-external, etc. - all this stuff is documented)

1
0