2015 Apr 28 10:46 AM
Hello experts,
I am desperate trying to find out how to transform an inbound XML to an ABAP data structure.
First of all, the incoming XML will have the following structure (I give a sample):
<REPLY>
<TIMESTAMP>20150423083544</TIMESTAMP>
<CODE>0</CODE>
<TEXT>SUCCESS</TEXT>
</ZPOS_RECORD_REPLY>
</PAYLOAD>
</REPLY>
And I have declared the following SAP data structures:
structure ZPOS_REPLY with the following components:
type ZPOS_REP_RECORDS is a table type with line type ZPOS_RECORD_REPLY which is a structure with the following components:
Now through xslt_tool I create a simple transformation (see attachment XSLT.PNG) with the following features:
- Root node name is REPLY of type ZPOS_REPLY
In ABAP program I have the following statement:
CALL TRANSFORMATION ZPOS_REPLY_6
source XML fp_xml_rep_string
RESULT ZPOS_REPLY = ltrans_reply.
where fp_xml_rep_string is xstring and attachment sample_reply_test.xml shows the string representation of incoming XML.
I get exception with message "Error accessing the ref. node 'MESSAGEID'".
What is the problem? I am new to XSLT and I wonder if I am missing something.
Thank you in advance,
Konstantinos
2015 Apr 28 2:47 PM
Hello again,
I managed to resolve the issue and would like to share the solution with the rest of the community.
XSLT is in attachment xslt.png and in the ABAP program I have the following
CALL TRANSFORMATION ZPOS_REPLY_6
source XML fp_xml_rep_string
RESULT REPLY = ltrans_reply.
where after RESULT I specify REPLY which is the root of the inbound XML and ltrans_reply is a structure (deep) of type ZPOS_REPLY.
Now the deep structure is filled correctly with the data of the inbound XML.
Konstantinos
Hello experts,
I am desperate trying to find out how to transform an inbound XML to an ABAP data structure.
First of all, the incoming XML will have the following structure (I give a sample):
<REPLY>
<TIMESTAMP>20150423083544</TIMESTAMP>
<CODE>0</CODE>
<TEXT>SUCCESS</TEXT>
</ZPOS_RECORD_REPLY>
</PAYLOAD>
</REPLY>
And I have declared the following SAP data structures:
structure ZPOS_REPLY with the following components:
type ZPOS_REP_RECORDS is a table type with line type ZPOS_RECORD_REPLY which is a structure with the following components:
Now through xslt_tool I create a simple transformation (see attachment XSLT.PNG) with the following features:
- Root node name is REPLY of type ZPOS_REPLY
In ABAP program I have the following statement:
CALL TRANSFORMATION ZPOS_REPLY_6
source XML fp_xml_rep_string
RESULT ZPOS_REPLY = ltrans_reply.
where fp_xml_rep_string is xstring and attachment sample_reply_test.xml shows the string representation of incoming XML.
I get exception with message "Error accessing the ref. node 'MESSAGEID'".
What is the problem? I am new to XSLT and I wonder if I am missing something.
Thank you in advance,
Konstantinos
2015 Apr 28 2:47 PM
Hello again,
I managed to resolve the issue and would like to share the solution with the rest of the community.
XSLT is in attachment xslt.png and in the ABAP program I have the following
CALL TRANSFORMATION ZPOS_REPLY_6
source XML fp_xml_rep_string
RESULT REPLY = ltrans_reply.
where after RESULT I specify REPLY which is the root of the inbound XML and ltrans_reply is a structure (deep) of type ZPOS_REPLY.
Now the deep structure is filled correctly with the data of the inbound XML.
Konstantinos
2015 Apr 28 2:57 PM
Hi Konstantinos,
Is this nice Visual tool to create transformation a part of SE80 transformation editor?
Or is it a tool of different product?
Thank you,
Ihar
2015 Apr 28 3:06 PM
2015 Apr 28 3:13 PM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |