XML output Function module

Hi All,
Is there any function module in ABAP to generate an xml structure?
I want to generate an xml output in a string for the input structure (internal table)
Thanks
Ricky

Hi ricky,
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,
amit m.

Similar Messages

  • Repeat Output Function module

    Hi SDN,
      Is there is any standard function module for repeat output in the shipments(VL02N)?
    Call the transaction VL02N , go to "GOTO" from the menu and choose "OUTPUT". Then select a output type and then press the button "REPEAT OUTPUT".

    Hello Ricky
    To transform ABAP to XML you can use the simple transformation, e.g.:
    DATA:
      gt_itab    TYPE TABLE OF knb1,
      gd_xml   TYPE string.
    * Select data into gt_itab
      CALL TRANSFORMATION id_ident
        SOURCE abap = gt_itab
        RESULT XML gd_xml.
    You could place this coding into a function module having an IMPORTING parameter of type TABLE (generic table type). However, this generic type will not work for a RFC-enable function module.
    Regards
      Uwe

  • Creating a Function module to send XML Byte String

    Hi all,
    I have to create a Function module to get XML byte string.The internal table is dynamic coloums based on how many data selected as a importparameter.from the internal; table data I have to create a XML byte string as a output.Pl help me to proceed further.
    Thanks in Advance.
    Ram

    If i have your question right you need to convert an internal table of unknown type to an xml string then to a byte string.
    data xmlString type string.
    data xmlXString type xstring.
    call transformation id
       source
          table = internalTableYouWantToExport
       result
          xml xmlString.
    export xmlString to data buffer xmlXString.
    xmlString has the xml of the table and xmlXString contains the byte representation of the string.

  • Any function module/program to write-xml schema of a idoctype

    Hi experts,
    I need to write the xml format into an internal table.
    input---idoc type.
    output--xml schema file in an internal table/or in some file.
    Through we60 we can get the xml schema.but through some program i want to get it .how to go for it.
    Any function module do you suggest which fits to this requirement and do the work for me.
    For ex: idoc type--orders05
    Message was edited by:
    dasr r

    Hello Dasr
    There are several function modules available. Please check yourself if any of them matches your demands.
    EDIN                           IDoc: Eingangsverarbeitung
    IDOC_INBOUND_XML_VIA_HTTP      eingang über http
    IDOC_XML_FROM_FILE             IDoc: Eingangsverarbeitung vom XML über Dateischnittstelle
    IDOC_ADAPTER_MB                Message Broker IDoc Adapter
    IDX_IDOC_TO_XML                Konvertierung IDoc nach IDoc XML im XMB
    IDOC_XML1                      erweiterte Tabellenpflege (generiert)
    IDOC_XML_DISPLAY               Anzeigen eines IDocs in XML-Format mit XSL
    IDOC_XML_TRANSFORM             Anzeigen eines IDocs in XML-Format mit XSL
    Regards
      Uwe

  • Function Modules for XML

    Hi Everyone,
    Can anyone please suggest me if there are any function modules in SAP R/3 which can be used or further modified to retrieve the data from an external XML files.
    Any suggestions or ideas are more welcome.
    Thanks,
    Prashant.

    Hi Prashanth,
    See the below function modules:-
    <b>SDIXML_DATA_TO_DOM -></b>   Convert SAP data(elementary/structured/table types) into DOM (XML)  ExampleO 
    <b>SDIXML_DOM_TO_XML -></b>   Convert DOM (XML) into string of bytes that can be downloaded to PC or application server 
    <b>SDIXML_DOM_TO_SCREEN -></b>   Display DOM (XML) 
    <b>SDIXML_DOM_TO_DATA</b> 
    and also see the below thred, it is having example program also
    /people/gregor.wolf3/blog/2005/12/30/sdn-points-blow-out-chart-sdn-forum-users-online
    Regards
    Sudheer

  • Printing ALV Report output through Function Modules

    Hi All,
    I want to print my ALV Grid output through function modules/statement (not through print option in menu).
    This is because, i am generating a PDF from spool when user clicks on a button. If any changes happened in the ALV output layout, they will be captured in spool through printing it.
    So can you please tell me how to print the ALV Output through FMs or sending the ALV output to spool.
    Thanks & Regards,
    Senthil.
    Edited by: senthil nathan on May 17, 2010 2:49 PM

    Hi Dev,
    Thanks for the reply.
    I want to print the ALV when the user clicks on a button in toolbar. Lets say the user has made some changes to the layout, (E.g hiding a field) and when i print that output it should use the changed layout, If i use the FM suggested by you, i cant acheive this.
    If you try to print this manually, the system uses the changed layout and not the original. Thats why i want to know FMs/statement to print.
    Regards,
    Senthil.

  • Populating the output parameter in function module.

    Hi Experts,
       I have written a function module,with material number,BEZEI as input and mvgr2 as output from table tvm2t.I am facing a problem in populating the material number as well in outputtable.The material number in input is nothing to do with output.
    please help me at the earliest.
    Regards,
    Sridevi.

    Hmmm, you wrote that the output is 'table parameter' but you mention 2 single fields. If you expect a good reply here, it helps to mention how you defined the table and how you select the data for the output. For example: input is matnr and you select the material group of this matnr. Output is all other matnr of this material group. Then we would know what you want to do here.
    So please describe what you need and give us the table description.
    Regards
    Nicola

  • Adobe Forms function module - downloading the xstring output in PDF file

    Hi Guys,
    I'm using Adobe forms and fetching its output in an XSTRING PDF format. How can I download this XSTRING output to a PDF file and store on the local file system?
    I'm using the following approach to getting a PDF output:
    ls_outputparams-getpdf = 'X'.
    CALL FUNCTION 'FP_JOB_OPEN'
      CHANGING
        ie_outputparams = ls_outputparams.
    * Get the name of the generated function module
      CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
        EXPORTING
          i_name     = 'ZADOBEFORM'
        IMPORTING
          e_funcname = lv_fmname.
      IF sy-subrc <> 0.
      ELSE.
    *   Call the Adobe Form function module
        CALL FUNCTION lv_fmname
          EXPORTING
            /1bcdwb/docparams  = ls_docparams
          IMPORTING
            /1bcdwb/formoutput = ls_form_output
          EXCEPTIONS
            usage_error        = 1
            system_error       = 2
            internal_error     = 3.
        IF sy-subrc <> 0.
        ENDIF.
      ENDIF.
    * Close the spool job
    CALL FUNCTION 'FP_JOB_CLOSE'.
    Now, the variable LS_FORM_OUTPUT-PDF contains the PDF output in XSTRING. My question is how can I download this as a PDF file to my local machine.
    Kind Regards,
    Shailesh.

    hi guys,
    im using all FM to download my PDF adobe but in this part :
    ls_spfli-carrid = 'AA'.
    ls_spfli-connid = '0017'.
    APPEND ls_spfli TO it_spfli.
    flag                     = 'X'.
    is_address_type          = '1'.
    is_address_number        = '22515'.
    is_person_number         = '22517'.
    is_country               = 'IN'.
    *&--- Call the generated function module
    CALL FUNCTION '/1BCDWB/SM00000200'
       EXPORTING
    *   /1BCDWB/DOCPARAMS        =
         it_spfli                 = it_spfli
         flag                     = flag
         is_address_type          = is_address_type
         is_address_number        = is_address_number
         is_person_number         = is_person_number
         is_country               = is_country
      IMPORTING
        /1bcdwb/formoutput       = fp_formoutput
      EXCEPTIONS
        usage_error              = 1
        system_error             = 2
        internal_error           = 3
        OTHERS                   = 4
    I have usage_error knowing that the execution of the function module in SE37 pass successfuly and also the execution of the forms .
    in your opinion what can be the problem?
    Kind Regards,

  • Passing an XML file from WebDynpro app to ABAP function module

    Hi all,
    I'm stuck with a problem, and am hoping one of you could let me know how to proceed:
    I need to pass an XML file (or at least the entire content of the XML) from my WebDynpro application to a backend ABAP function module. What I tried was this:
    In my WebDynpro app, I read the XML and convert the content into one long string (using java.io.FileReader and java.io.BufferedReader). In my ABAP function module I created an import parameter of type String. I then imported the ABAP Function module into my WebDynpro app as a model. I then tried to pass the XML string to the ABAP module. What happens is this:
    If the size of the string (XML) happens to be less than 255 characters, then it works. That is, the string is passed to the ABAP function module and I can see the contents. However, if the XML string happens to be greater than 255 characters, then it does not work. The string at the ABAP side is empty. Surprisingly, the ABAP module does not throw an error either. It just displays an empty string.
    Could you please tell me what the problem is?
    Thanks & Regards,
    Biju

    Hi Biju ,
    Welcome to SDN.
    If the import parameter is defined as type string it should work, however did you check whether your application pass it properly?
    I have applications using strings as import parameters working fine. (webapplications (BSP) to RFC)
    Regards
    Raja

  • Function module not genrating a output when executing

    Hello
    I am using this function module to calculate the difference between the number of days using factory calendar. The function module is working fine but it is not giving the output. It is not generating the result. here is the code for the function module
    please can you check and let me know what can be the reason
      DATA:
        DURATION_F       TYPE F.
      IF  START_DATE IS INITIAL
      AND END_DATE IS INITIAL.
        MESSAGE E032 RAISING PARAMETERS_NOT_VALID.
    Bitte geben Sie ein gültiges Start- und Enddatum an
      ENDIF.
      IF FLG_UNITS IS INITIAL.
        PERFORM TIME_UNITS.
        FLG_UNITS = 'X'.
      ENDIF.
      IF UNIT = SPACE.
        UNIT = UNIT_DAY.
      ENDIF.
      PERFORM DURATION_COMPUTE
         USING
              START_DATE
              START_TIME
              END_DATE
              END_TIME
              FACTORY_CALENDAR
              UNIT
         CHANGING
              DURATION_F
              START_DATE
              END_DATE
              START_TIME
              END_TIME.
      DURATION = DURATION_F.
    ENDFUNCTION.

    when calling the function module get the duration field as output
    write that output on the list

  • Function module output

    Hi
      I am displaying output in function module using 8 tables. But here i am writing code using for all entries.
      But the problem is  what are the fields specify in the select query those fields are displaying in the output. But i want only particular fields.
      Here is there any possibility to write WRITE statement?

    I think you may need to re-state the question a bit as it is not clear -
    I am displaying output in function module using 8 tables.  -> Are you displaying the data onto a screen or a list or just returning the results in the FM parameters?
    But here i am writing code using for all entries.  -> Why does this have an impact on the problem?
    But the problem is what are the fields specify in the select query those fields are displaying in the output. But i want only particular fields.  The fields you include in your select do not have to appear in any output e.g. you could select all and display one
    select * from t001.
      write: / t001-bukrs. "output one field from many...
    endselect.
    Here is there any possibility to write WRITE statement? You can have "write" statements in a function module but you need a screen "canvas" to display them on, so how / whether you see them will depend on where the code is invoked from and what's in the code.
    Jonathan

  • Function module to list out a report's input/output parameters

    Hi experts,
    I'd like to know if there is a function module which can list out all the input and output parameters (variables, tables, etc.) by giving the report name as input.
    If not, please suggest a way to find out the input/output parameters.
    Regards,
    Ancy

    Well, they're not input/output parameters, and really you shouldn't refer to them as such.  A variable is simple what it says - a variable.  You could, I suppose, refer to data sources.  But then, the report could be getting data from a set of function modules.
    So my assumption is correct, you are talking about a where-used list.
    >Check out tables like CROSS. To find other useful tables, put an SQL trace on, do the where used, and see what tables are hit.
    matt

  • Dynamic table as output in Function Module

    Hi all,
    I am trying to output a dynamic table from a FM. I am a generating a dynamic internal table in the FM. Now i want to assign that internal table to a table parameter of the FM so that i can use that table in the calling program. can this be done?
    regards,
    hamza

    You may need to look into code of sap function module
    RFC_READ_TABLE

  • Trigger Idoc by using the Output type in Z function module

    My requirement is when I run Z function module then  Idoc should be send which is configured in Output Type.
    Means when ever i run the Functional module that Output type should be triggered.?
    Does any one have solution??

    Hi,
    Remove the Material Class from Importing Tab and Place the same under Tables Parameter.
    Regards,
    SRinivas

  • Function module to read XML file in ABAP

    Hey guys
    is there any function module which can read an XML file into an ABAP code?
    we are getting some file on the application server in XML format and we need to read this file in ABAP code,how can i achieve this ?
    thanz
    ahmad

    Hi Ahmad,
      These are few functions to work with XML in ABAP.
      SDIXML_DATA_TO_DOM: Convert SAP data (elementary/structured/table types) into DOM (XML)       
    SDIXML_DOM_TO_XML: Convert DOM (XML) into string of bytes that can be downloaded to PC or application server
    SDIXML_DOM_TO_SCREEN: Display DOM (XML)
    SDIXML_DOM_TO_DATA
    Example of using these:
    eport z.
    data: it_table like t001 occurs 0.
    data: l_dom      TYPE REF TO IF_IXML_ELEMENT,
          m_document TYPE REF TO IF_IXML_DOCUMENT,
          g_ixml     TYPE REF TO IF_IXML,
          w_string   TYPE XSTRING,
          w_size     TYPE I,
          w_result   TYPE I,
          w_line     TYPE STRING,
          it_xml     TYPE DCXMLLINES,
          s_xml      like line of it_xml,
          w_rc       like sy-subrc.
    start-of-selection.
      select * from t001 into table it_table.
    end-of-selection.
    initialize iXML-Framework          ****
      write: / 'initialiazing iXML:'.
      class cl_ixml definition load.
      g_ixml = cl_ixml=>create( ).
      check not g_ixml is initial.
      write: 'ok'.
    create DOM from SAP data           ****
      write: / 'creating iXML doc:'.
      m_document = g_ixml->create_document( ).
      check not m_document is initial.
      write: 'ok'.
      write: / 'converting DATA TO DOM 1:'.
      CALL FUNCTION 'SDIXML_DATA_TO_DOM'
        EXPORTING
          NAME               = 'IT_TABLE'
          DATAOBJECT         = it_table[]
        IMPORTING
          DATA_AS_DOM        = l_dom
        CHANGING
          DOCUMENT           = m_document
        EXCEPTIONS
          ILLEGAL_NAME       = 1
          OTHERS             = 2.
      if sy-subrc = 0.  write  'ok'.
      else.             write: 'Err =', sy-subrc.
      endif.
      check not l_dom is initial.
      write: / 'appending DOM to iXML doc:'.
      w_rc = m_document->append_child( new_child = l_dom ).
      if w_rc is initial.  write  'ok'.
      else.                write: 'Err =', w_rc.
      endif.
    visualize iXML (DOM)               ****
      write: / 'displaying DOM:'.
      CALL FUNCTION 'SDIXML_DOM_TO_SCREEN'
        EXPORTING
          DOCUMENT          = m_document
        EXCEPTIONS
          NO_DOCUMENT       = 1
          OTHERS            = 2.
      if sy-subrc = 0.  write  'ok'.
      else.             write: 'Err =', sy-subrc.
      endif.
    convert DOM to XML doc (table)     ****
      write: / 'converting DOM TO XML:'.
      CALL FUNCTION 'SDIXML_DOM_TO_XML'
        EXPORTING
          DOCUMENT            = m_document
        PRETTY_PRINT        = ' '
        IMPORTING
          XML_AS_STRING       = w_string
          SIZE                = w_size
        TABLES
          XML_AS_TABLE        = it_xml
        EXCEPTIONS
          NO_DOCUMENT         = 1
          OTHERS              = 2.
      if sy-subrc = 0.   write  'ok'.
      else.              write: 'Err =', sy-subrc.
      endif.
      write: / 'XML as string of size:', w_size, / w_string.
      describe table it_xml lines w_result.
      write: / 'XML as table of', w_result, 'lines:'..
      loop at it_xml into s_xml.
        write s_xml.
      endloop.
      write: / 'end of processing'.
    end of code
    Let me know if you have further questions..
    BR
    Rakesh

Maybe you are looking for

  • Startflightrecording: any way to get methods deeper stack traces?(dept 64)

    I'm using jrcmd PID start_flightrecording in order to get some useful samplings, but it seems the stack traces are limited to depth 64 (i.e. in the Hot Methods's Predecessors view of JRockit Mission Control 4.1.0 I see only the last 64 frames) hence

  • "open -ef" works "open -t" does not from command line

    Hi, this question is based on @Linc Davis' troubleshooting command which contains open -ef at the end. the Command: syslog | tail | open -ef works perfectly on my osx 10.8.5 and opens the required lines from syslog in textEdit, however when I run sys

  • New site - IE 8 - Chrome Errors

    We are doing a new website. The test domain is blinkvisualdesign5.com On Safari and Firefox, all is good. On IE8 and Chrome, we are told that it is not loading the pages correctly. Please help.

  • My MacBook appears to have died - and yet is showing signs of life.

    Hi there. My MacBook Pro can only start up with the grey Apple and the spinning clock symbol. But there are hints that the hard drive is still alive. I will probably buy a new hard drive and back up from TimeCapsule, but I would love to get the data

  • Parse a binary SWF file

    anyone have code to parse a binary SWF file into it's parts? (flash file)