09-18-2008 1:06 PM
Hi Experts,
Need help in checking if there are any records exist for given VENDOR NUMBER and COMPANY CODE.
in LFB1 table and if result is 0 then giving out error like COMPANY CODE DO NOT EXIST FOR THIS VENDOR NUMBER.
Thanks for all your help.
-Chris.
09-18-2008 1:37 PM
hi,
most effective is to use SELECT COUNT:
SELECT COUNT( * )
FROM LFB1
WHERE lifnr EQ ...
AND bukrs EQ ...
IF sy-subrc EQ 0.
=> there is a vendor for that company code
ELSE.
=> there is no ...
ENDIF.
hope this helps
ec
09-18-2008 1:10 PM
Hi
Records are different in companys.U have 2 check ur company.
All comopanys are having diffent vendor and different company code.
Regards:
Prabu
09-18-2008 1:15 PM
Hi ,
You can use the following function .
SUPO_GET_VENDORID_COMPANYCODE
09-18-2008 1:16 PM
hi
if i am getting it right then u can write like :
select single * from LFB1 where lifnr = <vendor no.> and burks = <comp. code>.
if sy-subrc NE 0.
// write ERROR.
endif.
Regards
Sachin
09-18-2008 1:20 PM
Hi,
In LFB1 table vendor and company code are primary keys, so the records exist for this combination only.
If the result is 0 then it does not mean that the company does not exist. the combination of the record is not existed in the table.
Regards,
Raju.
09-18-2008 1:37 PM
hi,
most effective is to use SELECT COUNT:
SELECT COUNT( * )
FROM LFB1
WHERE lifnr EQ ...
AND bukrs EQ ...
IF sy-subrc EQ 0.
=> there is a vendor for that company code
ELSE.
=> there is no ...
ENDIF.
hope this helps
ec
09-18-2008 4:11 PM