<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Simple transformation call-method variable bindings in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-transformation-call-method-variable-bindings/m-p/12477629#M2001536</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
  &lt;P&gt;In a simple transformation program (internal table data to XML string) is it possible to control the value of an XML's element with the &lt;EM&gt;call-method &lt;/EM&gt;tag? &lt;A href="https://answers.sap.com/comments/13594901/view.html"&gt;What I'm trying to do, further explained.&lt;/A&gt;&lt;/P&gt;
  &lt;P&gt;Here's my attempt at changing the output value of an XML element using the &lt;EM&gt;call-method&lt;/EM&gt; tag by following&lt;A href="https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abenst_tt_call-method_static.htm"&gt; this example&lt;/A&gt;:&lt;/P&gt;
  &lt;P&gt;If I understood the documentation correctly, the tag &lt;EM&gt;&amp;lt;tt:root name="SPFLI_TAB"&amp;gt;&lt;/EM&gt; is bound to the static attribute &lt;EM&gt;SPFLI_TAB&lt;/EM&gt; of class &lt;EM&gt;CL_DEMO_CALL_FROM_ST&lt;/EM&gt; and calling its method &lt;EM&gt;GET_FLIGHTS&lt;/EM&gt; updates the value of said attribute which changes the root in the ST which is referenced in the tag &lt;EM&gt;&amp;lt;tt:loop ref=".SPFLI_TAB"&amp;gt;&lt;/EM&gt;.&lt;/P&gt;
  &lt;P&gt;The class &lt;EM&gt;ZTEST_SIMPLE_TRANSFORMATION&lt;/EM&gt; is a copy of the example's class with a new static attribute &lt;EM&gt;CURRCODE_CHANGED &lt;/EM&gt;and static method&lt;EM&gt; CONCAT_1&lt;/EM&gt; (concatenates '_1' to the given string). I want the value of element &lt;EM&gt;&amp;lt;CURRCODE_CHANGED&amp;gt;&lt;/EM&gt; to be modified by the method.&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;&amp;lt;?sap.transform simple?&amp;gt;
&amp;lt;tt:transform xmlns:tt="http://www.sap.com/transformation-templates"&amp;gt;
  &amp;lt;tt:root name="SCARR_TAB"/&amp;gt;
  &amp;lt;tt:root name="SPFLI_TAB"/&amp;gt;
  &amp;lt;tt:variable name="carrid"/&amp;gt;

  &amp;lt;!-- NEW --&amp;gt;
  &amp;lt;tt:root name="CURRCODE_CHANGED"/&amp;gt;
  &amp;lt;tt:variable name="currcode_og"/&amp;gt;
  &amp;lt;!-- NEW --&amp;gt;

  &amp;lt;tt:template&amp;gt;
    &amp;lt;FlightList&amp;gt;
      &amp;lt;tt:loop ref=".SCARR_TAB"&amp;gt;
        &amp;lt;Flights&amp;gt;

          &amp;lt;!-- NEW --&amp;gt;
          &amp;lt;tt:call-method class="ZTEST_SIMPLE_TRANSFORMATION" s-name="CONCAT_1"&amp;gt;
            &amp;lt;tt:with-parameter name="IV_STRING" var="currcode_og"/&amp;gt;
          &amp;lt;/tt:call-method&amp;gt;
          &amp;lt;CURRCODE_CHANGED&amp;gt;
            &amp;lt;tt:value ref=".CURRCODE_CHANGED"/&amp;gt;
          &amp;lt;/CURRCODE_CHANGED&amp;gt;
          &amp;lt;!-- NEW --&amp;gt;

          &amp;lt;tt:assign ref="carrid" to-var="carrid"/&amp;gt;
          &amp;lt;tt:call-method class="CL_DEMO_CALL_FROM_ST" s-name="GET_FLIGHTS"&amp;gt;
            &amp;lt;tt:with-parameter name="CARRID" var="carrid"/&amp;gt;
          &amp;lt;/tt:call-method&amp;gt;
          &amp;lt;tt:loop ref=".SPFLI_TAB"&amp;gt;
            &amp;lt;Connection&amp;gt;
              &amp;lt;tt:attribute name="ID" value-ref="CONNID"/&amp;gt;
              &amp;lt;From&amp;gt;
                &amp;lt;tt:value ref="CITYFROM"/&amp;gt;
              &amp;lt;/From&amp;gt;
              &amp;lt;To&amp;gt;
                &amp;lt;tt:value ref="CITYTO"/&amp;gt;
              &amp;lt;/To&amp;gt;
            &amp;lt;/Connection&amp;gt;
          &amp;lt;/tt:loop&amp;gt;
        &amp;lt;/Flights&amp;gt;
      &amp;lt;/tt:loop&amp;gt;
    &amp;lt;/FlightList&amp;gt;
  &amp;lt;/tt:template&amp;gt;

