<?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 Re: Simple Transformation / initial_components not working as expected in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-transformation-initial-components-not-working-as-expected/m-p/6660811#M1446260</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jack,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much for this, it is working, all the initial fields are not displayed. Now is it possible do this for tags with no reference? for instance&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&amp;lt;RCPNT_CORP_NM&amp;gt;

                &amp;lt;tt:cond s-check="not-initial(ref('L1_NM'))"&amp;gt;
                  &amp;lt;l1_nm&amp;gt;
                    &amp;lt;tt:value ref="$line.L1_CORP_NM"/&amp;gt;
                  &amp;lt;/l1_nm&amp;gt;
                &amp;lt;/tt:cond&amp;gt;

&amp;lt;RCPNT_CORP_NM&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My tag L1_NM is not displayed if initial, but the parent &amp;lt;RCPNT_CORP_NM&amp;gt; is displayed even when it doesnt have elements. I tried &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;tt:cond s-check="not-initial('RCPNT_CORP_NM')"&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but didn't work&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: carlosrv on Sep 27, 2011 6:31 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 27 Sep 2011 16:31:09 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2011-09-27T16:31:09Z</dc:date>
    <item>
      <title>Simple Transformation / initial_components not working as expected</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-transformation-initial-components-not-working-as-expected/m-p/6660808#M1446257</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have created a simple transformation to transform from DDIC structures to XML. The structures mimic the XML hierarchy so the conversion is almost 1 to 1.&lt;/P&gt;&lt;P&gt;The problem I'm having is that although some fields have no value, an element is created for them, even when using the &lt;EM&gt;initial_components = 'SUPPRESS'&lt;/EM&gt; option.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is a simplified version of the real code that has the same behaviour: In this case, DDIC structure YSTESTS has 2 fields: CHARS type CHAR10, and STR type STRING.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ABAP:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT  y_tests2.

DATA:
      gv_initcomp TYPE string,
      xstr    TYPE xstring,
      struct TYPE ystests.


PARAMETERS:
  p_blanks    TYPE c AS CHECKBOX DEFAULT 'X'.

START-OF-SELECTION.

  IF p_blanks = 'X'.
    gv_initcomp = 'INCLUDE'.
  ELSE.
    gv_initcomp = 'SUPPRESS'.
  ENDIF.

* ABAP &amp;gt; XML

  TRY.
      CALL TRANSFORMATION y_tests
        SOURCE data = struct
        RESULT XML xstr
        OPTIONS initial_components = gv_initcomp.
    CATCH cx_transformation_error.
      MESSAGE 'Error en transformación' TYPE 'A'.
  ENDTRY.

  CALL FUNCTION 'SCOL_TRACE_SHOW_XML'
    EXPORTING
      xdoc = xstr.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ST:&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" xmlns:ddic="http://www.sap.com/abapxml/types/dictionary" xmlns:def="http://www.sap.com/abapxml/types/defined"&amp;gt;

  &amp;lt;tt:root name="DATA" type="ddic:YSTESTS"&amp;gt;&amp;lt;/tt:root&amp;gt;

  &amp;lt;tt:template&amp;gt;
    &amp;lt;data tt:ref="DATA"&amp;gt;
        &amp;lt;chars tt:value-ref="CHARS"&amp;gt;&amp;lt;/chars&amp;gt;
        &amp;lt;str tt:value-ref="STR"&amp;gt;&amp;lt;/str&amp;gt;
    &amp;lt;/data&amp;gt;
  &amp;lt;/tt:template&amp;gt;

&amp;lt;/tt:transform&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The XML output is like this, even when deselecting the P_BLANKS checkbox:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
&amp;lt;?xml version="1.0" encoding="utf-8" ?&amp;gt; 
&amp;lt;data&amp;gt;
  &amp;lt;chars&amp;gt;&amp;lt;/chars&amp;gt; 
  &amp;lt;str&amp;gt;&amp;lt;/str&amp;gt; 
