‎2008 Mar 07 5:11 AM
Hi.
How to check whether vendor from an internal table exists in lfa1 or not?
‎2008 Mar 07 5:32 AM
Hi,
Lets say your internal table that stores the vendor code is named
GT_VENDOR. Now, what you want to do is to select from LFA1 based from
the records in GT_VENDOR.
Example:
if gt_vendor[] is not initial.
select lifnr
from lfa1
into table gt_lfa1
for all entries in gt_vendor
where lifnr = gt_vendor-lifnr.
endif.
Now loop through your gt_vendor table.
loop at gt_vendor into wa_vendor.
read table gt_lfa1 into wa_lfa1
with key lifnr = wa_vendor-lifnr.
if sy-subrc <> 0.
wa_error-lifnr = wa_vendor-lifnr.
append wa_error to gt_error.
endif.
endloop.
In the loop above, all vendor code(LIFNR) that is not existing in
gt_lfa1 is moved to your error table which is GT_ERROR.
Hope it helps...
P.S. Please award points if it helps...
‎2008 Mar 07 5:17 AM
Hi,
Take your internal table vendor no and go to se16,
provide in the table input lfa1,
execute,
give your internal table vendore no in the selection screen,
execute,
this is how u come to know.
anyhow that data u r getting from sap database tables only know!
seshu.
‎2008 Mar 07 5:18 AM
Hi,
If you are filling the data in the internal table thts come only from SAP standard table.....
Regards,
Dhruv Shah
‎2008 Mar 07 5:22 AM
Hi Seshu.
Thnx for the answer.
But my exact requirement is i want to retrive the non-matching records of my internal table with the records in lfa1 and populate them in error_itab.
Could u plz let me know how to proceed?
‎2008 Mar 07 5:20 AM
Hi
Open SE11 or SE16 and give table LFA1 and give the vendor that you are going to check.
It will open the record if exits.
Hope its Useful...
Kota
‎2008 Mar 07 5:24 AM
Hi
open se11 or se16 and give table name as lfa1.then press on contents icon and give that vendor number then execute.
‎2008 Mar 07 5:32 AM
Hi,
Lets say your internal table that stores the vendor code is named
GT_VENDOR. Now, what you want to do is to select from LFA1 based from
the records in GT_VENDOR.
Example:
if gt_vendor[] is not initial.
select lifnr
from lfa1
into table gt_lfa1
for all entries in gt_vendor
where lifnr = gt_vendor-lifnr.
endif.
Now loop through your gt_vendor table.
loop at gt_vendor into wa_vendor.
read table gt_lfa1 into wa_lfa1
with key lifnr = wa_vendor-lifnr.
if sy-subrc <> 0.
wa_error-lifnr = wa_vendor-lifnr.
append wa_error to gt_error.
endif.
endloop.
In the loop above, all vendor code(LIFNR) that is not existing in
gt_lfa1 is moved to your error table which is GT_ERROR.
Hope it helps...
P.S. Please award points if it helps...