&amp;lt;/tt:transform&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2025660-image.png" /&gt;&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2025661-image.png" /&gt;&lt;/P&gt;
  &lt;P&gt;But when I execute the MAIN method, I get reference error:&lt;/P&gt;
  &lt;P&gt;&lt;EM&gt;The exception CX_ST_REF_ACCESS was raised within the method call of the include ZTEST_ST_WITH_METHOD_CALL in ZTEST_ST_WITH_METHOD_CALL in line 18.&lt;/EM&gt;&lt;/P&gt;
  &lt;P&gt;Am I missing something?&lt;/P&gt;
  &lt;P&gt;Thank you and kind regards,&lt;/P&gt;
  &lt;P&gt;Emiliano&lt;/P&gt;</description>
    <pubDate>Wed, 02 Mar 2022 15:41:47 GMT</pubDate>
    <dc:creator>former_member121087</dc:creator>
    <dc:date>2022-03-02T15:41:47Z</dc:date>
    <item>
      <title>Simple transformation call-method variable bindings</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-transformation-call-method-variable-bindings/m-p/12477629#M2001536</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
  &lt;P&gt;In a simple transformation program (internal table data to XML string) is it possible to control the value of an XML's element with the &lt;EM&gt;call-method &lt;/EM&gt;tag? &lt;A href="https://answers.sap.com/comments/13594901/view.html"&gt;What I'm trying to do, further explained.&lt;/A&gt;&lt;/P&gt;
  &lt;P&gt;Here's my attempt at changing the output value of an XML element using the &lt;EM&gt;call-method&lt;/EM&gt; tag by following&lt;A href="https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abenst_tt_call-method_static.htm"&gt; this example&lt;/A&gt;:&lt;/P&gt;
  &lt;P&gt;If I understood the documentation correctly, the tag &lt;EM&gt;&amp;lt;tt:root name="SPFLI_TAB"&amp;gt;&lt;/EM&gt; is bound to the static attribute &lt;EM&gt;SPFLI_TAB&lt;/EM&gt; of class &lt;EM&gt;CL_DEMO_CALL_FROM_ST&lt;/EM&gt; and calling its method &lt;EM&gt;GET_FLIGHTS&lt;/EM&gt; updates the value of said attribute which changes the root in the ST which is referenced in the tag &lt;EM&gt;&amp;lt;tt:loop ref=".SPFLI_TAB"&amp;gt;&lt;/EM&gt;.&lt;/P&gt;
  &lt;P&gt;The class &lt;EM&gt;ZTEST_SIMPLE_TRANSFORMATION&lt;/EM&gt; is a copy of the example's class with a new static attribute &lt;EM&gt;CURRCODE_CHANGED &lt;/EM&gt;and static method&lt;EM&gt; CONCAT_1&lt;/EM&gt; (concatenates '_1' to the given string). I want the value of element &lt;EM&gt;&amp;lt;CURRCODE_CHANGED&amp;gt;&lt;/EM&gt; to be modified by the method.&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;&amp;lt;?sap.transform simple?&amp;gt;
&amp;lt;tt:transform xmlns:tt="http://www.sap.com/transformation-templates"&amp;gt;
  &amp;lt;tt:root name="SCARR_TAB"/&amp;gt;
  &amp;lt;tt:root name="SPFLI_TAB"/&amp;gt;
  &amp;lt;tt:variable name="carrid"/&amp;gt;

  &amp;lt;!-- NEW --&amp;gt;
  &amp;lt;tt:root name="CURRCODE_CHANGED"/&amp;gt;
  &amp;lt;tt:variable name="currcode_og"/&amp;gt;
  &amp;lt;!-- NEW --&amp;gt;

  &amp;lt;tt:template&amp;gt;
    &amp;lt;FlightList&amp;gt;
      &amp;lt;tt:loop ref=".SCARR_TAB"&amp;gt;
        &amp;lt;Flights&amp;gt;

          &amp;lt;!-- NEW --&amp;gt;
          &amp;lt;tt:call-method class="ZTEST_SIMPLE_TRANSFORMATION" s-name="CONCAT_1"&amp;gt;
            &amp;lt;tt:with-parameter name="IV_STRING" var="currcode_og"/&amp;gt;
          &amp;lt;/tt:call-method&amp;gt;
          &amp;lt;CURRCODE_CHANGED&amp;gt;
            &amp;lt;tt:value ref=".CURRCODE_CHANGED"/&amp;gt;
          &amp;lt;/CURRCODE_CHANGED&amp;gt;
          &amp;lt;!-- NEW --&amp;gt;

          &amp;lt;tt:assign ref="carrid" to-var="carrid"/&amp;gt;
          &amp;lt;tt:call-method class="CL_DEMO_CALL_FROM_ST" s-name="GET_FLIGHTS"&amp;gt;
            &amp;lt;tt:with-parameter name="CARRID" var="carrid"/&amp;gt;
          &amp;lt;/tt:call-method&amp;gt;
          &amp;lt;tt:loop ref=".SPFLI_TAB"&amp;gt;
            &amp;lt;Connection&amp;gt;
              &amp;lt;tt:attribute name="ID" value-ref="CONNID"/&amp;gt;
              &amp;lt;From&amp;gt;
                &amp;lt;tt:value ref="CITYFROM"/&amp;gt;
              &amp;lt;/From&amp;gt;
              &amp;lt;To&amp;gt;
                &amp;lt;tt:value ref="CITYTO"/&amp;gt;
              &amp;lt;/To&amp;gt;
            &amp;lt;/Connection&amp;gt;
          &amp;lt;/tt:loop&amp;gt;
        &amp;lt;/Flights&amp;gt;
      &amp;lt;/tt:loop&amp;gt;
    &amp;lt;/FlightList&amp;gt;
  &amp;lt;/tt:template&amp;gt;

