Skip to Content
-1
Dec 21, 2018 at 05:09 PM

Use IF Condition in FOR Iteration

5337 Views

Hi All, Please help me to understand how to use the IF condition inside a FOR iteration and populate values in ABAP 7.4?

The below is with mix of old and new syntax.

LOOP AT lt_header INTO DATA(lw_header).

TRY.
DATA(lw_status_h) = lt_status_h[ sd_doc = lw_header-doc_number ].
IF lw_status_h-totstatcch = gc_cmgstb.
lw_output_h-cred_stat = gc_cmgsty.
ELSE.
lw_output_h-cred_stat = lw_status_h-totstatcch.
ENDIF.
CATCH cx_sy_itab_line_not_found.
ENDTRY.

ENDLOOP.