cancel
Showing results for 
Search instead for 
Did you mean: 

XSLT_TOOL - Include Tag with Variable

Claytoncbj
Participant
0 Kudos
544

Hi!

By TCODE: XSLT_TOOL , I need create the tag bellow.

<ShipNoticeHeader deliveryDate="2022-12-06T08:00:00-07:00" shipmentDate="2022-12-06T08:00:00-07:00" noticeDate="2022-12-06T14:11:06-07:00" operation="new" shipmentID="0001">

Considering the information as variables "2022-12-06T08:00:00-07:00","2022-12-06T08:00:00-07:00","2022-12-06T14:11:06-07:00","new" and "0001"

How do I do?

Thanks!

Accepted Solutions (0)

Answers (1)

Answers (1)

Sandra_Rossi
Active Contributor
0 Kudos

XSLT_TOOL is same as STRANS to edit Transformations of language either ST or XSLT. The two languages are different. It's 2 different answers. I guess your question is about serializing e.g.

CALL TRANSFORMATION zzzzz
  SOURCE delivery_date = '2022-12-06T08:00:00-07:00'
         shipment_date = '2022-12-06T08:00:00-07:00'
         notice_date   = '2022-12-06T14:11:06-07:00'
         operation     = 'new'
         shipment_id   = '0001'
OPTIONS
xml_header = 'no'
RESULT
XML DATA(xml_utf8).

now how to initialize the XML attributes depends on the transformation language you want to use. ST is recommended because it's faster.

Of course, a simple concatenation could be used instead...

Transformation ZZZZZ written in ST language:

<?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">

  <tt:root name="DELIVERY_DATE"/>
  <tt:root name="SHIPMENT_DATE"/>
<tt:root name="NOTICE_DATE"/> <tt:root name="OPERATION"/> <tt:root name="SHIPMENT_ID"/> <tt:template match="/"> <ShipNoticeHeader> <tt:attribute name="deliveryDate" ref="DELIVERY_DATE"/> <tt:attribute name="shipmentDate" ref="SHIPMENT_DATE"/> <tt:attribute name="noticeDate" ref="NOTICE_DATE"/> <tt:attribute name="operatione" ref="OPERATION"/> <tt:attribute name="shipmentID" ref="SHIPMENT_ID"/> </ShipNoticeHeader> </tt:template> </tt:transform>

Final result in XML_UTF8, as characters (stored as bytes using UTF-8):

<ShipNoticeHeader deliveryDate="2022-12-06T08:00:00-07:00" 
 shipmentDate="2022-12-06T08:00:00-07:00" noticeDate="2022-12-06T14:11:06-07:00" 
 operation="new" shipmentID="0001">