‎2010 Jul 12 4:57 PM
Hi, I am using Simple Transformation (ST) to convert an XML file into ABAP data. In my XML file some XML tags are optional: sometimes they are available in the file, sometimes they are not. I can not find out how to define a ST for this.
Either the XML fields are in the ST definition and then these field should also be in the XML file or
the XML fields are not in the ST definition and then these fields are not allowed in the XML.
Regards jack
‎2010 Jul 22 12:21 PM
Hi Jack, please find some sample coding below that will solve your issue:
<tt:cond check="not-initial(ref('E1EDL20.INCO1'))">
<INCO1 tt:value-ref="E1EDL20.INCO1"/>
</tt:cond>With the simple transformation tt cond statment you can make an XML tag optional. In below example during deserialisation xml tag <INCO1> will be skipped when not availabke in the xml and SAP data E1EDL20.INCO1 will not be filled by the transformation.
Regards. Please give points when usefull !
‎2010 Jul 22 12:21 PM
Hi Jack, please find some sample coding below that will solve your issue:
<tt:cond check="not-initial(ref('E1EDL20.INCO1'))">
<INCO1 tt:value-ref="E1EDL20.INCO1"/>
</tt:cond>With the simple transformation tt cond statment you can make an XML tag optional. In below example during deserialisation xml tag <INCO1> will be skipped when not availabke in the xml and SAP data E1EDL20.INCO1 will not be filled by the transformation.
Regards. Please give points when usefull !
‎2020 Jun 27 11:03 AM
Hi J. Graus,
i have similar requirement (using multiple XML's) to update deep structures in abap.
ST logic would be as below:

i tried above given code but no luck.

please advise.
Thanks in advance.
Regards,
Buddha