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

Duplicating idoc segment

Former Member
0 Likes
884

Dear friends ,

I have to duplicate a segment and all its sub custom segments. For ex E1EDK01 has custom segments ze1edk01 . I want to create an additional E1EDK01 segment which would also contain ze1edk01. Pls help .

Points will be awarded generously .

Thank you

Message was edited by: Alisha Albey

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
717

Could you please elaborate your requirement little more?

General Steps, Assuming that you want to insert the lines under same parent as E1EDK01

1) Loop through IDOC_DATA starting from E1EDK01 and traversing till the last child for that segment..

This can be achieved by checking that HIERLEVEL for subsequent records remain lesser than E1EDK01 heirlevel.

Copy all the records to internal table. Store the SY-TABIX for last record. Add +1 to these value.

Insert the new internal table records at the index value determined above.

If you are doing this within the user exit, there is no need to RENUMBER SEGMENTS.

But if you want to SAVE the IDOC data with new segments, You have to probably develop whole new logic that will renumber the segments.

Dear friends ,

I have to duplicate a segment and all its sub custom segments. For ex E1EDK01 has custom segments ze1edk01 . I want to create an additional E1EDK01 segment which would also contain ze1edk01. Pls help .

Points will be awarded generously .

Thank you

Message was edited by: Alisha Albey

2 REPLIES 2
Read only

Former Member
0 Likes
718

Could you please elaborate your requirement little more?

General Steps, Assuming that you want to insert the lines under same parent as E1EDK01

1) Loop through IDOC_DATA starting from E1EDK01 and traversing till the last child for that segment..

This can be achieved by checking that HIERLEVEL for subsequent records remain lesser than E1EDK01 heirlevel.

Copy all the records to internal table. Store the SY-TABIX for last record. Add +1 to these value.

Insert the new internal table records at the index value determined above.

If you are doing this within the user exit, there is no need to RENUMBER SEGMENTS.

But if you want to SAVE the IDOC data with new segments, You have to probably develop whole new logic that will renumber the segments.

Read only

0 Likes
717

Can you please send me a sample code .

THank you

Alisha