&amp;lt;/tt:transform&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2025660-image.png" /&gt;&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2025661-image.png" /&gt;&lt;/P&gt;
  &lt;P&gt;But when I execute the MAIN method, I get reference error:&lt;/P&gt;
  &lt;P&gt;&lt;EM&gt;The exception CX_ST_REF_ACCESS was raised within the method call of the include ZTEST_ST_WITH_METHOD_CALL in ZTEST_ST_WITH_METHOD_CALL in line 18.&lt;/EM&gt;&lt;/P&gt;
  &lt;P&gt;Am I missing something?&lt;/P&gt;
  &lt;P&gt;Thank you and kind regards,&lt;/P&gt;
  &lt;P&gt;Emiliano&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2022 15:41:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-transformation-call-method-variable-bindings/m-p/12477629#M2001536</guid>
      <dc:creator>former_member121087</dc:creator>
      <dc:date>2022-03-02T15:41:47Z</dc:date>
    </item>
    <item>
      <title>Re: Simple transformation call-method variable bindings</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-transformation-call-method-variable-bindings/m-p/12477630#M2001537</link>
      <description>&lt;P&gt;I don't really get what you're trying to do (please clarify), but as a starting point you can change it this way, so that the variable "currcode_og" contains "test_1" after calling the method:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&amp;lt;tt:call-method class="ZTEST_SIMPLE_TRANSFORMATION" s-name="CONCAT_1"&amp;gt;
    &amp;lt;tt:with-parameter name="IV_STRING" val="'test'"/&amp;gt;
    &amp;lt;tt:with-parameter name="CURRCODE_CHANGED" var="currcode_og"/&amp;gt;
&amp;lt;/tt:call-method&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 02 Mar 2022 20:13:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-transformation-call-method-variable-bindings/m-p/12477630#M2001537</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2022-03-02T20:13:41Z</dc:date>
    </item>
    <item>
      <title>Re: Simple transformation call-method variable bindings</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-transformation-call-method-variable-bindings/m-p/12477631#M2001538</link>
      <description>&lt;P&gt;Hi Sandra,&lt;/P&gt;&lt;P&gt;The internal table SCARR_TAB has the field CURRCODE. Within the loop &amp;lt;tt:loop ref=".SCARR_TAB"&amp;gt;, if I remove the call-method and reference CURRCODE (like this &amp;lt;tt:value ref="CURRCODE"/&amp;gt;, for example) it shows its value for each entry of SCARR_TAB as expected. What I want to do is modify CURRCODE for each entry of SCARR_TAB during the transformation so that the resulting value of CURRCODE in the XML contains the concatenated '_1'.&lt;/P&gt;&lt;P&gt;I'm trying to see whether it's possible to manipulate the abap data during the transformation so that I could, for example, format a date in whatever way I wanted. I hope I can do this by calling a method and changing the string there.&lt;/P&gt;&lt;P&gt;As you've suggested, I've tried adding the attribute val="test" to the parameter tag but it wont compile; I get the error "illegal value".&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2028683-image.png" /&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Emiliano&lt;/P&gt;</description>
      <pubDate>Thu, 03 Mar 2022 11:54:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-transformation-call-method-variable-bindings/m-p/12477631#M2001538</guid>
      <dc:creator>former_member121087</dc:creator>
      <dc:date>2022-03-03T11:54:51Z</dc:date>
    </item>
    <item>
      <title>Re: Simple transformation call-method variable bindings</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-transformation-call-method-variable-bindings/m-p/12477632#M2001539</link>
      <description>&lt;P&gt;sorry:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;&amp;lt;tt:call-method class="ZTEST_SIMPLE_TRANSFORMATION" s-name="CONCAT_1"&amp;gt;
    &amp;lt;tt:with-parameter name="IV_STRING" val="'test'"/&amp;gt;
    &amp;lt;tt:with-parameter name="CURRCODE_CHANGED" var="currcode_og"/&amp;gt;
&amp;lt;/tt:call-method&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 03 Mar 2022 15:17:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-transformation-call-method-variable-bindings/m-p/12477632#M2001539</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2022-03-03T15:17:43Z</dc:date>
    </item>
  </channel>
</rss>

