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: 

Grouping the segments in an IDOC

0 Kudos

Hello!!!!!

I am creating a custom program which creates an outbound IDOC for the custom Message type say XYZ. In my Custom IDOC Type I have two segments in which one is a parent segment & the other is a child segment. In my program, I am populating the child segment in a loop but when an IDOC is getting created, I see that the two segments are appearing at the same level wherein I am expecting in grouping format i.e one shld be in parent level and the other as a child. So, please can anyone help me achieve this.

Thanks in advance!!!!!

11 REPLIES 11

Former Member
0 Kudos

You IDoc type is not defined properly then. Use TCODE WE30 to check the structure.

0 Kudos

Thank You for the response. I checked my IDOC Type..I dont find any problem with that....

Former Member
0 Kudos

Are you specifying the value for the filed HLEVEL ( I think it is ).

I would just populate SEGNAM and SDATA.

0 Kudos

I just populated SDATA & SEGNAM...Do I have to populate HLEVEL too?

0 Kudos

You shouldn't have to as SAP will handle the hierarcy itself. What FM are you executing to create the IDoc.

And the second segment is definetly a child segment.

Can you post your code.

0 Kudos

Hello!!!!

I am posting the part of code where I am populating the segments!!Kindly have a look at it.

LOOP AT i_mara INTO w_mara.

PERFORM sub_populate_e1edp19.

PERFORM sub_populate_e1edp32.

ENDLOOP.

FORM sub_populate_e1edp19.

e1edp19-qualf = '001'.

e1edp19-idtnr = w_mara-matnr.

CLEAR w_edidd.

w_edidd-segnam = c_e1edp19.

w_edidd-sdata = e1edp19.

APPEND w_edidd TO i_edidd.

ENDFORM. " sub_populate_e1edp19

&----


*& Form sub_populate_e1edp32

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM sub_populate_e1edp32.

READ TABLE i_sum_qty INTO w_sum_qty

WITH KEY matnr = w_mara-matnr

BINARY SEARCH.

IF sy-subrc = 0.

CLEAR: ze1ep32.

ze1ep32-qualf = c_q101.

ze1ep32-quantity = w_sum_qty-tot_qty.

ze1ep32-unit = w_mara-meins.

CLEAR w_edidd.

w_edidd-segnam = c_e1edp32.

w_edidd-sdata = ze1ep32.

APPEND w_edidd TO i_edidd.

ENDIF.

LOOP AT I_QTY_USED INTO W_QTY_USED.

IF W_QTY_USED-MATNR = W_MARA-MATNR.

CLEAR: ze1ep32.

ze1ep32-qualf = c_q102.

ze1ep32-quantity = w_qty_used-menge.

ze1ep32-unit = w_qty_used-meins.

ze1ep32-mblnr = w_qty_used-mblnr.

ze1ep32-ktext = w_qty_used-bktxt.

ze1ep32-zeile = w_qty_used-zeile.

ze1ep32-budat = w_qty_used-budat.

CLEAR w_edidd.

w_edidd-segnam = c_e1edp32.

w_edidd-sdata = ze1ep32.

APPEND w_edidd TO i_edidd.

ENDIF.

ENDLOOP.

LOOP AT I_QTY_RECIEVED INTO W_QTY_RECIEVED.

IF W_QTY_RECIEVED-MATNR = W_MARA-MATNR.

CLEAR: ze1ep32.

ze1ep32-qualf = c_q103.

ze1ep32-quantity = w_qty_recieved-menge.

ze1ep32-unit = w_qty_recieved-meins.

ze1ep32-mblnr = w_qty_recieved-mblnr.

ze1ep32-ktext = w_qty_recieved-bktxt.

ze1ep32-zeile = w_qty_recieved-zeile.

ze1ep32-budat = w_qty_recieved-budat.

CLEAR w_edidd.

w_edidd-segnam = c_e1edp32.

w_edidd-sdata = ze1ep32.

APPEND w_edidd TO i_edidd.

ENDIF.

ENDLOOP.

ENDFORM.

MOVE c_mestyp TO w_edidc-mestyp.

MOVE c_doctyp TO w_edidc-idoctp.

MOVE c_rcvpor TO w_edidc-rcvpor.

MOVE c_rcvprt TO w_edidc-rcvprt.

MOVE c_rcvprn TO w_edidc-rcvprn.

CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'

EXPORTING

master_idoc_control = w_edidc

  • OBJ_TYPE = ''

  • CHNUM = ''

TABLES

communication_idoc_control = i_edidc

master_idoc_data = i_edidd

  • EXCEPTIONS

  • ERROR_IN_IDOC_CONTROL = 1

  • ERROR_WRITING_IDOC_STATUS = 2

  • ERROR_IN_IDOC_DATA = 3

  • SENDING_LOGICAL_SYSTEM_UNKNOWN = 4

  • OTHERS = 5

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

0 Kudos

I see you are doing this.

w_edidd-segnam = c_e1edp32.

should it be

w_edidd-segnam = c_z1edp32.

0 Kudos

I declared c_e1edp32 = 'ze1ep32'. Thats is not the problem.....

0 Kudos

When you look at the IDoc type in WE30. What is the value for Hier.level for both segments.

0 Kudos

E1EDP19 is at hier level 2 , whereas ZE1EP32 is at level 3.

0 Kudos

Hi Nitish,

" I declared c_e1edp32 = 'ze1ep32'. Thats is not the problem..... "

Is it 'ze1ep32'. or 'ZE1EP32'.? or did you mistype it here?

Regards,

Ravi