2007 Aug 10 8:43 AM
Hi
I am creating a simple transformation program, XML to ABAP. My problem is that the XML, in contrast to previous transformations, can come in different variants.
I have 4 elements, <_4FBYG006> <_4FREL001> <_4FADR003> and <_4FEDM001>, that can come in random order, 1 to n number of times.
My question is how to handle this. Can I use the <cond> operator on elements or are there any other operators that I can use? Is this possible to do with ST or do I have to use XSLT to handle this problem?
Help is much appreciated!
regards Ole Mugaas
Hi
I am creating a simple transformation program, XML to ABAP. My problem is that the XML, in contrast to previous transformations, can come in different variants.
I have 4 elements, <_4FBYG006> <_4FREL001> <_4FADR003> and <_4FEDM001>, that can come in random order, 1 to n number of times.
My question is how to handle this. Can I use the <cond> operator on elements or are there any other operators that I can use? Is this possible to do with ST or do I have to use XSLT to handle this problem?
Help is much appreciated!
regards Ole Mugaas
2007 Aug 13 9:11 AM
Hi Ole,
Try the following. These are the general practices. Hope the best one helps you.
You can write code like similar...
DATA xml_string TYPE string.
DATA source1(10) TYPE c VALUE 'Field1'.
DATA source2(10) TYPE c VALUE 'Field2'.
CALL TRANSFORMATION ...
SOURCE root1 = source1
root2 = source2
RESULT XML xml_string.
For more help see
http://help.sap.com/saphelp_nw04/helpdata/en/e3/7d4719ca581441b6841f1054ff1326/content.htm
Or You can look for this option below:
Check these standard demo transactions:
SXSLTDEMO1
SSTDEMO1
SSTDEMO2
Here you can see an example how export data from ABAP to XML and XML data to ABAP.
Thanks,
Samantak.
Rewards points for useful answers.
2007 Aug 13 9:21 AM
Hi!
Thanks for your reply.
As you maybe saw from my question, I have already created mappings based on ST. My problem is that in my previous tasks I have dealt with a static XML, which makes it easy to withdraw the elements that I want. In this case however, the XML elements can come in different order every time, and some elements can be excluded from one response and be included in another.
What I'm after is how I can deal with this. Is there anyway you can loop through the XML using ST and extract information if elements are present and skip this if the element is not there?
regards Ole
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |