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

Reading data from IDOC segments programatically

Former Member
0 Likes
13,623

Hi,

I must read data from produced idoc.

For example: I have idoc number and i know message type of idoc, i need to read data from inside that idoc.

How can i do that programatically?

Thanks.

Edited by: cml_bzl on Jan 13, 2010 10:28 PM

1 ACCEPTED SOLUTION
Read only

Former Member
5,360

Hi,

Create a custom program having IDOC number parameter on the selection screen. Inside the program call the below mentioned function module which read the idoc data from database into internal table.

      • Read the IDoc detail from the database

CALL FUNCTION 'IDOC_READ_COMPLETELY'

EXPORTING

document_number = p_docnum

IMPORTING

idoc_control = s_edidc

TABLES

int_edidd = itab_edidd

EXCEPTIONS

document_not_exist = 1

document_number_invalid = 2

OTHERS = 3.

Hope this helps.

Thanks!

3 REPLIES 3
Read only

Former Member
5,361

Hi,

Create a custom program having IDOC number parameter on the selection screen. Inside the program call the below mentioned function module which read the idoc data from database into internal table.

      • Read the IDoc detail from the database

CALL FUNCTION 'IDOC_READ_COMPLETELY'

EXPORTING

document_number = p_docnum

IMPORTING

idoc_control = s_edidc

TABLES

int_edidd = itab_edidd

EXCEPTIONS

document_not_exist = 1

document_number_invalid = 2

OTHERS = 3.

Hope this helps.

Thanks!

Read only

0 Likes
5,360

Thanks for your reply,

IDOC_READ_COMPLETELY function does not get data inside segments.

Read only

0 Likes
5,360

Hi,

EDIDD does have the data in string format in field SDATA You have to implement small coding after the FM call.


DATA: wa_e1edk01 TYPE eqedk01,
            wa_segment2 TYPe segment2,
            wa_segment3 TYPE segment3.

SORT ediddtab BY docnum.
LOOP AT ediddtab INTO wa.
CASE wa-segnam.
WHEN 'E1EDK01'.
MOVE wa-sdata TO wa_e1edk01.

WHEn..segment2
MOVE wa-sdata TO wa_segment2

WHEn...segment3
MOVE wa-sdata TO wa_segment3.

ENDCASE.

At END OF docnum.
*Here you have the data in respective work areas.*

ENDAT.

ENDLOOP.

Thanks,

Vinod.