10-20-2016 1:56 PM - edited 01-21-2024 9:54 PM
Hello,
I am looking for best way for: how to find correct index to insert new segment into IDOC data (table of EDIDD) in user exit.
NOTE: I do not want change IDOC structure (WE30). I want to change data of specific IDOC.
Example
IDOC structure:
SEGMENT_TYPE LEVEL MANDATORY MULTIPLE
A 1 yes no
|- B 2 no yes
|- C 2 no yes
|- D 3 no yes
|- E 2 no yes
I want insert segment of type C and have ready IDOC data (EDIDD itab). Is there any trick to find correct index of itab? Because now I have to programmatically check:
Hope you get idea, and this IDOC structure is only example. Real is more comlicated.
10-21-2016 9:27 PM
It depends on the specific IDoc and data in it. There is no simple, one-size-fits-all solution. Usually it's just trial and error. Run different IDocs through debugger and see if there is some pattern, etc. Lots of fun.
But you are correct that a custom segment is a more proper way to solve such issues.
10-21-2016 2:54 PM
I resolved this with "workaround":
- created IDOC extension + new Z segment and inserted it into IDOC data in user exit
It is actually more proper way to solve this. But I am still interested if there is any way to solve original problem (inserting standard segment)?
10-21-2016 9:27 PM
It depends on the specific IDoc and data in it. There is no simple, one-size-fits-all solution. Usually it's just trial and error. Run different IDocs through debugger and see if there is some pattern, etc. Lots of fun.
But you are correct that a custom segment is a more proper way to solve such issues.