Application Development 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: 

Retrieve IDoc Segment Format

Former Member
0 Kudos

I am using the SAP function IDOC_SEGMENT_STRUCTURE_READ to retrieve the structure of an IDoc segment. This function returns a table SEGMENT_STRUCT of type LEDID_T_SEGMENT_STRUCT.

When I call this function from my ABAP function, I am using the following definition for the table I am sending to IDOC_SEGMENT_STRUCTURE_READ:


Data: lt_segstru type table of LEDID_T_SEGMENT_STRUCT.

I am using the same type in my internal function as is used in the SAP function, but when I try to activate my function, I am receiving the following error:

The type "LEDID_T_SEGMENT_STRUCT" is unknown.	

I see that LEDID_T_SEGMENT_STRUCT points to the type group of LEDID. How do I write my table definition in my calling function to match the format of the table returned in IDOC_SEGMENT_STRUCTURE_READ?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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.

Saludos

Daniel

2 REPLIES 2

Former Member
0 Kudos

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.

Saludos

Daniel

Former Member
0 Kudos

In your TOP include, add the following statement.

TYPE-POOLS LEDID.