Simple Transformation - ignore processing a block

Hi!
Here is a portion of an XML document that I want to parse into an ABAP structure:
    <field1 attrib1="xyz" attrib2="pqr"/>
    <field2 attribA="xyz" attribB="pqr"/>
    <content type="application/xml">
      <field label="Customer Number" name="customer_id_disp">0000000011</field>
      <field label="Customer Title Code" name="title_code"></field>
      <field label="Person's Title" name="title"></field>
      <field label="First Name" name="first_line_name">Heavy Tool Plt</field>
      <field label="Second/Last Name" name="second_line_name"></field>
      <field label="Third Name/Mid Name" name="third_line_name"></field>
      <field label="Fourth Name/ Given Name" name="fourth_line_name"></field>
      <field label="Revenue Amount" name="revenue_amount">0.0</field>
    </content>
Now my structure looks something like this:
xmlstructure (structure)
      |_ field1 (structure)
      |       |_ attrib1 (string)
      |       |_ attrib2 (string)
      |
      |_ field2 (structure)
      |       |_ attribA (string)
      |       |_ attribB (string)
      |
      |_ content (structure)
              |_ type (string)
              |_ text (string)
Basically, I want to process the 'content' later on (not in the first pass), and simply store it into the structure field xmlstructure-content-text for now. I assume the simple transformation code for doing this would be:
          <content>
            <tt:attribute name="type" value-ref="CONTENT.TYPE"/>
            <tt:value ref="CONTENT.TEXT"/>
          </content>
