Hi Ramiwal,
For modifying directly the IDoc segment data in the internal table IDOC_DATA, I find that using field symbols works the best performance wise.
First, you loop through the internal table and assign the current record to a field symbol.
Next, you assign the SDATA portion of the first field symbol to a second field symbol.
When you change the value of any fields in the second field symbol, you directly change the content of the corresponding row in the internal table. This way, you do not need to perform MODIFY statement on the loop or move the SDATA to another work area and back.
Sample code below:
FIELD-SYMBOLS: <lfs_edidd> LIKE LINE OF idoc_data, <lfs_e1edkt1> TYPE e1edkt1, <lfs_e1edkt2> TYPE e1edkt2. "Typed to the segment you want to modify LOOP AT idoc_data ASSIGNING <lfs_edidd>. CASE <lfs_edidd>-segnam. WHEN 'E1EDKT1'. ASSIGN <lfs_edidd>-sdata TO <lfs_e1edkt1> CASTING. "Do something here WHEN 'E1EDKT2'. ASSIGN <lfs_edidd>-sdata TO <lfs_e1edkt2> CASTING. * Modify TDLINE directly CONCATENATE 'XXXXX:' <lfs_e1edkt2>-tdline INTO <lfs_e1edkt2>-tdline. ENDCASE. ENDLOOP.