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

Populating IDOC child segment

Former Member
0 Likes
1,418

Hi All,

I am using HRMD_A message Type IDOC type HRMD_A06.I have added a child segment under Segment E1P0105.

I want to populate the child segment with data from z field in PA0105.

Please tell me how do I do this?

In which user exit do i write the required code?

Regards,

Rahul

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
767

Hi,

For inbound IDoc, you can use user exits EXIT_SAPLRHA0_003 of FM IDOC_INPUT_HRMD.

For outbound IDoc, you can use user exits EXIT_SAPLRHA0_001 of FM RH_MASTER_IDOC_DISTRIBUTE_HRMD.

Please try something like this for inbound IDoc.


...

DATA: WA_E1P0105 LIKE E1P0105,
      L_IDX TYPE i.

CHECK IDOC_CONTRL-DOCTYP = 'HRMD_A06'.

LOOP AT IDOC_DATA.
  CASE IDOC_DATA-SEGNAM.
    WHEN ' E1P0105'.
      MOVE: IDOC_DATA-SDATA TO WA_E1P0105,
            <zfield> TO WA_E1P0105-<segment name>,
            WA_E1P0105 TO IDOC_DATA-SDATA.
      DESCRIBE TABLE IDOC_DATA LINES L_IDX.
      MODIFY IDOC_DATA INDEX L_IDX.
  ENDCASE. 
ENDLOOP.

...

For outbound IDoc, please replace IDOC_CONTRL with T_COMM_CONTROL and IDOC_DATA with T_IDOC_DATA.

Regards,

Ferry Lianto

Hi All,

I am using HRMD_A message Type IDOC type HRMD_A06.I have added a child segment under Segment E1P0105.

I want to populate the child segment with data from z field in PA0105.

Please tell me how do I do this?

In which user exit do i write the required code?

Regards,

Rahul

2 REPLIES 2
Read only

Former Member
0 Likes
768

Hi,

For inbound IDoc, you can use user exits EXIT_SAPLRHA0_003 of FM IDOC_INPUT_HRMD.

For outbound IDoc, you can use user exits EXIT_SAPLRHA0_001 of FM RH_MASTER_IDOC_DISTRIBUTE_HRMD.

Please try something like this for inbound IDoc.


...

DATA: WA_E1P0105 LIKE E1P0105,
      L_IDX TYPE i.

CHECK IDOC_CONTRL-DOCTYP = 'HRMD_A06'.

LOOP AT IDOC_DATA.
  CASE IDOC_DATA-SEGNAM.
    WHEN ' E1P0105'.
      MOVE: IDOC_DATA-SDATA TO WA_E1P0105,
            <zfield> TO WA_E1P0105-<segment name>,
            WA_E1P0105 TO IDOC_DATA-SDATA.
      DESCRIBE TABLE IDOC_DATA LINES L_IDX.
      MODIFY IDOC_DATA INDEX L_IDX.
  ENDCASE. 
ENDLOOP.

...

For outbound IDoc, please replace IDOC_CONTRL with T_COMM_CONTROL and IDOC_DATA with T_IDOC_DATA.

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
767

HI,

First you have to add the child segement to the idoc type.

For this go to we30 and go to the idoc type required.

Then place the cursor on the segment for which you want to create the child segement and press the <b>create</b> icon then select the radio button add <b>segment type as child</b>.In this way you can add child segement to your segement.

In idoc after every segement filling we have a user-exit.You have to find the user-exit and in this user-exit you have to write the code to fill the child segement.

Thanks and regards,

shyla