[英]Abap: Select the same field from two db tables into one column of the internal table with one select
[英]How to compare two fields in same column in internal table? ABAP
如何比較內部表中同一列中的字段? ABAP
在 A 列中進行比較的示例:
col A | col B
A | B
A | A
A | A
B | B
B | B
我將首先遍歷內部表的內容,並在循環中的字段 1 和字段 2 之間進行比較。 比較是逐行進行的。 如果條件為真,我會在 IF 語句中添加我的業務邏輯。
LOOP at itab.
IF itab-col1 EQ itab-col2
"Business logic.
ENDIF.
ENDLOOP.
這樣就夠了嗎?
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 將給出兩列之間存在差異的行號。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.