Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Custom Segment Idoc Hierarchy Error

Hi Guys,

I have been asked to create a pick confirmation idoc to be called from within the MB_POST_DOCUMENT exit, using the Master Idoc distribute FM. I am required to add 2 new segments to the existing idoc, which I have done.

My idoc extension is ZSHPCONX based on the DELVRY03 idoc of message type SHPCON. The structure, including my new segments is as follows:

E1EDL20

Z1EDL20X

...

E1EDL24

Z1EDL24X

The extended message type has been added to WE82, against the SHPCON/DELVRY03 message type, and the WE20 output profile has been updated accordingly.

Before I went on leave 10 days ago, everything worked fine. Now, I've added data to the E1EDL37 segment, and I've lost my hierarchy. It now comes out as all at the same level, and this is causing a syntax error on the idoc create.

In WE02 or BD87, the control fields are showing all the necessary data: comparing a successful version of the idoc before my leave to the newly failed version shows all control data is the same.

The E1EDL37 code changes were copied from my existing code, which goes like this:

move 'E1EDL37' to z_idoc_data-segname.
move l_hu to ZE1EDL37-exidv.
move ZE1EDL37 to z_idoc_data-sdata.
append z_idoc_data to IDOC_DATA.
clear z_idoc_data.

I'd be greatful if anyone could point out how I've lost my hierarchy structure. Points will be awarded for a solution to this problem.

Cheers,

Stephen

Former Member
Former Member replied

yes stephan u have handle this logic through coding in user exit

as follows...

LOOP AT idoc_data.

IF idoc_data-segnam = 'E1EDL24'.

g_cnt24 = g_cnt24 + 1.

ENDIF.

ENDLOOP.

LOOP AT idoc_data.

g_itind = sy-tabix.

IF idoc_data-segnam = 'E1EDL24'.

g_cnt = g_cnt + 1.

READ TABLE data-tab_likp INTO lx_likp INDEX 1.

READ TABLE data-tab_lips INTO lx_lips INDEX g_cnt.

READ TABLE data-tab_vbak INTO lx_vbak INDEX 1.

READ TABLE data-tab_vbap INTO lx_vbap INDEX g_cnt.

*************************************************************************

  • Logic for filling E1EDL12 data into proper place *

*************************************************************************

IF g_cnt24 = 1 OR g_cnt = g_cnt24.

g_fapp = 'X'.

ELSE .

g_fins = 'X'.

ENDIF.

IF i_itab_l12 IS NOT INITIAL .

g_insind = g_itind.

LOOP AT i_itab_l12 INTO lx_itab_l12.

INSERT lx_itab_l12 INTO idoc_data INDEX g_insind.

g_insind = g_insind + 1.

ENDLOOP.

CLEAR i_itab_l12[].

ENDIF.

*************************************************************************

  • Processing logic for Delivery Date *

*************************************************************************

idoc_data-segnam = 'E1EDL12'.

w_eiedl12-atinn = '9999999402'.

w_eiedl12-atnam = 'LOBM_LFDAT'.

w_eiedl12-atbez = 'Delivery Date'.

w_eiedl12-atwrt = lx_likp-lfdat.

MOVE w_eiedl12 TO idoc_data-sdata.

IF g_fapp = 'X'.

APPEND idoc_data.

ENDIF.

IF g_fins = 'X'.

APPEND idoc_data TO i_itab_l12.

ENDIF.

maintain two flags one for append if there is no E1EDL37 seg

else it will be insertion after E1EDL12...

regards..

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question