Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Logic for IDOC_DATA table updation in a loop

Hi All,

Can any body give me the logic for modification of IDOC_DATA table in a loop.

LOOP AT IDOC_DATA.

CASE IDOC_DATA-SEGNAM.

WHEN SEGMENT1.

............................. Some Code

WHEN SEGMENT2.

SEGMENT2 = IDOC_DATA-SDATA.

SEGMENT2-akont = c_akont.

move c_e1 to SEGMENT2-akont+6(2).

  • Here SEGMENT2 is modified

  • Now i want to write a code to modify IDOC_DATA here

  • Can anybody tell me the logic to update IDOC_DATA table for that particular

  • segment

ENDCASE.

ENDLOOP.

Can anybody provide the statements for the same.

I want to write below code in that place:

<b>MOVE SEGMENT2 TO idoc_data-sdata.

MODIFY idoc_data TRANSPORTING sdata.</b>

Can anybody clarify whether above statements are correct (or) any changes required?

Thanks in advance.

Thanks,

Deep.

Tags:
Former Member
replied

Hi,

Please try this.

DATA: ZSEGMENT2 LIKE SEGMENT2.

LOOP AT IDOC_DATA.
  CASE IDOC_DATA-SEGNAM.
     WHEN SEGMENT1.
        ...
 
     WHEN SEGMENT2.
       MOVE IDOC_DATA-SDATA TO ZSEGMENT2.
       MOVE C_AKONT TO ZSEGMENT2-AKONT.
       MOVE C_E1 TO ZSEGMENT2-AKONT+6(2).
       MOVE ZSEGMENT2 TO IDOC_DATA-SDATA.
       MODIFY IDOC_DATA.
 
  ENDCASE.
ENDLOOP.

Regards,

Ferry Lianto

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question