Skip to Content
avatar image
Former Member

Exporting a IDOC into a xml file

Hi,

My requirement is to export inbound IDOC from the SAP system to a xml file. I have a xml port defined in the system and when I try exporting the IDOC to xml filethe file is gettin created whereas the segment data is not getting transported to the xml file.

Please let me know the procedure to do the same.

Thanks & Regards,

Bhuvaneswari.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Oct 11, 2007 at 02:32 PM

    hi,

    chk out this,

    report zexternalfile .

    tables : zzpublisher,

    sscrfields.

    data: it_publisher like standard table of zzpublisher,

    wa_publisher like zzpublisher.

    select * from zzpublisher into table it_publisher.

    call function 'GUI_DOWNLOAD'

    exporting

    • BIN_FILESIZE =

    filename = 'C:\externalfiles\kamal.XLS'

    • FILETYPE = 'ASC'

    • APPEND = ' '

    write_field_separator = 'X'

    • HEADER = '00'

    • TRUNC_TRAILING_BLANKS = ' '

    • WRITE_LF = 'X'

    • COL_SELECT = ' '

    • COL_SELECT_MASK = ' '

    • DAT_MODE = ' '

    • IMPORTING

    • FILELENGTH =

    tables

    data_tab = it_publisher

    • EXCEPTIONS

    • FILE_WRITE_ERROR = 1

    • NO_BATCH = 2

    • GUI_REFUSE_FILETRANSFER = 3

    • INVALID_TYPE = 4

    • NO_AUTHORITY = 5

    • UNKNOWN_ERROR = 6

    • HEADER_NOT_ALLOWED = 7

    • SEPARATOR_NOT_ALLOWED = 8

    • FILESIZE_NOT_ALLOWED = 9

    • HEADER_TOO_LONG = 10

    • DP_ERROR_CREATE = 11

    • DP_ERROR_SEND = 12

    • DP_ERROR_WRITE = 13

    • UNKNOWN_DP_ERROR = 14

    • ACCESS_DENIED = 15

    • DP_OUT_OF_MEMORY = 16

    • DISK_FULL = 17

    • DP_TIMEOUT = 18

    • FILE_NOT_FOUND = 19

    • DATAPROVIDER_EXCEPTION = 20

    • CONTROL_FLUSH_ERROR = 21

    • OTHERS = 22

    .

    if sy-subrc <> 0.

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

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

    endif.

    Regards,

    Siva

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 11, 2007 at 02:33 PM

    hi,

    chk out this,

    report zexternalfile .

    tables : zzpublisher,

    sscrfields.

    data: it_publisher like standard table of zzpublisher,

    wa_publisher like zzpublisher.

    select * from zzpublisher into table it_publisher.

    call function 'GUI_DOWNLOAD'

    exporting

    • BIN_FILESIZE =

    filename = 'C:\externalfiles\kamal.XLS "<----


    export in xml *format

    • FILETYPE = 'ASC'

    • APPEND = ' '

    write_field_separator = 'X'

    • HEADER = '00'

    • TRUNC_TRAILING_BLANKS = ' '

    • WRITE_LF = 'X'

    • COL_SELECT = ' '

    • COL_SELECT_MASK = ' '

    • DAT_MODE = ' '

    • IMPORTING

    • FILELENGTH =

    tables

    data_tab = it_publisher

    • EXCEPTIONS

    • FILE_WRITE_ERROR = 1

    • NO_BATCH = 2

    • GUI_REFUSE_FILETRANSFER = 3

    • INVALID_TYPE = 4

    • NO_AUTHORITY = 5

    • UNKNOWN_ERROR = 6

    • HEADER_NOT_ALLOWED = 7

    • SEPARATOR_NOT_ALLOWED = 8

    • FILESIZE_NOT_ALLOWED = 9

    • HEADER_TOO_LONG = 10

    • DP_ERROR_CREATE = 11

    • DP_ERROR_SEND = 12

    • DP_ERROR_WRITE = 13

    • UNKNOWN_DP_ERROR = 14

    • ACCESS_DENIED = 15

    • DP_OUT_OF_MEMORY = 16

    • DISK_FULL = 17

    • DP_TIMEOUT = 18

    • FILE_NOT_FOUND = 19

    • DATAPROVIDER_EXCEPTION = 20

    • CONTROL_FLUSH_ERROR = 21

    • OTHERS = 22

    .

    if sy-subrc <> 0.

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

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

    endif.

    Regards,

    Siva

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 11, 2007 at 03:20 PM

    Check this tutorial on converting IDOCs to XML (no coding required):

    http://www.saptechnical.com/Tutorials/ALE/IDOCToXML/IDOCToXML.htm

    Add comment
    10|10000 characters needed characters exceeded