cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BAPI/FM for adding new company code for business partner "BP"

Former Member
0 Likes
10,644

Hello experts,

I'm wondering is there any BAPI/FM for adding new company code for business partner "BP" ?

Accepted Solutions (0)

Answers (2)

Answers (2)

chamuk
Explorer
0 Likes

we have standard classes to do this job.

vmd_ei_api --> method name as maintain_bapi for BP as vendor.

cmd_ei_api --> method name as maintain_bapi for BP as customer.

mmcisme1
Active Contributor
0 Likes

Well I used the following function modules:

DMC_INCL_RETURN_SIF_CUSTOMER

Extend by organization levels

RFC_CVI_EI_INBOUND_MAIN

The package is:

MD_BP_MAINTAIN - There are other options here

Former Member

Hi Michelle, I appreciate your kind support but i could not find FM with this name "DMC_INCL_RETURN_SIF_CUSTOMER"

mmcisme1
Active Contributor
0 Likes

Sorry about that RFC_CVI_EI_INBOUND_MAIN is the function module for both extend and create.

Former Member
0 Likes

c436ae948d684935a91fce8b976e5aa7 no problem,
I used the function module RFC_CVI_EI_INBOUND_MAIN and it works fine for adding new BP Role
But in case of adding new company it does not work and returns this error "Task Insert is not supported for the existing customer"
although i can add new company easily for the same business partner through "t.code BP ".

here is the part of code

DATA :IT_BP_GENERAL Type table of CVIS_BP_GENERAL,
 IT_BP_ROLE Type table of CVIS_BP_ROLE,
 CT_RETURN Type table of CVIS_BP_RETURN,
 IT_CUST_COMPANY Type table of CVIS_CUSTOMER_COMPANY,
 IT_CUST_GENERAL Type table of CVIS_CUSTOMER_GENERAL .
DATA :wa_BP_GENERAL Type CVIS_BP_GENERAL, wa_BP_ROLE Type CVIS_BP_ROLE, wa_RETURN Type CVIS_BP_RETURN, wa_cust_COMPANY Type CVIS_CUSTOMER_COMPANY, wa_CUST_GENERAL Type CVIS_CUSTOMER_GENERAL .
wa_bp_general-BPARTNER = wa_but000-PARTNER. wa_bp_general-BPARTNERGUID = wa_but000-PARTNER_GUID. wa_bp_general-OBJECT_TASK = 'U'. wa_bp_general-RUN_ID = '1'. append WA_BP_GENERAL to IT_BP_GENERAL.
wa_BP_ROLE-DATA_KEY = p_roles. wa_BP_ROLE-RUN_ID = '1'. append wa_BP_ROLE to IT_BP_ROLE.
wa_CUST_GENERAL-RUN_ID = '1'. wa_CUST_GENERAL-KUNNR = wa_but000-PARTNER. append wa_CUST_GENERAL to IT_CUST_GENERAL.
wa_cust_COMPANY-BUKRS = S_COMP-low. wa_cust_COMPANY-AKONT = s_SAKNR-LOW. wa_cust_COMPANY-RUN_ID = '1'. append wa_cust_COMPANY to IT_CUST_COMPANY.
Break-point.
CALL FUNCTION 'RFC_CVI_EI_INBOUND_MAIN' EXPORTING IV_DOCOMMIT = 'X' * IV_CREATE_APPLOG = * IV_SUPPRESS_TAXJUR_CHECK = TABLES IT_BP_GENERAL = IT_BP_GENERAL IT_BP_ROLE = IT_BP_ROLE * IT_BP_INDUSTRY = * IT_BP_IDENT_NUMBERS = * IT_BP_BANK_DETAILS = * IT_BP_TAX_NUMBER = * IT_BP_TAX_NUMBER_COMMON = * IT_BP_ADDRESS = * IT_BP_ADDRESS_USAGE = * IT_BP_ADDRESS_TELENO = * IT_BP_ADDRESS_FAXNO = * IT_BP_ADDRESS_EMAIL = * IT_BP_ADDRESS_URI = * IT_BP_RELATIONS = * IT_CUST_GENERAL = IT_CUST_COMPANY = IT_CUST_COMPANY * IT_CUST_SALES = * IT_CUST_COMP_DUNNING = * IT_CUST_SALES_FUNCTIONS = * IT_CUST_TAX_INDICATOR = * IT_CUST_GENERAL_VAT = * IT_SUP_GENERAL = * IT_SUP_COMPANY = * IT_SUP_COMPANY_WTAX = * IT_SUP_PURCHASING = * IT_SUP_GENERAL_VAT = CT_RETURN = CT_RETURN . CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
mmcisme1
Active Contributor
0 Likes

wa_bp_general-BPARTNERGUID = wa_but000-PARTNER_GUID.

I did not add the GUID - but I don't think that was the issue.

Are you including the leading 0s in your s_SAKNR-LOW and S_COMP-low?

The other thing I can think of is did you check the run id?

Example:

The new customer Smith & Co (RUN_ID 1) with his new default contact Mr. Smith (RUN_ID 2) shall be replicated via the RFC.

The following tables show the necessary entries to replicate both new Business Partners and the relationship between Smith & Co and Mr. Smith.

Import table IT_BP_GENERAL:

RUN ID BPPARTNER Category1 Smith & Co 2 (Organization)2 Mr. Smith 1 (Person)

Import table IT_BP_ROLE:

RUN ID Data_Key1 FLCU01 (Customer)2 BUP001(Contact)

Import table IT_BP_RELATIONS :

RUN ID PARTNER1 PARTNER2 RELAT_Category1 Smith & Co Mr. Smith BUR0011 Smith & Co …BUR001
Former Member
0 Likes
Are you including the leading 0s in your s_SAKNR-LOW and S_COMP-low?

Yes.

The other thing I can think of is did you check the run id?
Example:
The new customer Smith & Co (RUN_ID 1) with his new default contact Mr. Smith (RUN_ID 2) shall be replicated via the RFC.
The following tables show the necessary entries to replicate both new Business Partners and the relationship between Smith & Co and Mr. Smith.
Import table IT_BP_GENERAL:
RUN ID BPPARTNER Category1 Smith & Co 2 (Organization)2 Mr. Smith 1 (Person)Import table IT_BP_ROLE:
RUN ID Data_Key1 FLCU01 (Customer)2 BUP001(Contact)Import table IT_BP_RELATIONS :
RUN ID PARTNER1 PARTNER2 RELAT_Category1 Smith & Co Mr. Smith BUR0011 Smith & Co …BUR001

I'm not sure that i understood what you mean correctly.
I do not want to add relation, I want to add company code to existing business partner.
I assume that run ID is some number (index/id) to distinguish between business partners instances used only on program run time but it has no impact on the data base.

I think my problem related to "IT_CUST_COMPANY".