How to compare fields in same column in internal table? ABAP
Example to compare in column A:
col A | col B
A | B
A | A
A | A
B | B
B | B
I would first loop through the contents of your internal table and do my comparison between field 1 and field 2 within the loop. The comparison is done on a row by row level. If the condition is true, I would add my business logic within the IF statement.
LOOP at itab.
IF itab-col1 EQ itab-col2
"Business logic.
ENDIF.
ENDLOOP.
Would this suffice?
field-symbols: <ls_line> type (line structure of itab)
loop at itab assigning <ls_line>.
if <ls_line>-column_a NE <ls_line>-column_b.
write: / sy-tabix, <ls_line>-column_a, <ls_line>-column_b.
endif.
endloop.
sy-tabix will give the line number where there is a difference between the 2 columns.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.