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: 

IDoc - Get Segment Definition or Version in Code

Former Member
0 Kudos

I'm working on the ABAP-PI Port, created a FM based on FM OWN_FUNCTION now.

In my FM, there is a call to a function

CALL FUNCTION 'EDI_SEGMENTS_GET_ALL'

that retrieves all the segment data for a particular IDoc number.

However, it returns only the segment name EDIDD-SEGNAM and not the segment definition.

Example:

Value returned: "E1EDKA1" ( EDIDD-SEGNAM , 27 char long field)

I'm actually looking for the Segment Definition that goes up to 30 characters long.

Value I need to be returned: "E2EDKA1001" - has the extra 3 digits at the end that represents the Version.

If you go to WEDI, Development > IDoc Segments, You can see that the Segment definitions belong to a data type EDISEGDEF (30 characters long).

Does anyone know how I can get this programmatically?

The IDoc file downloaded by the FILE port stores the 30 char Segment Definition in the file

Using the ABAP-PI it only returns the segment name (27 char)

4 REPLIES 4

former_member582701
Contributor
0 Kudos

Hi Kevin,

Try to get the segnam from EDID4 instead of EDIDD. Segnam field of EDID4 table is a char 30. I don't know if version is included but you can try this.

Regards

former_member667836
Active Participant
0 Kudos

Hi,

Query the field SEGDEF in table EDISDEF for getting the segment definition.

reward if helpful

shibu

former_member582701
Contributor
0 Kudos

Yes, i have found it.

Check table EDISDEF. You have the relation between segment and all his versions.

If you need to find the table of a field when you know the field but not the table, like this case, you can use table DD03L in se11. You can try to put SEGDEF in FIELDNAME field and you can see that the result is EDISDEF.

Reward and regards

0 Kudos

Hi all,

Thanks for your replies.

EDISDEF might be useful, but I'm not sure how to use it at the moment.

I am supplied in the code a structure of type EDIDC, which has the following values (not all are listed)

MANDT	C	3 	308
DOCNUM	N	16 	0000000000002050
DOCREL	C	4 	640
STATUS	C	2 	03
DOCTYP	C	8 
DIRECT	C	1 	1
RCVPOR	C	10 	SUBSYSABAP
RCVPRT	C	2 	B

The above represnets a particular IDoc being processed (see DOCNUM and DOCREL)

The default code then uses a FM to get the segment data based on the DOCNUM.

CALL FUNCTION 'EDI_SEGMENTS_GET_ALL'
      EXPORTING
           DOCUMENT_NUMBER         = I_EDIDC-DOCNUM
      TABLES
           IDOC_CONTAINERS         = I_EDIDD
      EXCEPTIONS
           DOCUMENT_NUMBER_INVALID = 1
           END_OF_DOCUMENT         = 2
           OTHERS                  = 3.

Does anyone know of any FM that returns a EDID4 (has 30 char segment version) structure instead of a EDIDD structure (27 char seg def)?

And the value EDIDC-DOCREL (SAP Release for IDoc) e.g.

<b>640</b>

does not match up with values available in EDISDEF-RELEASED (IDoc development: Release of segment definition), e.g.

<b>30F

40A

45A

</b>

How can I find if the segment definitions are

E2EDKA1 or

E2EDKA1001 or

E2EDKA1002 or

E2EDKA1003