Parse XML streams via ABAP program or class

Hi all,
because of a new requirement we would like to create characteristics from a XML file by using the following structure.  
xmlns:gdt="http://sap.com/xi/SAPGlobal/Global" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
We do not use SAP XI but I would like to parse the XML stream from a file in order to have the information available in a ABAP program. For this reason I'm looking for a standard SAP ABAP program or class to read and parse such a XML file. 
I would appreciate if somebody have more details on this topic.

Check this out.
XML to ABAP
Regards,
Rich Heilman

Similar Messages

  • How to extract data from BPC InfoCube via ABAP program?

    Hi experts!!
    I tried to extract data from a BPC InfoCube via ABAP program, but I did'n have succeed.
    I used the function 'RSDRI_INFOPROV_READ' to extract data from standard InfoCubes such as '0COPC_C07' and it run OK! However, when I change the InfoCube name to '/CPMB/WAIX8NE' (BPC InfoCube), everything goes wrong...
    Is there any difference between extracting data from BPC and standard InfoCubes?
    Thank you all!

    Moderator message - Welcome to SCN.
    But please do not cross and duplicate post.
    Thread locked.
    Rob

  • How to capture an Odata XML inside an ABAP program ?

    Hi Colleagues,
    I have a scenario where I need to capture the Odata XML inside an ABAP program.
    Problem Description:
    1. Log into U3F Client 100 system.
    2. Goto Transaction 'SPRO'.
    3. Click on 'SAP Reference IMG'.
    4. Select SAP Netweaver - Gateway - OData channel - Administration - Maintain Services.
    5. Select any service from the Service catalog.
    6. Click on 'Call Browser' button.
    Now, my requirement is to capture the XML which gets displayed on the web browser into an ABAP program but I am unable to do so. Kindly, provide us the solution.
    Best Regards,
    Naresh

    Hi,
    Check this example
    [http://help.sap.com/saphelp_nwpi71/helpdata/en/1f/93163f9959a808e10000000a114084/content.htm|http://help.sap.com/saphelp_nwpi71/helpdata/en/1f/93163f9959a808e10000000a114084/content.htm]
    Regards,
    Ivan

  • Send a mail via ABAP program

    Hello Experts,
    I want to send mail via ABAP program with the following requirements :
    1. Recipient is OUTLOOK email -id
    2. Sender address has to be an external email-id
    3. Send mail as CC and BCC also to other email-id.
    Is there any function module which can satisfy all the above requirements.
    Regards,
    Mansi.

    hi,
    this code will definately help you just go through it:
    firstly  exported the data to memory using the FM LIST_FROM_MEMORY.
    CALL FUNCTION 'LIST_FROM_MEMORY'
    TABLES
    listobject = t_listobject
    EXCEPTIONS
    not_found = 1
    OTHERS = 2.
    IF sy-subrc 0.
    MESSAGE e000(su) WITH text-001.
    ENDIF.
    then i converted it into ASCII using LIST_TO_ASCI,
    CALL FUNCTION 'LIST_TO_ASCI'
    TABLES
    listasci = t_xlstab
    listobject = t_listobject
    EXCEPTIONS
    empty_list = 1
    list_index_invalid = 2
    OTHERS = 3.
    IF sy-subrc NE 0.
    MESSAGE e003(yuksdbfzs).
    ENDIF.
    This gives the data in ASCII format separated by '|' and the header has '-', dashes. If you use this internal table directly without any proccesing in SO_NEW_DOCUMENT_ATT_SEND_API1, then you will not get a good excel sheet attachment. To overcome this limitation, i used cl_abap_char_utilities=>newline and cl_abap_char_utilities=>horizontal_tab to add horizontal and vertical tabs to the internal table, replacing all occurences of '|' with
    cl_abap_char_utilities=>horizontal_tab.
    Set the doc_type as 'XLS', create the body and header using the packing_list and pass the data to be downloaded to SO_NEW_DOCUMENT_ATT_SEND_API1 as contents_bin.
    This will create an excel attachment.
    Sample code for formatting the data for the attachment in excel format.
    u2022     Format the data for excel file download
    LOOP AT t_xlstab INTO wa_xlstab .
    DESCRIBE TABLE t_xlstab LINES lw_cnt.
    CLEAR lw_sytabix.
    lw_sytabix = sy-tabix.
    u2022     If not new line then replace '|' by tabs
    IF NOT wa_xlstab EQ cl_abap_char_utilities=>newline.
    REPLACE ALL OCCURRENCES OF '|' IN wa_xlstab
    WITH cl_abap_char_utilities=>horizontal_tab.
    MODIFY t_xlstab FROM wa_xlstab .
    CLEAR wa_xlstab.
    wa_xlstab = cl_abap_char_utilities=>newline.
    IF lw_cnt NE 0 .
    lw_sytabix = lw_sytabix + 1.
    u2022     Insert new line for the excel data
    INSERT wa_xlstab INTO t_xlstab INDEX lw_sytabix.
    lw_cnt = lw_cnt - 1.
    ENDIF.
    CLEAR wa_xlstab.
    ENDIF.
    ENDLOOP.
    Sample code for creating attachment and sending mail:
    FORM send_mail .
    u2022     Define the attachment format
    lw_doc_type = 'XLS'.
    u2022     Create the document which is to be sent
    lwa_doc_chng-obj_name = 'List'.
    lwa_doc_chng-obj_descr = w_subject. "Subject
    lwa_doc_chng-obj_langu = sy-langu.
    u2022     Fill the document data and get size of message
    LOOP AT t_message.
    lt_objtxt = t_message-line.
    APPEND lt_objtxt.
    ENDLOOP.
    DESCRIBE TABLE lt_objtxt LINES lw_tab_lines.
    IF lw_tab_lines GT 0.
    READ TABLE lt_objtxt INDEX lw_tab_lines.
    lwa_doc_chng-doc_size = ( lw_tab_lines - 1 ) * 255 + STRLEN( lt_objtxt ).
    lwa_doc_chng-obj_langu = sy-langu.
    lwa_doc_chng-sensitivty = 'F'.
    ELSE.
    lwa_doc_chng-doc_size = 0.
    ENDIF.
    u2022     Fill Packing List For the body of e-mail
    lt_packing_list-head_start = 1.
    lt_packing_list-head_num = 0.
    lt_packing_list-body_start = 1.
    lt_packing_list-body_num = lw_tab_lines.
    lt_packing_list-doc_type = 'RAW'.
    APPEND lt_packing_list.
    u2022     Create the attachment (the list itself)
    DESCRIBE TABLE t_xlstab LINES lw_tab_lines.
    u2022     Fill the fields of the packing_list for creating the attachment:
    lt_packing_list-transf_bin = 'X'.
    lt_packing_list-head_start = 1.
    lt_packing_list-head_num = 0.
    lt_packing_list-body_start = 1.
    lt_packing_list-body_num = lw_tab_lines.
    lt_packing_list-doc_type = lw_doc_type.
    lt_packing_list-obj_name = 'Attach'.
    lt_packing_list-obj_descr = w_docdesc.
    lt_packing_list-doc_size = lw_tab_lines * 255.
    APPEND lt_packing_list.
    u2022     Fill the mail recipient list
    lt_reclist-rec_type = 'U'.
    LOOP AT t_recipient_list.
    lt_reclist-receiver = t_recipient_list-address.
    APPEND lt_reclist.
    ENDLOOP.
    u2022     Finally send E-Mail
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    document_data = lwa_doc_chng
    put_in_outbox = 'X'
    commit_work = 'X'
    IMPORTING
    sent_to_all = lw_sent_to_all
    TABLES
    packing_list = lt_packing_list
    object_header = lt_objhead
    contents_bin = t_xlstab
    contents_txt = lt_objtxt
    receivers = lt_reclist
    EXCEPTIONS
    too_many_receivers = 1
    document_not_sent = 2
    document_type_not_exist = 3
    operation_no_authorization = 4
    parameter_error = 5
    x_error = 6
    enqueue_error = 7
    OTHERS = 8.
    Hope it will help you
    regards
    Rahul sharma

  • How to parse xml in sap abap

    Hello,
    Can anyone help me to know how to parse xml in sap abap.
    I have a xml file which i want to parse and store it in internal table.
    <?xml version="1.0" encoding="UTF-8"?>##<data><name>menaka<name></data>
    Regards,
    Menaka.H.B

    Hello,
    For how to get the node name, you have to refer to this :
    [https://wiki.sdn.sap.com/wiki/display/ABAP/Upload%20XML%20file%20to%20internal%20table|https://wiki.sdn.sap.com/wiki/display/ABAP/Upload%20XML%20file%20to%20internal%20table]
    Check the code after:
    WHEN if_ixml_node=>co_node_element
    It tells you how to get the node name.
    BR,
    Suhas

  • Schedule Jobs with multiple steps via ABAP Program

    Hi,
    I need to schedule multiple programs via background jobs on a daily basis. Since all these jobs are to be run as a single job, the various programs have to be run as steps in a major job.
    I am however not very clear on how this can be done via an ABAP program ( the idea of a program is that various parameters to be passed to each program in the step can be entered dynamically rather than via variants).
    I am using the JOB_OPEN and JOB_CLOSE functions and submitting the programs with selection screen parameters dynamically passed to create a job. I need to do this for various programs as a job step (WITHOUT Variants being defined).
    Can anyone suggest any ideas for this? I have tried out JOB_SUBMIT Function but am not very confident I know what exactly it is for as it asks for a variant.
    Thanks very much,
    Preet

    Hi Preet,
    just to be sure: you know, that variants can be dynamical, too?
    It's quite usual to assign dynamical current date, but it's also possible to add / subtract value and even define own functionality.
    Maybe it's easier to implement a dynamical selection and handle static jobs.
    If you try to plan a job (online or with JOB_SUBMIT), you have to use variants - you can create (or change) them dynamical in beforehand. Only SE38, F8, F9 is creating a temporary variant, so that no saved variant is necessary.
    But if you end up creating variants dynamical, you can change one existing variant, too. Then you can use a static job definition (with periodical starting rule).
    So: have a look, if dynamic variants are enough, otherwise change variants per job.
    Regards,
    Christian

  • Reading XML Data from ABAP Program?

    Hi,
    How do I read XML Data from an ABAP Program? For example if I have the below basic XML Code-
    <xml>
    <Name> Thiru </Name>
    <Age> 24 </Age>
    <City> chennai </Chennai>
    </xml>
    How do i read the data within the Name,Age, and City tags into variables in the ABAP Program?
    Regards,
    Thiru

    if you decide to do in XSLT, I have a sample list here:
    XML file like this:
    <?xml version="1.0" encoding="UTF-16"?>
    <F>
    <P1>
    <t_1>value1</t_1>
    <t_2>testvalue</t_2>
    </P1>
    <P2>
    </P2>
    </F>
    XSLT file like this:
    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sapxsl="http://www.sap.com/sapxsl" version="1.0">
    <xsl:strip-space elements="*"/>
    <xsl:template match="F">
    <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
    <asx:values>
    <<b>DOCUMENT</b>>
    <xsl:apply-templates/>
    </<b>DOCUMENT</b>>
    </asx:values>
    </asx:abap>
    </xsl:template>
    <xsl:template match="P1">
    <ENTRY>
    <<b>T_1</b>><xsl:value-of select="t_1"/></T_1>
    <<b>T_2</b>><xsl:value-of select="t_2"/></T_2>
    </ENTRY>
    </xsl:template>
    </xsl:transform>
    ABAP program like this:
    DATA: BEGIN OF wa_upload,
    text(255) TYPE c,
    END OF wa_upload,
    itab_upload LIKE TABLE OF wa_upload,
    BEGIN OF wa_document,
    t_1 TYPE string,
    t_2 TYPE string,
    END OF wa_document,
    itab_document LIKE TABLE OF wa_document.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = 'XXXXX'
    filetype = 'ASC'
    TABLES
    data_tab = itab_upload.
    CALL TRANSFORMATION zrappel_xml_test
    SOURCE XML itab_upload
    RESULT <b>document</b> = itab_document.
    You should pay attention to the bold words.
    hope it will be helpful
    thanks

  • XML files from ABAP programs

    Hi everyone!
    Is there a way in ABAP to output XML files?  Pls. send code/ function module if any.
    From ABAP programs, we are sure that we can output TEXT files, but how about XML files?
    The significance of this question is related
    Currently we are using XI to interface SAP and AMS, this question for ABAP to produce XML file arose, if for example, the XI server is down and we have to still send data from one system to another. IDocs can also produce XML files, pls confirm.  Earlier however, we have preferred XI rather than IDocs to do this.  Anyway, any idea regarding this scenario will be greatly appreciated. 
    Thanks and God bless!
    Celeste

    Hi,
    Please check this sample codes from other thread.
    1. itab --- > xml
        xml ---> itab.
    2. This program will do both.
    (just copy paste in new program)
    3.
    REPORT abc.
    *-------------- DATA
    DATA : t001 LIKE TABLE OF t001 WITH HEADER LINE.
    DATA : BEGIN OF itab OCCURS 0,
    a(100) TYPE c,
    END OF itab.
    DATA: xml_out TYPE string .
    DATA : BEGIN OF upl OCCURS 0,
    f(255) TYPE c,
    END OF upl.
    DATA: xmlupl TYPE string .
    ******************************* FIRST PHASE
    ******************************* FIRST PHASE
    ******************************* FIRST PHASE
    *------------------ Fetch Data
    SELECT * FROM t001 INTO TABLE t001.
    *------------------- XML
    CALL TRANSFORMATION ('ID')
    SOURCE tab = t001[]
    RESULT XML xml_out.
    CALL FUNCTION 'SCMS_STRING_TO_FTEXT'
    EXPORTING
    TEXT = xml_out
    * IMPORTING
    * LENGTH =
    TABLES
    FTEXT_TAB = itab.
    *-------------- Download
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    filetype = 'BIN'
    filename = 'd:xx.xml'
    TABLES
    data_tab = itab.
    ******************************* SECOND PHASE
    ******************************* SECOND PHASE
    ******************************* SECOND PHASE
    BREAK-POINT.
    REFRESH t001.
    CLEAR t001.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = 'D:XX.XML'
    filetype = 'BIN'
    TABLES
    data_tab = upl.
    LOOP AT upl.
    CONCATENATE xmlupl upl-f INTO xmlupl.
    ENDLOOP.
    *------------------- XML
    CALL TRANSFORMATION ('ID')
    SOURCE XML xmlupl
    RESULT tab = t001[]
    BREAK-POINT.
    Regards,
    Ferry Lianto

  • Create a DDic sturcture via ABAP program

    Hello,
    is it possible to create a DDic structure via a ABAP program? I've got the components and component type of the new structure in a table.
    I want to create a DDic structure with this information. Is there function module or a method, with this functionality?
    Thanks for help!
    Matthias

    I need a DDic structure to use this in the exporting parameters of an remote-enabled function module.  Thier isn't it posible to use an none typed parameter, because of the remote.
    I want to create an admin-screen for an tool calls DocFinder. For this tool you need for every DocuSpace an extra structure to return the values.
    We use this tool in an shared systemlandscape so its nessessary to use an remode-enabled function module.
    In the admin-screen it should be able to create an new DocuSpace with its structures and other generatet coding.
    But I've got no idea how to create an structure via programm.

  • How to add a new output type in sales order header via ABAP program

    Hi All,
    I have to add new output type (ex Z001) in sales order header via an ABAP program. please let me know how to do this.
    Thank you all in advance.

    Hi,
    You can use the FM ..RV_MESSAGE_UPDATE..
    Thanks
    Naren

  • Parsing XML Files to ABAP

    Hello All,
    There is a requirement for parsing of XML files to ABAP.
    1.How do we pick an XML file from Application server and also from FTP server?
    2.After picking the XML file how to parse that XML file to process it to create material master?

    Hi,
    Ur scenario is File to R/3
    For creating material master ..i guess there is IDoc named MATMAS.
    U can make use of it and execute File to IDoc Scenario.
    link for File to IDoc--
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/xi/fileToIDOC&
    U need to pick XML file from FTP server...No need to parse XML file...just create data type which represents ur xml file structure and map it to IDoc fields.
    regards,
    Manisha

  • Copy Attachement in CV03N via ABAP program

    I would like to copy an attachment in CV03N to my C: drive.  I can do this by right clicking on the file and selecting Copy To.  I need to do this via an ABAP program.  Is this possible?
    Thanks Gary

    Found the answer....
    CALL FUNCTION 'CVAPI_DOC_VIEW' copies attachment from CV03N to my PC

  • Calling ITS Service via abap program

    We have made an ITS Service (SAP GUI for HTML) for one of the R/3 programs (Customized).
    If the URL is linked directly to the service, it shows correctly.
    But if we call the service via transaction code as in: Call tcode Zabc..., it does not work.
    How can we call the service directly from the abap program on the click of a button?
    Thanks in advance.

    Hi,
    You can do something like this:
    CALL FUNCTION 'CALL_BROWSER'
             EXPORTING
               url                          = path
               new_window                   = 'X'
             EXCEPTIONS
               frontend_not_supported       = 1
               frontend_error               = 2
               prog_not_found               = 3
               no_batch                     = 4
               unspecified_error            = 5
               OTHERS                       = 6
    where PATH variable is ITS service url:
        CONCATENATE 'http://server:port/sap/bc/gui/sap/its/webgui?transaction=xxxxxx&okcode=xxxx INTO path.
    Hope this helps,
    Iván.

  • Schedule/Execute POWL Query in Background or via ABAP Program

    Hi all,
    I would like to know if there is any chance/possibilities to schedule/execute the POWL Query for example the Query ID
    "SAPSSRM_R_CENTRALCONFIRM_01_01" Confirmations Pending in the background to output report.
    Or perhaps there is anyway I can make use of the logic within the Query ID above in an ABAP program?
    The main reason is that I need create a Confirmations Pending report and sent out to relevant SC Creator and the quickest way is to make use of the existing query of above.
    Many thanks and regards,
    Hon Leong

    Hi Hon Leong,
    please first check POWL - Web Dynpro ABAP - SCN Wiki to understand, how POWL works.
    You need to find a Feeder Class of your query and execude GET_OBJECTS Method to get the result list.
    For example you can check report POWL_WLOAD or function module POWL_QUERY_REFRESH.
    Regards
    Konstantin

  • Insert Nodes into Hierarchy via ABAP Program

    Hello,
    I want to create ABAP program to insert nodes into a hierarchy.
    I got a class CL_RSSH_HIERMAINTAIN_FRONT with method INSERT_NODES_HIERARCHY .
    But the method is private and cannot be used in the ABAP call.
    I also don't want a pop up which asks for the action on duplicate nodes.
    Can anyone guide me a bit here ?
    Any help would be appreciated.
    Varun

    pl check following
    http://www.scribd.com/doc/7300428/Structure-of-a-Flat-Hierarchy-File-for-Loading-Using-a-PSA

Maybe you are looking for

  • Error while altering a table.

    Hi All, When i tried to alter a table. I got the following error. SQL> ALTER TABLE SALES_ORDER_TRANS_IHST ADD(SUPER VARCHAR2(1),REASON_CD VARCHAR2(10)); ERROR at line 1: ORA-00069: cannot acquire lock -- table locks disabled for SALES_ORDER_TRANS_IHS

  • Aquestion: can i connect a tape recorder to computer and put the digitial info on my computer

    I have HP Pavilion p6310f desktop PC.  I desire to put some cassette tape music on the computer using the TEAC tape deck player.  I do not have a receiver for the tape deck, but I would like to know if the digital info of the songs would be picked up

  • Scroll bar has lost zoom function

    Hi I'm using LP 9.1.7 Since I upgraded to Mountain Lion, my scroll bar zoom function has vanished. It's there in Waveburner. I can't find any preferences that can help me. Any help greatly appreciated -- I use tyhis function all the time and I'm lost

  • Reconstruct problems after shutdown / startup

    Yesterday we had an air conditioning outage in our data center, so I had to shutdown our iMS system. I forgot to do a stop-msg on the mail server, so it apparently did not get shut down very cleanly. When I booted back up later in the day, I had to r

  • Can anyone give me the Address that goes in the top address bar of Aurora.

    It has taken me days to find a way of contacting someone at Firefox to help an avid fan (Me) to get this far so I really hope you can help me. I downloaded Firefox Aurora about 10 days ago but had a problem with my PC so I reformatted the drive "C" b