Skip to Content
author's profile photo Former Member
Former Member

Creating Simple transformation for an XML data having deep structure


I have the following XML structure..













  • (here we may have any number of records for SKILL&PROFICIENCY...)*





My requirement is to read the above data from an URL and push it into an internal table.

For this I'm trying to use Simple transformations but I'm facing difficulty in doing this.

Can you pl. guide me how to create the transformation and the corresponding code for this.

Best Regards


Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Dec 14, 2010 at 03:11 AM


    Firstly you should post your attempt here so that people can help adapt it rather than starting from scratch.

    Secondly the reason you are probably having trouble is because the XML is badly formed - the end tags are not in the correct order.

    I suggest you check the source XML and make sure it is as you have posted it because you won't be able to write a simple transformation based on it.



    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member


      Here is the actual XML structure..

      - <REQUEST>

      <COUNTRY />

      <ADDRESS />

      <CITY />









      <EXPENDDATE />

      <NEWENDDATE />










      <ZIPCODE />


      - <LANGUAGES>

      - <COMPETENCY>





      - <ACTIVITIES>

      - <COMPETENCY>





      - <BUSINESS>

      - <COMPETENCY>





      - <INDUSTRIES>

      - <COMPETENCY>





      - <METHODS>

      - <COMPETENCY>





      - <OFFERINGS>

      - <COMPETENCY>





      - <PRODUCTS>

      - <COMPETENCY>






      <CANDIDATES />


      Here..... <SKILL></SKILL> <PROFICIENCY></PROFICIENCY> can be more than 1 entry...

      For this I have created a simple transformation like below..

      I have used the tcode 'XSLT_TOOL '..

      In SE11 I have created a Table type 'ZCOMPETENCIES' which is having a line type 'ZLANGS'.

      ZLANGS is a structure which has another structure called 'ZCOMPETENCY' and this 'ZCOMPETENCY' is having fields


      I have used the wizard button which u can find 'XSLT_TOOL '.. and provided the table type ZCOMPETENCIES' and it has automatically created the following transformation...

      <?sap.transform simple?>" xmlns:ddic="" xmlns:def="">

      <tt:root name="ROOT" type="?"/>

      <tt:root name="COMPETENCIES" type="ddic:ZCOMPETENCIES"/>



      <tt:loop ref=".COMPETENCIES">



      <SKILL tt:value-ref="COMPETENCY.SKILL"/>

      <PROF tt:value-ref="COMPETENCY.PROF"/>








      I have written following code to get the data

      CALL METHOD cl_gui_frontend_services=>gui_upload


      filename = gs_file


      data_tab = gt_itab


      file_open_error = 1

      file_read_error = 2

      no_batch = 3

      gui_refuse_filetransfer = 4

      invalid_type = 5

      no_authority = 6

      unknown_error = 7

      bad_data_format = 8

      header_not_allowed = 9

      separator_not_allowed = 10

      header_too_long = 11

      unknown_dp_error = 12

      access_denied = 13

      dp_out_of_memory = 14

      disk_full = 15

      dp_timeout = 16

      not_supported_by_gui = 17

      error_no_gui = 18

      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.


      GET REFERENCE OF gt_person INTO gs_result_xml-value.

      gs_result_xml-name = 'COMPETENCIES'.

      APPEND gs_result_xml TO gt_result_xml.



      SOURCE XML gt_itab

      RESULT (gt_result_xml).

      CATCH cx_root INTO gs_rif_ex.

      gs_var_text = gs_rif_ex->get_text( ).

      MESSAGE gs_var_text TYPE 'E'.


      Please let me know if you need any further details..

      Best Regards


Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.