Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert from XML string to ABAP Structure

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

former_member188685
Active Contributor
0 Kudos

check Raja's suggestion

2 REPLIES 2

former_member188685
Active Contributor
0 Kudos

check Raja's suggestion

0 Kudos

Hi, Vijay,

I'll try this solution after lunch :).

Thank you very much.

Best regards,

Andre