‎2005 Dec 23 7:43 AM
I have a table which has following fields:
X1 TABLE (ZCONfig table) X2 TABLE: (Internal table)
LIFNR land1 LIFNR:
123 br 234
234 br 567
456 br 123
567 Gr
Now I want to see if all the field values of LIFNR in internal table X2 (X2-LIFNR) are present in X1 or not.
Raise error if it is not.
How do I do this using SQL ? I guess I have to use read statement.
Please help. Points will be awarded.
Thanks.
Regards
‎2005 Dec 23 7:50 AM
select *
from ztable
into table it_ztable.
if sy-subrc = 0.
loop at it_x2table.
read table it_ztable with key lifnr = it_x2table-lifnr.
if sy-subrc <> 0.
raise error.....
endif.
endloop.
endif.
‎2005 Dec 23 9:30 AM
Hi,
As Vijay suggested,you can do.But with slight modififcation.Instead of raising error message every time,just collect the error message in an internal table and then display it finally.That will be good.
types : begin of ty,
message(20) type c,
end of ty.
data : itab type standard table of ty,
wa type ty.
select *
from ztable
into table it_ztable.
if sy-subrc = 0.
loop at it_x2table.
read table it_ztable with key lifnr = it_x2table-lifnr.
if sy-subrc <> 0.
concatenate it_x2table-lifnr not present ' into wa-message.
append wa to itab.
endif.
endloop.
endif.
loop at itab into wa.
write : / wa-message.
endloop.