But the moment the ST encounters the line <tt:value ref="CONTENT.TEXT"/>, it throws a runtime error. (because it is expecting handling for the <field> element.
How do I get around this problem?

You need to add conditional check for the node attribute.
Exp:
<tt:d-cond check="exist(ABCD)">
<ABCD tt:value-ref="ABCD"/>
</tt:d-cond>

Similar Messages

  • Simple Transformations: How deserialize xmlns attributes?

    Hello all,
    during deserializing Simple Transformations ignore surplus attributes in the xml input stream. With one exception: u201Exmlnsu201C (namespace) attributes apparently are not ignored.
    Take for example the xml file:
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <CITIES someattribute="XYZ">
      <CITY>Hamburg</CITY>
      <CITY>Berlin</CITY>
    </CITIES>
    This file can be processed successfully by the simple transformation:
    <?sap.transform simple?>
    <tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
      <tt:root name="CITIES"></tt:root>
      <tt:template>
        <CITIES>
          <tt:loop ref="CITIES">
            <CITY tt:value-ref="CITY"></CITY>
          </tt:loop>
        </CITIES>
      </tt:template>
    </tt:transform>
    When trying to process the following xml file by the same transformation, however, a CX_ST_MATCH_ELEMENT error is thrown.
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <CITIES xmlns="XYZ">
      <CITY>Hamburg</CITY>
      <CITY>Berlin</CITY>
    </CITIES>
    How can xmlns attributes be deserialized (ignored) with simple transformations?
    Thanks for any hint!
    Simon
    PS:
    To reproduce the error the following ABAP can be used in combination with the quoted simple transformation:
    REPORT  ztestsd13.
    TYPES: BEGIN OF lty_cities,
            city(20) TYPE c,
           END OF lty_cities.
    DATA: ls_cities TYPE lty_cities,
          lt_cities TYPE TABLE OF lty_cities,
          lv_xml TYPE string,
          lv_cities_element TYPE string,
          lv_error TYPE string,
          lo_error TYPE REF TO cx_transformation_error.
    PARAMETERS: lp_incns TYPE boolean DEFAULT ''.
    CASE lp_incns.
      WHEN 'X'.
        lv_cities_element = '<CITIES xmlns="XYZ">'.
      WHEN OTHERS.
        lv_cities_element = '<CITIES someattribute="XYZ">'.
    ENDCASE.
    CONCATENATE:
    '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'
    lv_cities_element
    '<CITY>Hamburg</CITY>'
    '<CITY>Berlin</CITY>'
    '</CITIES>' INTO lv_xml.
    TRY.
        CALL TRANSFORMATION ('Z_CITIES')
          SOURCE XML lv_xml
          RESULT cities = lt_cities.
      CATCH cx_transformation_error INTO lo_error.
        lv_error = lo_error->get_text( ).
        WRITE: 'Transformation not successful'.
        SKIP.
        WRITE: lv_error.
        EXIT.
    ENDTRY.
    WRITE: 'Transformation successful'.
    SKIP.
    LOOP AT lt_cities INTO ls_cities.
      WRITE: / ls_cities-city.
    ENDLOOP.
    Edited by: Simon Dähnhardt on Oct 20, 2009 6:04 PM

    first of all your xml isn't well formatted
    root element must be only one like
    <?xml version="1.0" encoding="UTF-8"?>
    <root>
    <result xmlns="http://xmlns.oracle.com/oracleas/schema/dbserver_audittrail-11_2.xsd">
    <DB_User>DBSNMP</DB_User>
    <Userhost>localhost.localdomain</Userhost>
    </result>
    <result xmlns="http://xmlns.oracle.com/oracleas/schema/dbserver_audittrail-11_2.xsd">
    <DB_User>DBSNMP</DB_User>
    <Userhost>localhost.localdomain</Userhost>
    </result>
    </root>or may be in your case
    <?xml version="1.0" encoding="UTF-8"?>
    <result xmlns="http://xmlns.oracle.com/oracleas/schema/dbserver_audittrail-11_2.xsd">
    <DB_User>DBSNMP</DB_User>
    <Userhost>localhost.localdomain</Userhost>
    </result>for remove you can use xslt as example for xmltransform
    SQL> select * from v$version where rownum=1;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    SQL>
    SQL> with t as
      2  (select xmltype(
      3  '<?xml version="1.0" encoding="UTF-8"?>
      4  <result xmlns="http://xmlns.oracle.com/oracleas/schema/dbserver_audittrail-11_2.xsd">
      5  <DB_User xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">DBSNMP</DB_User>
      6  <Userhost xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">localhost.localdomain</Userhost>
      7  </result>') xml from dual)
      8  --
      9  select xmltransform(t.xml, xmltype('<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    10  <xsl:output method="xml" indent="no"/>
    11  <xsl:template match="*">
    12      <xsl:element name="{local-name()}">
    13        <xsl:apply-templates select="node()"/>
    14      </xsl:element>
    15  </xsl:template>
    16  </xsl:stylesheet>'))
    17  from t
    18  /
    XMLTRANSFORM(T.XML,XMLTYPE('<X
    <?xml version="1.0" encoding="utf-8"?>
    <result><DB_User>DBSNMP</DB_User><Userhost>localhost.localdomain</Userhost></res
    SQL> --add
    or try add local-name() to your main xquery
    Edited by: AlexAnd on Dec 12, 2012 12:05 AM

  • Dynamic TAG - Simple Transformation

    Hi All,
    I need work with dynamic TAGS (Elements) on Simple Transformation?
    The tag should be <Invoice> or <DebitNote> depending on a Variable.
    How can I achieve this?
    Thanks and Regards,

    We work with Microsoft Outlook, but I'm sure this could work with any email system.
    This error only came from external emails - what we did in the end is to get the third party to email a particular email (email1) in our company.  This is set up as a regular email account.  On this email put a forward rule to email2 for a particular sender/subject.  email2 is set up as POP3 so that XD1 can poll it - we also block any emails except from email1.
    Doing this accomplishes a couple of things:
    1)  We get around the error because XI polls email2 (which has adapter settings of IMAP4 so we can see MAIL adapter attributes ie. sender, subject etc...When we originally had as POP3 we were not able to see these - but setting as IMAP4 causes the error for external emailers)
    2) We have a SPAM filter - the XI email is clean from SPAM and the adapter will not have errors, as it only receives valid emails to process
    3) We have a central email (email1) which is used to archive all XI emails - we use this for all email scenarios (as we also save to folder and forward in the rule)
    Hope this helps your situation.

  • Simple Transformation - XML to Internal Table Error

    I have a webservice call that returns XML.  I need to transform a portion of the response to an internal table, but my simple transformation is not working with loop processing.  I have read through most posts regarding the topic but they're either too old or related to serialization.  There aren't any exceptions thrown, but I don't get any data in the internal table (PAPERWORK root).  Below are some code snippets.  Any ideas on the problem with the XSLT template?  Thanks.
    Sample XML:
    <?xml version="1.0" encoding="utf-8" ?>
    <PrintVersionDataSet>
    <Result>
    <ReturnCode>W</ReturnCode>
    <ReturnMessage>There are reports with later version(s)</ReturnMessage>
    </Result>
    <Paperwork>
    <ReportCode>CVR</ReportCode>
    <ReportName>Cover Sheet</ReportName>
    <Version>2</Version>
    <PrintedDateTime>2009-05-01T09:54:04.1-05:00</PrintedDateTime>
    </Paperwork>
    <Paperwork>
    <ReportCode>SPS</ReportCode>
    <ReportName>Sponsor Summary</ReportName>
    <Version>2</Version>
    <PrintedDateTime>2009-05-01T09:54:04.99-05:00</PrintedDateTime>
    </Paperwork>
    </PrintVersionDataSet>
    XSLT Code:
    <?sap.transform simple?>
    <tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
      <tt:root name="RESULT"/>
      <tt:root name="PAPERWORK"/>
      <tt:template>
        <PrintVersionDataSet>
          <Result tt:ref="RESULT">
            <ReturnCode>
              <tt:value ref="RETURNCODE"/>
            </ReturnCode>
            <ReturnMessage>
              <tt:value ref="RETURNMESSAGE"/>
            </ReturnMessage>
          </Result>
          <tt:deserialize>
            <tt:loop ref=".PAPERWORK">
              <Paperwork>
                <ReportCode>
                  <tt:value ref="REPORTCODE"/>
                </ReportCode>
                <ReportName>
                  <tt:value ref="REPORTNAME"/>
                </ReportName>
                <Version>
                  <tt:value ref="VERSION"/>
                </Version>
                <PrintedDateTime>
                  <tt:value ref="PRINTEDDATETIME"/>
                </PrintedDateTime>
              </Paperwork>
            </tt:loop>
          </tt:deserialize>
        </PrintVersionDataSet>
      </tt:template>
    </tt:transform>
    ABAP Call to Transform Data:
    TRY.
    CALL TRANSFORMATION Z_GA_PAPERWORK_VERS_WEBSVC
          SOURCE XML LS_RESPONSE-VERIFY_PRINT_VERSION_RESULT
          RESULT RESULT     = LS_RESULT
                 PAPERWORK  = LT_PAPERWORK.
        CATCH CX_ROOT INTO ROOT_EXCEPTION.
          CALL METHOD ROOT_EXCEPTION->IF_MESSAGE~GET_TEXT
            RECEIVING
              RESULT = LV_MESSAGE.
      ENDTRY.

    Upon further inspection and testing with a simple file and program, I can see that the XML structure isn't quite correct for the loop process.  There needs to be a single <PAPERWORK> node, instead of one for each table line in the file.  This should allow the loop to execute properly after a slight adjustment to the XSLT template.

  • Simple Transformation with very long XML element names

    I am trying to write a program to deserialize XML documents using the Simple Transformation technique.  There are many optional elements in the XML document, so I need to have conditional statements statements to avoid trying to process elements that are not in the document.  The XML document, however, has several Element Names that are greater than 30 characters in length.  The Simple Transformation technique seems to require ABAP data dictionary structures that mirror the schema of the XML document.  But one cannot create structure component names that are greater than 30 characters in length.  We don't have any control over the XML schema as the XML documents come from the US government.  The ST fragment below shows the statement that I want to write, but since the ABAP Structure PlasticCardInformationGroup cannot have a component AuthorizationResponseInformation, the ST syntax checker yields an "Illegal Reference ADDITIONALPLASTICCARDINFORMATION" error message.
    Does anyone know a way to avoid this error?
    <tt:d-cond check="exist(TRS_TradingPartner_Agreement.TRS_FinancialTransaction.PlasticCardInformationGroup.AdditionalPlasticCardInformation)">
    <ns2:AdditionalPlasticCardInformation>
    <tt:attribute name="CardNetworkType" value-ref="TRS_TRADINGPARTNER_AGREEMENT.TRS_FINANCIALTRANSACTION.PLASTICCARDINFORMATIONGROUP.ADDITIONALPLASTICCARDINFORMATI.CARDNETWORKTYPE"/>
    <tt:attribute name="DraftLocatorNumber" value-ref="TRS_TRADINGPARTNER_AGREEMENT.TRS_FINANCIALTRANSACTION.PLASTICCARDINFORMATIONGROUP.ADDITIONALPLASTICCARDINFORMATI.DRAFTLOCATORNUMBER"/>
    </ns2:AdditionalPlasticCardInformation>

    could anyone help me?

  • XML to Nested Itab using Simple Transformation

    Hi there is there any experts there who can show me an example of Transforming a XML to a Nested Internal Table using Simple Transformation?
    I have tried this the program from the blog by
    Tobias Trapp
    <a href="/people/tobias.trapp/blog/2005/05/04/xml-processing-in-abap-part-1:///people/tobias.trapp/blog/2005/05/04/xml-processing-in-abap-part-1
    but I have encountered this error
    Runtime Errors         ST_REF_ACCESS   
    Exception              CX_ST_REF_ACCESS
       1 <?sap.transform simple?>                                    
       2 <tt:transform template="temp1"                              
       3     xmlns:tt="http://www.sap.com/transformation-templates"> 
       4     <tt:root name="ROOT"/>                                  
       5     <tt:template name="temp1">                              
    >>>>       <tt:loop ref=".ROOT" name="a">                        
       7         <A>                                                 
       8            <name>                                           
       9              <tt:value ref="$a.name" />                     
      10            </name>                                          
      11            <ZLS>                                            
      12              <tt:loop ref="$a.zls" name="z">                
      13                <Z>                                          
      14                  <tt:value ref="$z.nummer" />               
      15                </Z>                                         
      16             </tt:loop>                                      
      17           </ZLS>                                            
      18         </A>                                                
      19       </tt:loop>                                            
      20     </tt:template>                                          
      21 </tt:transform>                                             
    Anyone knows whats wrong?

    I had to pass an XSLT program in the transformation statement.

  • Simple transformation program debugging

    hi ,
       can any boby guide me how can we debug a simple transformation program which is used for xml to abap conversion .

    Hi,
    have a look on this.
    REPORT  YMS_XMLTOSAP.
    TYPE-POOLS: IXML.
    TYPES: BEGIN OF T_XML_LINE,
            DATA(256) TYPE X,
          END OF T_XML_LINE.
    DATA: L_IXML            TYPE REF TO IF_IXML,
          L_STREAMFACTORY   TYPE REF TO IF_IXML_STREAM_FACTORY,
          L_PARSER          TYPE REF TO IF_IXML_PARSER,
          L_ISTREAM         TYPE REF TO IF_IXML_ISTREAM,
          L_DOCUMENT        TYPE REF TO IF_IXML_DOCUMENT,
          L_NODE            TYPE REF TO IF_IXML_NODE,
          L_XMLDATA         TYPE STRING.
    DATA: L_ELEM            TYPE REF TO IF_IXML_ELEMENT,
          L_ROOT_NODE       TYPE REF TO IF_IXML_NODE,
          L_NEXT_NODE       TYPE REF TO IF_IXML_NODE,
          L_NAME            TYPE STRING,
          L_ITERATOR        TYPE REF TO IF_IXML_NODE_ITERATOR.
    DATA: L_XML_TABLE       TYPE TABLE OF T_XML_LINE,
          L_XML_LINE        TYPE T_XML_LINE,
          L_XML_TABLE_SIZE  TYPE I.
    DATA: L_FILENAME        TYPE STRING.
    PARAMETERS: PA_FILE TYPE CHAR1024 DEFAULT 'c:\temp\orders_dtd.xml'.
    * Validation of XML file: Only DTD included in xml document is supported
    PARAMETERS: PA_VAL  TYPE CHAR1 AS CHECKBOX.
    START-OF-SELECTION.
    *   Creating the main iXML factory
      L_IXML = CL_IXML=>CREATE( ).
    *   Creating a stream factory
      L_STREAMFACTORY = L_IXML->CREATE_STREAM_FACTORY( ).
      PERFORM GET_XML_TABLE CHANGING L_XML_TABLE_SIZE L_XML_TABLE.
    *   wrap the table containing the file into a stream
      L_ISTREAM = L_STREAMFACTORY->CREATE_ISTREAM_ITABLE( TABLE = L_XML_TABLE
                                                      SIZE  = L_XML_TABLE_SIZE ).
    *   Creating a document
      L_DOCUMENT = L_IXML->CREATE_DOCUMENT( ).
    *   Create a Parser
      L_PARSER = L_IXML->CREATE_PARSER( STREAM_FACTORY = L_STREAMFACTORY
                                        ISTREAM        = L_ISTREAM
                                        DOCUMENT       = L_DOCUMENT ).
    *   Validate a document
      IF PA_VAL EQ 'X'.
        L_PARSER->SET_VALIDATING( MODE = IF_IXML_PARSER=>CO_VALIDATE ).
      ENDIF.
    *   Parse the stream
      IF L_PARSER->PARSE( ) NE 0.
        IF L_PARSER->NUM_ERRORS( ) NE 0.
          DATA: PARSEERROR TYPE REF TO IF_IXML_PARSE_ERROR,
                STR        TYPE STRING,
                I          TYPE I,
                COUNT      TYPE I,
                INDEX      TYPE I.
          COUNT = L_PARSER->NUM_ERRORS( ).
          WRITE: COUNT, ' parse errors have occured:'.
          INDEX = 0.
          WHILE INDEX < COUNT.
            PARSEERROR = L_PARSER->GET_ERROR( INDEX = INDEX ).
            I = PARSEERROR->GET_LINE( ).
            WRITE: 'line: ', I.
            I = PARSEERROR->GET_COLUMN( ).
            WRITE: 'column: ', I.
            STR = PARSEERROR->GET_REASON( ).
            WRITE: STR.
            INDEX = INDEX + 1.
          ENDWHILE.
        ENDIF.
      ENDIF.
    *   Process the document
      IF L_PARSER->IS_DOM_GENERATING( ) EQ 'X'.
        PERFORM PROCESS_DOM USING L_DOCUMENT.
      ENDIF.
    *&      Form  get_xml_table
    FORM GET_XML_TABLE CHANGING L_XML_TABLE_SIZE TYPE I
                                L_XML_TABLE      TYPE STANDARD TABLE.
    *   Local variable declaration
      DATA: L_LEN      TYPE I,
            L_LEN2     TYPE I,
            L_TAB      TYPE TSFIXML,
            L_CONTENT  TYPE STRING,
            L_STR1     TYPE STRING,
            C_CONV     TYPE REF TO CL_ABAP_CONV_IN_CE,
            L_ITAB     TYPE TABLE OF STRING.
      L_FILENAME = PA_FILE.
    *   upload a file from the client's workstation
      CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD
        EXPORTING
          FILENAME   = L_FILENAME
          FILETYPE   = 'BIN'
        IMPORTING
          FILELENGTH = L_XML_TABLE_SIZE
        CHANGING
          DATA_TAB   = L_XML_TABLE
        EXCEPTIONS
          OTHERS     = 19.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    *   Writing the XML document to the screen
      CLEAR L_STR1.
      LOOP AT L_XML_TABLE INTO L_XML_LINE.
        C_CONV = CL_ABAP_CONV_IN_CE=>CREATE( INPUT = L_XML_LINE-DATA REPLACEMENT = SPACE  ).
        C_CONV->READ( IMPORTING DATA = L_CONTENT LEN = L_LEN ).
        CONCATENATE L_STR1 L_CONTENT INTO L_STR1.
      ENDLOOP.
      L_STR1 = L_STR1+0(L_XML_TABLE_SIZE).
      SPLIT L_STR1 AT CL_ABAP_CHAR_UTILITIES=>CR_LF INTO TABLE L_ITAB.
      WRITE: /.
      WRITE: /' XML File'.
      WRITE: /.
      LOOP AT L_ITAB INTO L_STR1.
        REPLACE ALL OCCURRENCES OF CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB IN
          L_STR1 WITH SPACE.
        WRITE: / L_STR1.
      ENDLOOP.
      WRITE: /.
    ENDFORM.                    "get_xml_table
    *&      Form  process_dom
    FORM PROCESS_DOM USING DOCUMENT TYPE REF TO IF_IXML_DOCUMENT.
      DATA: NODE      TYPE REF TO IF_IXML_NODE,
            ITERATOR  TYPE REF TO IF_IXML_NODE_ITERATOR,
            NODEMAP   TYPE REF TO IF_IXML_NAMED_NODE_MAP,
            ATTR      TYPE REF TO IF_IXML_NODE,
            NAME      TYPE STRING,
            PREFIX    TYPE STRING,
            VALUE     TYPE STRING,
            INDENT    TYPE I,
            COUNT     TYPE I,
            INDEX     TYPE I.
      NODE ?= DOCUMENT.
      CHECK NOT NODE IS INITIAL.
      ULINE.
      WRITE: /.
      WRITE: /' DOM-TREE'.
      WRITE: /.
      IF NODE IS INITIAL. EXIT. ENDIF.
    *   create a node iterator
      ITERATOR  = NODE->CREATE_ITERATOR( ).
    *   get current node
      NODE = ITERATOR->GET_NEXT( ).
    *   loop over all nodes
      WHILE NOT NODE IS INITIAL.
        INDENT = NODE->GET_HEIGHT( ) * 2.
        INDENT = INDENT + 20.
        CASE NODE->GET_TYPE( ).
          WHEN IF_IXML_NODE=>CO_NODE_ELEMENT.
    *         element node
            NAME    = NODE->GET_NAME( ).
            NODEMAP = NODE->GET_ATTRIBUTES( ).
            WRITE: / 'ELEMENT  :'.
            WRITE: AT INDENT NAME COLOR COL_POSITIVE INVERSE.
            IF NOT NODEMAP IS INITIAL.
    *           attributes
              COUNT = NODEMAP->GET_LENGTH( ).
              DO COUNT TIMES.
                INDEX  = SY-INDEX - 1.
                ATTR   = NODEMAP->GET_ITEM( INDEX ).
                NAME   = ATTR->GET_NAME( ).
                PREFIX = ATTR->GET_NAMESPACE_PREFIX( ).
                VALUE  = ATTR->GET_VALUE( ).
                WRITE: / 'ATTRIBUTE:'.
                WRITE: AT INDENT NAME  COLOR COL_HEADING INVERSE, '=',
                                 VALUE COLOR COL_TOTAL   INVERSE.
              ENDDO.
            ENDIF.
          WHEN IF_IXML_NODE=>CO_NODE_TEXT OR
               IF_IXML_NODE=>CO_NODE_CDATA_SECTION.
    *         text node
            VALUE  = NODE->GET_VALUE( ).
            WRITE: / 'VALUE     :'.
            WRITE: AT INDENT VALUE COLOR COL_GROUP INVERSE.
        ENDCASE.
    *     advance to next node
        NODE = ITERATOR->GET_NEXT( ).
      ENDWHILE.
    ENDFORM.                    "process_dom
    Thanks,
    Sankar M

  • Simple transformation: dump ST_MATCH_FAIL

    Hello,
    I have written a simple transformation which works fine.
    However, I get the dump ST_MATCH_FAIL whenever the tags in the XML are not in the order specified in the ST or if the XML contains tags other than the tags specified in the ST.
    Is there a way to prevent this dump? The ST should just ignore order of fields and fields which are not stated in the ST.
    This is the ST
    <?sap.transform simple?>
    <tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
      <tt:root name="DocRoot"/>
      <tt:template>
        <DocRoot>
          <tt:loop name="wa_iram" ref=".DocRoot">
            <entry>
              <personnel_num>
                <tt:value ref="$wa_iram.pernr"/>
              </personnel_num>
              <email>
                <tt:value ref="$wa_iram.email"/>
              </email>
              <ldap_id>
                <tt:value ref="$wa_iram.ldap_id"/>
              </ldap_id>
            </entry>
          </tt:loop>
        </DocRoot>
      </tt:template>
    </tt:transform>
    Thanks
    Koen

    That particular example has no conditional operators specified in the template.  You have to identify the conditional frequency of the elements in order to stop dumps like that...

  • Questions concerning ST Simple Transformations

    I got some questions concerning Simple Transformations:
    1.) When editing a simple transformation, how to insert comments? In pure ABAP, a comment line must have as asterisk in the first column...
    2.) I use <tt:loop>...</tt:loop> and want to use the index of the currently processed entry, like SY-TABIX when implementing a "LOOP AT itab" in ABAP. Is there a way?
    Thanks for your answer, points will be rewared...
    -MIKE

    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 !

  • Simple Transformation - Optional Tag

    Hi,
    I receive an XML from an called web service. Depending on the ws input I receive a diferent result XML.
    Result 1:
    <LdPat3D>
      <Blocks>
          <Block>
           <Block>
      <Blocks/>
    </LdPat3D>
    Result 2:
    <LdPat3D/>
    The simple transformation works for Result 1, but not for Result 2. In case of Result 2 a CX_ST_MATCH_ELEMENT exception
    occurs mentioning that element-start blocks is expected and element-end: "LdPat3D" [ ] is read.
    Could you please tell me how to handle this in my simple transformation?
    Thank you and best regards, Edgar

    Hi Edgar,
    you should define <blocks> element as optional using <tt:cond>
    More information : http://help.sap.com/saphelp_nw70/helpdata/en/0c/402040abf2c442e10000000a1550b0/frameset.htm
    BR
    Sandra

  • Simple Transformation to deserialize an XML file into ABAP data structures?

    I'm attempting to write my first simple transformation to deserialize
    an XML file into ABAP data structures and I have a few questions.
    My simple transformation contains code like the following
    <tt:transform xmlns:tt="http://www.sap.com/transformation-templates"
                  xmlns:pp="http://www.sap.com/abapxml/types/defined" >
    <tt:type name="REPORT" line-type="?">
      <tt:node name="COMPANY_ID" type="C" length="10" />
      <tt:node name="JOB_ID" type="C" length="20" />
      <tt:node name="TYPE_CSV" type="C" length="1" />
      <tt:node name="TYPE_XLS" type="C" length="1" />
      <tt:node name="TYPE_PDF" type="C" length="1" />
      <tt:node name="IS_NEW" type="C" length="1" />
    </tt:type>
    <tt:root name="ROOT2" type="pp:REPORT" />
        <QueryResponse>
        <tt:loop ref="ROOT2" name="line">
          <QueryResponseRow>
            <CompanyID>
              <tt:value ref="$line.COMPANY_ID" />
            </CompanyID>
            <JobID>
              <tt:value ref="$line.JOB_ID" />
            </JobID>
            <ExportTypes>
              <tt:loop>
                <ExportType>
                   I don't know what to do here (see item 3, below)
                </ExportType>
              </tt:loop>
            </ExportTypes>
            <IsNew>
              <tt:value ref="$line.IS_NEW"
              map="val(' ') = xml('false'), val('X') = xml('true')" />
            </IsNew>
          </QueryResponseRow>
          </tt:loop>
        </QueryResponse>
        </tt:loop>
    1. In a DTD, an element can be designated as occurring zero or one
    time, zero or more times, or one or more times. How do I write the
    simple transformation to accommodate these possibilities?
    2. In trying to accommodate the "zero or more times" case, I am trying
    to use the <tt:loop> instruction. It occurs several layers deep in the
    XML hierarchy, but at the top level of the ABAP table. The internal
    table has a structure defined in the ABAP program, not in the data
    dictionary. In the simple transformation, I used <tt:type> and
    <tt:node> to define the structure of the internal table and then
    tried to use <tt:loop ref="ROOT2" name="line"> around the subtree that
    can occur zero or more times. But every variation I try seems to get
    different errors. Can anyone supply a working example of this?
    3. Among the fields in the internal table, I've defined three
    one-character fields named TYPE_CSV, TYPE_XLS, and TYPE_PDF. In the
    XML file, I expect zero to three elements of the form
    <ExportType exporttype='csv' />
    <ExportType exporttype='xls' />
    <ExportType exporttype='pdf' />
    I want to set field TYPE_CSV = 'X' if I find an ExportType element
    with its exporttype attribute set to 'csv'. I want to set field
    TYPE_XLS = 'X' if I find an ExportType element with its exporttype
    attribute set to 'xls'. I want to set field TYPE_PDF = 'X' if I find
    an ExportType element with its exporttype attribute set to 'pdf'. How
    can I do that?
    4. For an element that has a value like
    <ErrorCode>123</ErrorCode>
    in the simple transformation, the sequence
    <ErrorCode>  <tt:value ref="ROOT1.CODE" />  </ErrorCode>
    seems to work just fine.
    I have other situations where the XML reads
    <IsNew value='true' />
    I wanted to write
    <IsNew>
            <tt:value ref="$line.IS_NEW"
            map="val(' ') = xml('false'), val('X') = xml('true')" />
           </IsNew>
    but I'm afraid that the <tt:value> fails to deal with the fact that in
    the XML file the value is being passed as the value of an attribute
    (named "value"), rather than the value of the element itself. How do
    you handle this?

    Try this code below:
    data  l_xml_table2  type table of xml_line with header line.
    W_filename - This is a Path.
      if w_filename(02) = '
        open dataset w_filename for output in binary mode.
        if sy-subrc = 0.
          l_xml_table2[] = l_xml_table[].
          loop at l_xml_table2.
            transfer l_xml_table2 to w_filename.
          endloop.
        endif.
        close dataset w_filename.
      else.
        call method cl_gui_frontend_services=>gui_download
          exporting
            bin_filesize = l_xml_size
            filename     = w_filename
            filetype     = 'BIN'
          changing
            data_tab     = l_xml_table
          exceptions
            others       = 24.
        if sy-subrc <> 0.
          message id sy-msgid type sy-msgty number sy-msgno
                     with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        endif.

  • Message /SAPAPO/SDP_PAR023: "Some CVCs cannot be processed in block..."

    Hi,
    We are using SAP SCM release 5.1, the component Demand Planning. We are running macros in background jobs, e.g. a macro that populates a key figure by summarizing other key figures etc. We are using parallel processing, configured based on recommendation from SAP. When the number of CVCs to be processed by the macros becomes very high (we are processing ~300.000 CVCs at the moment), we get the following message in the job log in SM37:
    "Some CVCs cannot be processed in block 2 ", message number /SAPAPO/SDP_PAR023. Obviously the block number varies, and in our case we have had the above message for up to 19 blocks. Users have spotted CVC's that were not updated by the background job, but we don't have a specific list of the CVCs that were not processed.
    OSS notes mentioning this behaviour:
    Note 1282811 - Error processing 1 CVC, terminates the Parallel Profile
    Note 1501424 - DP Job with parallel processing - job status message
    Note 1494099 - DP Job with parallel processing - job status
    The question below is only to those who have encountered the same message in a DP background job:
    Did you find a log of the CVCs that were not processed, and what did you do to overcome the problem?
    Thanks in advance!
    Kind regards,
    Geir Kronkvist

    Hi Rico,
    Thanks for your reply! The spool consists of 23.145 pages so I looked for the word "Lock" using the "Find in request" in the "Spool request" menu. The searched found two entries where there was a message stating that a CVC was locked. It must be noted that no users are logged on while our background job is running, and there are no other processes (background or dialog) running in parallel. When checking transaction SM12 prior to running the job, there are no locks in the system.
    Our job schedule consists of a nightly process chain transferring data from BI to liveCache, and a monthly job that prepares historical data and calculates the forecast. We are now running the monthly job.
    Is it possible that the parallel processing may cause the locking by itself?
    Kind regards,
    Geir Kronkvist

  • Using Simple Transformations with Objects tt:copy .. results in Exception

    Question:
    How can I serialize an ABAP-Object-Instanz with my own simple transformation?
    In the sap-documentation I found the following solution for the serialisation of any data-objects.
    "z_steffens_simple_transf":
    <?sap.transform simple?>
    <tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
      <tt:root name="ROOT"/>
      <tt:template>
        <root>
          <tt:copy ref="ROOT"/>
        </root>
      </tt:template>
    </tt:transform>
    Following the example I wrote this report:
    report  zspahr_test_simple_transf.
    class serializable definition.
      public section.
        interfaces if_serializable_object.
        data attr type string value 'Attribute'.
    endclass.         
    method main_serializable.
        data: oref type ref to serializable,
              xmlstr type xstring.
        create object oref.
        call transformation id
          source root = oref
          result xml xmlstr.
        call function 'DISPLAY_XML_STRING'
          exporting
            xml_string = xmlstr.
        call transformation z_steffens_simple_object
          source root = oref
          result xml xmlstr.
        call function 'DISPLAY_XML_STRING'
          exporting
            xml_string = xmlstr.
      endmethod.                    "main_
    start-of-selection.
      demo=>main_serializable( ).
    Executing this report leads to an exception "CX_SY_REF_NOT_SUPPORTED".
    The "standard" transformation "ID" ist working an translates my object-instance into an asXML representation:
      <?xml version="1.0" encoding="utf-8" ?>
    - <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
    - <asx:values>
      <ROOT href="#o3" />
      </asx:values>
    - <asx:heap xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:abap="http://www.sap.com/abapxml/types/built-in" xmlns:cls="http://www.sap.com/abapxml/classes/global" xmlns:dic="http://www.sap.com/abapxml/types/dictionary">
    - <prg:SERIALIZABLE xmlns:prg="http://www.sap.com/abapxml/classes/program/ZSPAHR_TEST_SIMPLE_TRANSF" id="o3">
    - <local.SERIALIZABLE>
      <ATTR>Attribute</ATTR>
      </local.SERIALIZABLE>
      </prg:SERIALIZABLE>
      </asx:heap>
      </asx:abap>
    How can I do this with my own Simple Transformation "ZSPAHR_TEST_SIMPLE_TRANSF" ?
    I want to serialize my object using my own xml-structure, not the asXML-structure !
    Regards
    Steffen

    Hi,
    try like this,i think it may help you.
    ABAP:
    CALL TRANSFORMATION ztrans_test
          SOURCE
               root = partab
         RESULT XML lv_xstring.
    Trnsformation:
    <tt:root name="ROOT" type="?"/>
    <tt:template>
    <VALUES>
    <VALUE_SOURCE>
            <tt:value ref=".ROOT"/>
    </VALUE_SOURCE>
    <VALUE_PARAM>
    <tt:value ref="NAME"/>
    <tt:value ref="VALUE"/>
    </VALUE_PARAM>
    </VALUES>
    Thanks,
    Rajesh.

  • How to process a block for each row in an internal table....

    Hi experts....
    In po approval workflow the scenario is like this.... for each po there may be more than one approver. approvers list i am maintaining in the ztable. list of approvers(no of approvers) is decided by the po value. I have collected these approvers into internal table. now i have to process a block ( approving or rejecting the po... )in the workflow for each row in the internal table.
    how can i do this. based on the decision of the 1st approver  approves the po then it should go to next approver in the internal table...otherwise end the workflow.....
    Please help me......

    i have created an internal table in the workflow container in which i am getting the list of approvers....
    how can i loop the internal table in the workflow...?
    how can i know the index of the loop in the workflow.....(will sy-index work here....? so that i can use loop until step in the main workflow to call the subworkflow..so that if sy-index is greater than no of entires in the itab then i can come out of the loop)

  • How to escape special characters in Simple Transformation

    Hi Experts,
    I have got a problem to get a well formed xml document from the below simple transformation. The content of maktx contains
    special characters like & <, which are not allowed in a well formed XML-Document. But the result of the Simple Transformation
    contains this charcters even after the transformation as you can the in the result below. Has anyone a hint how to escape the
    characters included in the maktx.
    The transformation for maktx, should be something like
    Before: Material & < TEST
    After: Material &amp &lt TEST
    Report wihich calls the simple transformation
    types:
    BEGIN OF t_mat,
       matnr type matnr,
       maktx type maktx,
    end of t_mat.
    Data:
      mat type t_mat,
      xml_stream type xstring.
    START-OF-SELECTION.
    mat-matnr = '4711'.
    mat-maktx = 'Material & < Test'.
    CALL TRANSFORMATION ztest_st2
            SOURCE mat = mat
            RESULT XML xml_stream.
    CALL FUNCTION 'DISPLAY_XML_STRING'
      EXPORTING xml_string = xml_stream.
    Simple Transformation
    <?sap.transform simple?>
    <tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
      <tt:root name="MAT"/>
      <tt:template>
        <Leistungsschild>
            <CHARACT> MATNR </CHARACT>
            <CHARACT_DESCR> Materialnummer </CHARACT_DESCR>
            <VALUE tt:value-ref="MAT.MATNR"/>
            <CHARACT> MAKTX </CHARACT>
            <CHARACT_DESCR> Materialkurztext </CHARACT_DESCR>
            <VALUE tt:value-ref="MAT.MAKTX" />
        </Leistungsschild>
      </tt:template>
    </tt:transform>
    RESULT
    <?xml version="1.0" encoding="utf-8" ?>
    <Leistungsschild>
      <CHARACT>MATNR</CHARACT>
      <CHARACT_DESCR>Materialnummer</CHARACT_DESCR>
      <VALUE>4711</VALUE>
      <CHARACT>MAKTX</CHARACT>
      <CHARACT_DESCR>Materialkurztext</CHARACT_DESCR>
      <VALUE>Material & < Test</VALUE>   </Leistungsschild>

    Hi Sandra,
    First of all thaks for your quick answer to my problem.
    I see what you mean and get the same result, if I am using data-type string instead of xstring. But the recommendation in the XML-Books of SAP is to use XSTRING to save memory and circumflex problems between Codepages, when writing the XML-Stream to a filesystem.
    As you can see in the code abvoe I am using a SAP-FM to display the XML-Stream and this FM works only with XSTRING´s,
    that is one reason why I don´t understand that it displays it in the wrong way.
    Even the Debugger shows me for the XSTRING the wrong result. Does all that mean that the escaping will not be applyed if you are working with XSTING´s??

Maybe you are looking for

  • Attribute Change run taking too long time to complete.

    Hi all, Attribute change run has been taking too long time to complete.It has to realign 50 odd aggreagates, some by delta , some by reconstruction. But inspite of all the aggregates it used to finish in quick time earlier. But since last 4-5 days it

  • Re-define file name in iTunes

    I imported some audiobooks from my harddisk to iTunes and the file names are "!ntro 1", "!ntro 2"...... to "!ntro 12" question is how do I make the change of each file name without having to change them individually? (I'd like to change them to "Intr

  • OID Connector.User Id includes "\" when seen through ODSM

    Hi All I provsioned a user with OID resource. The prepopulate adapter populates the user id as firstname.lastname. When I see the uid on the target it appears as firstname\.lastname. Whats going wrong here? any ideas? Regards user12841694

  • ABAP Function Module to BW Users.

    Hello All. Someone know if exists a standard Function Module in BW to return a specific user with your Cubes and Queries difined in BW authorizations. I have a Java application using BI Java SDK ....when i connect in BW ...the BI Java SDK return all

  • Check Db fails after kernel patch update

    Hi, I've updated kernel 710 to the latest patch "159" on my PI 7.10 system, however now Check DB fails when scheduled from DB13 with a "Scheduling failed" error. We have SQL 2005 & I'm able to execute the job succesfully via the SQL Managemnt console