简体   繁体   中英

BAPI to get customer company?

Customer company is stored in KNB1 table.

I tried with BAPI_CUSTOMER_GETDETAIL2, seems it does not expose company code. Instead of it, company code is the bapi input.

I am looking for a BAPI that can give company code from given customer number. Is there any bapi existed?

There is no BAPI for that, because what you want to do does not make sense on a conceptual level. A customer does not have a company code. A customer can have company code specific data for any number of company codes. When there is a n..1 relationship between customers and company codes in your system, then that's something unique to how your organization uses it. On a technical level, the relationship is n..m .

But if you want a table of all company codes (BUKRS) which have data for a specific customer (KUNNR), you can do that with a simple SQL statement:

SELECT bukrs FROM knb1 INTO TABLE @lt_bukrs WHERE kunnr = @lv_kunnr.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM