Code: Alles auswählen.
SELECT * FROM vdarl INTO TABLE lt_vdarl WHERE gsart = 'REF'.
SELECT * FROM /bhw/tb_rf_or INTO TABLE lt_or WHERE rel_typ =
'REFI'.
LOOP AT lt_vdarl INTO wa_vdarl.
LOOP AT lt_or INTO wa_or WHERE objid_1+4(13) EQ wa_vdarl-ranl.
* WRITE 'Gleich'.
* MESSAGE '2 gleiche gefunden' TYPE 'I'.
APPEND wa_or TO lt_difftab.
ENDLOOP.
IF NOT ( wa_or-objid_1+4(13) = wa_vdarl-ranl ).
LOOP AT lt_or INTO wa_or.
IF ( wa_or-objid_1+4(13) = wa_vdarl-ranl ).
APPEND wa_or TO lt_difftab.
EXIT.
ENDIF.
ENDLOOP.
ENDIF.
ENDLOOP.
Code: Alles auswählen.
DATA: lt_or occurs..., field1, fieldn...objid_1(17),
rest, end of lt_or.
DATA: help_or occurs..., h_objid(13), field1 like
lt_or-field1, fieldn like lt_or-fieldn, rest
like lt_or-rest, end of lt_or.
...
loop at lt_or.
move-corresponding lt_or to help_or.
move lt_or-objid_1+4(13) to help_or-h_objid.
append help_or.
endloop.
Code: Alles auswählen.
sort lt_vdarl by ranl.
sort help_or by h_objid.
Code: Alles auswählen.
data: tabzeile like sy-tabix.
...
loop at lt_vdarl.
read table help_or with key h_objid = lt_vdarl-ranl
binary search.
if sy-subrc = 0. "1. Eintrag gefunden, merken wo
move sy-tabix to tabzeile.
do. "Solange lesen, bis ungleich
read table help_or index tabzeile.
if sy-subrc ne 0. "Index größer als Tabelle
exit.
else.
endif.
if help_or-objid_1 = lt_vdarl-ranl. "Gleich
"Index erhöhen für nächsten Read
compute tabzeile = tabzeile + 1.
append help_or to lt_difftab.
else.
exit. "Ungleich, Schleife verlassen.
endif.
enddo.
else.
"Kein gleicher Eintrag gefunden
endif.
endloop.