&amp;lt;/data&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only solution I've found so far is to post-process the resulting XML using the iXML interfaces (DOM processing) to iterate over all the nodes and remove the empty elements, but I sure hope there is a simpler and cleaner way to achieve this.&lt;/P&gt;&lt;P&gt;Am I right?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Feb 2010 21:03:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-transformation-initial-components-not-working-as-expected/m-p/6660808#M1446257</guid>
      <dc:creator>alejandro_bindi</dc:creator>
      <dc:date>2010-02-24T21:03:22Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Transformation / initial_components not working as expected</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-transformation-initial-components-not-working-as-expected/m-p/6660809#M1446258</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alejandro,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How did you solve this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have the same problem and I have no idea what is wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help will be highly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Sep 2011 22:22:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-transformation-initial-components-not-working-as-expected/m-p/6660809#M1446258</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-09-26T22:22:36Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Transformation / initial_components not working as expected</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-transformation-initial-components-not-working-as-expected/m-p/6660810#M1446259</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alejandro, try this ST:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&amp;lt;tt:cond s-check="not-initial(ref('CHARS'))"&amp;gt;
  &amp;lt;chars tt:value-ref="CHARS"/&amp;gt;
&amp;lt;/tt:cond&amp;gt;
&amp;lt;tt:cond s-check="not-initial(ref('STR'))"&amp;gt;
  &amp;lt;str tt:value-ref="STR"/&amp;gt;
&amp;lt;/tt:cond&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards Jack&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Sep 2011 04:58:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-transformation-initial-components-not-working-as-expected/m-p/6660810#M1446259</guid>
      <dc:creator>JackGraus</dc:creator>
      <dc:date>2011-09-27T04:58:23Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Transformation / initial_components not working as expected</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-transformation-initial-components-not-working-as-expected/m-p/6660811#M1446260</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jack,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much for this, it is working, all the initial fields are not displayed. Now is it possible do this for tags with no reference? for instance&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&amp;lt;RCPNT_CORP_NM&amp;gt;

                &amp;lt;tt:cond s-check="not-initial(ref('L1_NM'))"&amp;gt;
                  &amp;lt;l1_nm&amp;gt;
                    &amp;lt;tt:value ref="$line.L1_CORP_NM"/&amp;gt;
                  &amp;lt;/l1_nm&amp;gt;
                &amp;lt;/tt:cond&amp;gt;

&amp;lt;RCPNT_CORP_NM&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My tag L1_NM is not displayed if initial, but the parent &amp;lt;RCPNT_CORP_NM&amp;gt; is displayed even when it doesnt have elements. I tried &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;tt:cond s-check="not-initial('RCPNT_CORP_NM')"&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but didn't work&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: carlosrv on Sep 27, 2011 6:31 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Sep 2011 16:31:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-transformation-initial-components-not-working-as-expected/m-p/6660811#M1446260</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-09-27T16:31:09Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Transformation / initial_components not working as expected</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-transformation-initial-components-not-working-as-expected/m-p/6660812#M1446261</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, try this&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&amp;lt;tt:cond s-check="not-initial(ref('L1_NM')) or ..."&amp;gt;
  &amp;lt;RCPNT_CORP_NM&amp;gt; 
    &amp;lt;tt:cond s-check="not-initial(ref('L1_NM'))"&amp;gt;
      &amp;lt;l1_nm&amp;gt;
        &amp;lt;tt:value ref="$line.L1_CORP_NM"/&amp;gt;
      &amp;lt;/l1_nm&amp;gt;
      ...
    &amp;lt;/tt:cond&amp;gt;
  &amp;lt;RCPNT_CORP_NM&amp;gt;
&amp;lt;/tt:cond&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards Jack&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Sep 2011 01:32:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-transformation-initial-components-not-working-as-expected/m-p/6660812#M1446261</guid>
      <dc:creator>JackGraus</dc:creator>
      <dc:date>2011-09-28T01:32:45Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Transformation / initial_components not working as expected</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-transformation-initial-components-not-working-as-expected/m-p/6660813#M1446262</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, haven't received response notifications, and I did this long ago.&lt;/P&gt;&lt;P&gt;What I did was something similar, I used:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
&amp;lt;tt:cond check="not-initial(CHARS)"&amp;gt;
   &amp;lt;chars tt:value-ref="CHARS"/&amp;gt;
&amp;lt;/tt:cond&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Nov 2011 23:38:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-transformation-initial-components-not-working-as-expected/m-p/6660813#M1446262</guid>
      <dc:creator>alejandro_bindi</dc:creator>
      <dc:date>2011-11-09T23:38:58Z</dc:date>
    </item>
  </channel>
</rss>

