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: 

RE: how to pass data to two different segments idoc function module

Former Member
0 Kudos

Hi,

can anyone plz tell me how to pass data to two different segments idoc function module.

Friends,

i want to pass data to standard function module which genrates idoc.

first field is passed to one segment and remaining fields are passed to other segment.

Thanks,

Sarang

4 REPLIES 4

Former Member
0 Kudos

Hello,

One way you can pass the Data to two different segments is to Loop through the Internal Table that contains data and only move that field which is required for that particular Segment. Then append the Data (Custom Segment) to the IDOC_DATA Internal Table.

Similarly, repeat the above process to append the rest of the Fields to the Second Segment and Append it to IDOC_DATA.

If you have a Custom Program to generate IDocs, call the FM MASTER_IDOC_DISTRIBUTE and pass the IDOC_CONTROL, IDOC_DATA and IDOC_STATUS to it.

Idoc will be automatically generated.

Hope it was helpful.

Thanks and Regards,

Venkat Phani Prasad Konduri

0 Kudos

i am writing a custom program which calls function module ISU_IDOC_INPUT_ISU_EL40

my internal table contains data of both the segments.

plz tell me how to pass data of different segments to idoc_data

0 Kudos

Hello,

Here is how you can append data from your Internal Table to the IDOC_DATA table.

Lets say, your Internal table has a Structure as follows.

Field1 - Should be populated in Segment 1

Field2 - Should be populated in Segment 1

Field3 - Should be populated in Segment 1

Field4 - Should be populated in Segment 2

Field5 - Should be populated in Segment 2

Field6 - Should be populated in Segment 2

Loop at Itab into wa_tab.

clear: wa_Z1Segment1. --> Work Area for Segment 1

  • Field1 to Field3 will be move to the Work Area below

move-corresponding WA_Tab to WA_Z1Segment1.

clear: wa_idoc_data. --> Work Area for IDOC_DATA

move 'Z1SEGMENT1' to Wa_idoc_data-segnam.

Move wa_Z1Segment1 to wa_idoc_data-sdata.

append wa_idoc_data to IDOC_DATA.

clear: wa_idoc_data.

clear: wa_Z1Segment2. --> Work Area for Segment 2

  • Field4 to Field6 will be move to the Work Area below

move-corresponding WA_Tab to WA_Z1Segment2.

clear: wa_idoc_data. --> Work Area for IDOC_DATA

move 'Z1SEGMENT2' to Wa_idoc_data-segnam.

Move wa_Z1Segment1 to wa_idoc_data-sdata.

append wa_idoc_data to IDOC_DATA.

EndLoop.

Hope this is what you wanted to know. Let me know if this is still not clear. If you are still not clear, provide the Structure of the Internal Table along with the Data you want to Pass to the Segments.

Thanks and Regards,

Venkat Phani Prasad Konduri

0 Kudos

Field1 - Should be populated in Segment 1->header segment

Field2 - Should be populated in Segment 2->item

Field3 - Should be populated in Segment 2->item

Field4 - Should be populated in Segment 2>item

do i also need to pass data for idoc_control

i am using ISU_IDOC_INPUT_ISU_EL40 function module