Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to convert from XML string to ABAP Structure

Hi,

I have a XML string such as:

<?xml version="1.0" encoding="UTF-8"?>
<posting xmlns="http://andre.com.br">
	<bkpf belnr="1700001284">
		<bukrs>0001</bukrs>
		<gjahr>2008</gjahr>
		<blart>RV</blart>
		<bldat>20080823</bldat>
		<budat>20080823</budat>
		<tcode>FB01</tcode>
		<bseg buzei="001">
			<bschl>40</bschl>
			<zuonr>Reference</zuonr>
		</bseg>
		<bseg buzei="002">
			<bschl>50</bschl>
			<sgtxt>Text</sgtxt>
		</bseg>
	</bkpf>
</posting>

It contains accounting document data. Also, on the ABAP Dictionary, I have the following structures:

ZPOSTING: 1 field, named posting, with data type ZBKPF

ZBKPF: Fields BELNR, BUKRS, GJAHR, BLART, BLDAT, BUDAT and TCODE. Also, I have a field named BSEG, that refers to a Table Type with line type BSEG.

I need to convert the XML string into an ABAP variable of type ZPOSTING, with all corresponding values. Please note that BSEG is a table.

How can I achieve this? I though about using CALL TRANSFORMATION and XML deserialization, but I couldn't find any examples.

PS: I'm using NetWeaver 2004s, SP 11.

Thanks in advance!

Andre

Tags:
Former Member

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question