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

Upload XML to create and IDOC

Hi all,

does anybody use FM IDOC_XML_FROM_FILE?

I don´t know how to use it?

Please if somebody has a valid XML example for this FM post it here?

Regards.

Jose.

Mensaje editado por:

Jose Maria Alot Aguilar

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Feb 19, 2007 at 02:02 PM

    Hello,

    Check this link:

    hi i want to upload xml file into internal table

    Vasanth

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      This is not answer to my question.

      I would like to know how to fill the XML.

      I have fill it the XML with:

      ...

      and so on, but it doesn´t work.

      If someone please can help me or show me how to fill the tags.

      Thanks in advance.

      Jose.

  • author's profile photo Former Member
    Former Member
    Posted on Feb 19, 2007 at 02:17 PM

    Hi,

    REPORT Z_EXCEL_BATCH.

    \* Definitions

    TABLES USR02.

    TYPES XMLLINE(1024) TYPE C.

    DATA IT_XML TYPE XMLLINE OCCURS 0.

    DATA WA_XML TYPE XMLLINE.

    DATA FNAME(60) TYPE C VALUE '/ft/D02/001/test.xls'.

    \* Build-up of xml in internal table

    \*\* Opening tags

    APPEND '<?xml version="1.0"?>' TO IT_XML.

    APPEND '<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"'

    TO IT_XML.

    APPEND 'xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">'

    TO IT_XML.

    APPEND ' <Worksheet ss:Name="Tabelle1">' TO IT_XML.

    APPEND ' <Table>' TO IT_XML.

    \*\* The actual data from table USR02

    SELECT * FROM USR02.

    APPEND ' <Row>' TO IT_XML.

    CONCATENATE ' <Cell><Data ss:Type="String">'

    USR02-BNAME '</Data></Cell>' INTO WA_XML.

    APPEND WA_XML TO IT_XML.

    CONCATENATE ' <Cell><Data ss:Type="String">'

    USR02-TRDAT '</Data></Cell>' INTO WA_XML.

    APPEND WA_XML TO IT_XML.

    APPEND ' </Row>' TO IT_XML.

    ENDSELECT.

    \**Closing tags

    APPEND ' </Table>' TO IT_XML.

    APPEND ' </Worksheet>' TO IT_XML.

    APPEND '</Workbook>' TO IT_XML.

    \* Display of internal table on screen

    LOOP AT IT_XML INTO WA_XML.

    WRITE / WA_XML.

    ENDLOOP.

    Hope this helps.

    Regards,

    Sruthi

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 28, 2007 at 03:31 AM

    hi maria,

    here is the code tht i developed once ..let me know if you have any issue.

    ************************************************************************

    *

    *Program name: Z1SR_LOAD_CANON

    *

    *Description: Program to Load PR from cannon.

    *

    *Date/Author: 29-JUN-05 /syed

    *

    *Table Updates: Listing of tables updated

    *

    *Authority Check - < List if any authority checks in program>

    *

    *Includes:

    ************************************************************************

    * M O D I F I C A T I O N L O G

    ************************************************************************

    • Date Programmer SR # Description

    • ---------- ------------ ---------- -------------------------------

    • 29-JUN-05 syed Proj WWIF New Development

    • 20-SEP-05 syed S0000563 Deley IDOC Creation

    ************************************************************************

    REPORT Z1SR_LOAD_CANON .

    **********************************************************************

    DATA:BEGIN OF IT_FILES OCCURS 0,

    FILENAM LIKE EDI_PATH-PTHNAM,

    END OF IT_FILES.

    ************************************************************************

    • S E L E C T I O N S C R E E N & C R I T E R I A

    ************************************************************************

    PARAMETERS:

    P_INPUT(128) LOWER CASE DEFAULT

    '/usr/sap/ahmo/data/inbound/wwif'.

    • *********************************************************************

    • S T A R T O F S E L E C T I O N *

    • *********************************************************************

    START-OF-SELECTION.

    PERFORM CHECK_BATCH_JOB.

    PERFORM GET_FILE_NAMES.

    PERFORM PROCESS_DATA.

    &----


    *& Form check_batch_job

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM CHECK_BATCH_JOB .

    SELECT COUNT(*) FROM TBTCP WHERE

    PROGNAME EQ SY-REPID AND

    STATUS EQ 'P'.

    IF SY-SUBRC = 0.

    ENDIF.

    ENDFORM. " check_batch_job

    &----


    *& Form get_file_names

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM GET_FILE_NAMES .

    DATA: LOCPARAM(254),

    NAME(30),

    EXTENSION(10).

    DATA STDOUT(256) OCCURS 0 WITH HEADER LINE.

    REFRESH IT_FILES.

    CONCATENATE 'ls -l' P_INPUT INTO LOCPARAM SEPARATED BY SPACE.

    CALL FUNCTION 'RFC_REMOTE_PIPE' DESTINATION 'SERVER_EXEC'

    EXPORTING

    COMMAND = LOCPARAM

    READ = 'X'

    TABLES

    PIPEDATA = STDOUT

    EXCEPTIONS

    SYSTEM_FAILURE = 1

    COMMUNICATION_FAILURE = 2.

    IF SY-SUBRC EQ 0.

    LOOP AT STDOUT.

    IF STDOUT(1) EQ '-'.

    MOVE STDOUT+58 TO IT_FILES-FILENAM.

    SPLIT IT_FILES-FILENAM AT '.' INTO NAME EXTENSION.

    IF EXTENSION = 'xml' OR EXTENSION = 'XML'.

    APPEND IT_FILES.

    ENDIF.

    ENDIF.

    ENDLOOP.

    ENDIF.

    ENDFORM. " get_file_names

    &----


    *& Form process_data

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM PROCESS_DATA .

    CLEAR: IT_FILES.

    LOOP AT IT_FILES.

    PERFORM CONVERT_IDOC USING IT_FILES-FILENAM.

    WAIT UP TO 25 SECONDS.

    ENDLOOP.

    ENDFORM. " process_data

    &----


    *& Form convert_idoc

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM CONVERT_IDOC USING FILENAME.

    DATA LOC_FILENAME LIKE EDI_PATH-PTHNAM.

    CONCATENATE P_INPUT '/' FILENAME INTO LOC_FILENAME SEPARATED BY

    SPACE.

    CONDENSE LOC_FILENAME NO-GAPS.

    CALL FUNCTION 'IDOC_XML_FROM_FILE'

    EXPORTING

    FILE_NAME = LOC_FILENAME

    • EXCEPTIONS

    • FILE_OPEN_FAILED = 1

    • READ_FILE_FAILED = 2

    • FILE_DELETE_FAILED = 3

    • EVENT_CREATE_FAILED = 4

    • PROLOG_ERROR = 5

    • SEGMENT_ERROR = 6

    • TAG_ERROR = 7

    • CONTROL_RECORD_ERROR = 8

    • IDOC_NOT_STORED = 9

    • MARKER_TO_BE_DELETED = 10

    • MARKER_MODIFY_FAILED = 11

    • OTHERS = 12

    .

    IF SY-SUBRC = 0.

    WRITE:/ 'IDOC Created'.

    ELSE.

    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    ENDFORM. " convert_idoc

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 28, 2007 at 07:50 AM

    Hi, what i would like to know is wich format has to be the XML to call the Function Module IDOC_XML_FROM_FILE

    <...>

    <...>

    <...>

    </...>

    ?

    Thanks in advance.

    Add a comment
    10|10000 characters needed characters exceeded

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.