Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Regading Internal Table

Former Member
0 Likes
666

Hi.

How to check whether vendor from an internal table exists in lfa1 or not?

1 ACCEPTED SOLUTION
Read only

aris_hidalgo
Contributor
0 Likes
638

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...

6 REPLIES 6
Read only

Former Member
0 Likes
638

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.

Read only

dhruv_shah3
Active Contributor
0 Likes
638

Hi,

If you are filling the data in the internal table thts come only from SAP standard table.....

Regards,

Dhruv Shah

Read only

0 Likes
638

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?

Read only

Former Member
0 Likes
638

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

Read only

Former Member
0 Likes
638

Hi

open se11 or se16 and give table name as lfa1.then press on contents icon and give that vendor number then execute.

Read only

aris_hidalgo
Contributor
0 Likes
639

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...