Application Development 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: 

FM to get company code of vendor and customer

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

JozsefSzikszai
Active Contributor
0 Kudos

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

2 REPLIES 2

Former Member
0 Kudos

Hi,

BAPI_COMPANYCODE_GET_PERIOD

HRPP_COMPANYCODE_GET_PERIOD

Regards,

Harish

JozsefSzikszai
Active Contributor
0 Kudos

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