Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

IDOC Data Records

Former Member
0 Likes
686

I have the IDOC Number with me. How to fetch the Data Records from that ?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
600

If you want to read the idoc records in your program:

use the folloing fms:

Sample code:
  CALL FUNCTION 'EDI_DOCUMENT_OPEN_FOR_READ'
    EXPORTING
      document_number = p_docnum
    IMPORTING
      idoc_control    = f_idoc_control
    EXCEPTIONS
      OTHERS          = 01.

  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
            RAISING error_opening_idoc.
  ENDIF.

* Read IDOC data segments
  CALL FUNCTION 'EDI_SEGMENTS_GET_ALL'
    EXPORTING
      document_number = p_docnum
    TABLES
      idoc_containers = t_idoc_data
    EXCEPTIONS
      OTHERS          = 01.

  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
            RAISING error_reading_idoc.
  ENDIF.

* Close IDOC
  CALL FUNCTION 'EDI_DOCUMENT_CLOSE_READ'
    EXPORTING
      document_number = p_docnum
    IMPORTING
      idoc_control    = f_idoc_control
    EXCEPTIONS
      OTHERS          = 01.

  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
            RAISING error_closing_idoc.
  ENDIF.

I have the IDOC Number with me. How to fetch the Data Records from that ?

3 REPLIES 3
Read only

Former Member
0 Likes
600

Hi,

You can achieve this from Tcode WE19 .

Pls reward if helpfull..

Regards,

sharath

Read only

sachin_mathapati
Contributor
0 Likes
600

Hi Manjunath,

From EDID4 table...

Or if you want to view the data records in IDOC u can use WE02 TCODE...

Double click on the IDOC number , and u get the DATA records of the IDOC

Regards,

Sachin M M

Read only

Former Member
0 Likes
601

If you want to read the idoc records in your program:

use the folloing fms:

Sample code:
  CALL FUNCTION 'EDI_DOCUMENT_OPEN_FOR_READ'
    EXPORTING
      document_number = p_docnum
    IMPORTING
      idoc_control    = f_idoc_control
    EXCEPTIONS
      OTHERS          = 01.

  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
            RAISING error_opening_idoc.
  ENDIF.

* Read IDOC data segments
  CALL FUNCTION 'EDI_SEGMENTS_GET_ALL'
    EXPORTING
      document_number = p_docnum
    TABLES
      idoc_containers = t_idoc_data
    EXCEPTIONS
      OTHERS          = 01.

  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
            RAISING error_reading_idoc.
  ENDIF.

* Close IDOC
  CALL FUNCTION 'EDI_DOCUMENT_CLOSE_READ'
    EXPORTING
      document_number = p_docnum
    IMPORTING
      idoc_control    = f_idoc_control
    EXCEPTIONS
      OTHERS          = 01.

  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
            RAISING error_closing_idoc.
  ENDIF.