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

read idoc data

Former Member
0 Likes
3,473

Hi All,

can anybody tell me how to read segment data (sdata) of idoc.

is there any function module available for that ?

its urgent..

Regards,

Rahul

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,570

Hi Rahul,

you have to read the value as in a table.

Please hava a look at the following example (DATA has the structure EDID4):


DATA:
    lw_E1MARAM TYPE E1MARAM,
    l_matnr TYPE E1MARAM-MATNR.

     LOOP AT data WHERE segnam EQ 'E1MARAM'.
     
        MOVE data-sdata TO lw_E1MARAM.
        l_matnr = lw_E1MARAM-MATNR.
      ENDLOOP.

Kind Regards,

Sergio

5 REPLIES 5
Read only

Former Member
0 Likes
1,571

Hi Rahul,

you have to read the value as in a table.

Please hava a look at the following example (DATA has the structure EDID4):


DATA:
    lw_E1MARAM TYPE E1MARAM,
    l_matnr TYPE E1MARAM-MATNR.

     LOOP AT data WHERE segnam EQ 'E1MARAM'.
     
        MOVE data-sdata TO lw_E1MARAM.
        l_matnr = lw_E1MARAM-MATNR.
      ENDLOOP.

Kind Regards,

Sergio

Read only

Former Member
0 Likes
1,570

Hi,

You can use the FM IDOC_READ_COMPLETELY

Thanks,

Naren

Read only

former_member187255
Active Contributor
0 Likes
1,570

Did u try this FM <b>IDOC_READ_COMPLETELY</b>

Read only

Former Member
0 Likes
1,570

Hi,

you can try with this program:

don't forget to include the "TYPE-POOLS ledid." line at the begining, this is the reason why you are receiving the error message.

REPORT ztestdpo2 .

TYPE-POOLS LEDID.

PARAMETERS: p_segtyp LIKE edisegmhd-segtyp.

DATA t_segment_struct TYPE ledid_t_segment_struct.

DATA wa_segment_struct LIKE LINE OF t_segment_struct.

CALL FUNCTION 'IDOC_SEGMENT_STRUCTURE_READ'

EXPORTING

  • RELEASE = SY-SAPRL

segtyp = p_segtyp

  • VERSION = '3'

TABLES

segment_struct = t_segment_struct

EXCEPTIONS

segment_unknown = 1

segment_structure_unknown = 2

segment_not_in_release = 3

OTHERS = 4

.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

LOOP AT t_segment_struct INTO wa_segment_struct.

WRITE:/ wa_segment_struct.

ENDLOOP

Regards

Read only

Former Member
0 Likes
1,570

Hi,

You can read the control data of IDOC from function module : EDI_DOCUMENT_OPEN_FOR_READ.

And can read IDOC Data from Function module :

EDI_SEGMENTS_GET_ALL. It will return you the internal table of IDOC data , you will have to iterate on this to get the segment infomation that you want .

Regards,

Deepti