‎2007 Jun 20 5:02 AM
hi,
could you hepl me write a sql statement in abap.
internal table itt012 has 5 avlues.
i want to compare hkont of bseg table (BSEG_HKNOT) only starting 9 characters with starting 9 characters of internal table itt012 and delete unmatching.
my query is deleting even the matching records.
could you pls correct it.
LOOP AT itt012 INTO wa_itt012.
DELETE itbseg WHERE hkont0(9) <> wa_itt012-hkont0(9).
ENDLOOP.
‎2007 Jun 20 5:22 AM
data : pat(10).
LOOP AT itt012 INTO wa_itt012.
concatenate wa_itt012-hkont+0(9) '%' into pat
select single * from bseg where hkont like pat.
if sy-subrc ne 0.
DELETE itbseg.
endif.
clear pat.
ENDLOOP.
regards
shiba dutta
‎2007 Jun 20 5:14 AM
declare one (or 5) variable one pass the values of itt012 like variable = itt012+0(9).
Loop at itbseg.
if itbseg-hkont+0(9) ne variable.
delete itbseg.
endif.
endloop.
‎2007 Jun 20 5:17 AM
HI,
There can be 5 records in ITT012
and 100 in BSEG.
for every ITT012 i need to compare with bseg HKNOT+0(9) and delete un matching
Jeff
‎2007 Jun 20 5:17 AM
Hi,
DATA : v_temp(9).
LOOP AT itt012 INTO wa_itt012.
clear v_temp.
MOVE : wa_itt012-hkont to v_temp.
DELETE itbseg WHERE hkont+0(9) NE v_temp.
ENDLOOP.
Don't forget to reward if useful...
‎2007 Jun 20 5:22 AM
data : pat(10).
LOOP AT itt012 INTO wa_itt012.
concatenate wa_itt012-hkont+0(9) '%' into pat
select single * from bseg where hkont like pat.
if sy-subrc ne 0.
DELETE itbseg.
endif.
clear pat.
ENDLOOP.
regards
shiba dutta
‎2007 Jun 20 5:24 AM
Hi,
Try this..
DATA: V_CHAR(9).
LOOP AT itt012 INTO wa_itt012.
V_CHAR = wa_itt012-hkont+0(9).
DELETE itbseg WHERE hkont <> V_CHAR.
ENDLOOP.
Thanks
Naren