Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

FM to get company code of vendor and customer

is there any fm to retrieve the company code of vendor and customer?I dnt want to retriev the extended company codes, only the company code where it was created first time

Tags:
replied

hi Sia,

I think you have to make a select on table LFB1 (vendors) or KNB1 (customers) and check for the lowest creation date (I guess the field is ERDAT, but I am not sure and cannot check it right now). It will be a something like this:

SELECT bukrs erdat
FROM lfb1
INTO gt_...
WHERE lifnr EQ ....
SORT gt_... BY erdat.
READ TABLE gt_... INTO gw_... INDEX 1.
gw_...-bukrs "This is the Company code you'll need

hope this helps

ec

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question