Skip to Content
0

Creating Customer and Vendor Master from Business Partner in S/4 HANA.

Apr 09, 2017 at 02:44 PM

1.7k

avatar image
Former Member

Hi Experts,

I have created Business Partner using BAPI_BUPA_CREATE_FROM_DATA.Also assigned role to it using BAPI_BUPA_ROLE_ADD_2. Now I have to create Customer and Vendor. Please guide how to achieve this!

Any help is highly appreciated.

Regards,

Harsh.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

5 Answers

Best Answer
pradeep reddy Apr 10, 2017 at 04:13 AM
0

Hi Harsha,

I have created BP using BAPI_BUPA_FS_CREATE_FROM_DATA2, in that I passed vendor/ customer roles in table parameter roles to link BP.

system automatically created vendor/customer based on roles(put break point VMD_EI_API=>MAINTAIN). After successfull creation of BP with vendor/customer roles, extend company code details/vendor details by using VMD_EI_API=>MAINTAIN_BAPI. For customer use CMD_EI_API=>MAINTAIN_BAPI.

Regards,

K.Pradeep Reddy.

Show 3 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Thank You Pradeep. Could you please elaborate on this part..break point VMD_EI_API=>MAINTAIN. OR, Could you provide a code snippet for the same.

Regards,

Harsh.

0
Former Member

good job , i finished successfully as Pradeep said .

0

Hi Dear,

I am getting one error "Field: TASK, value: is not permitted" in the VMD_EI_API=>MAINTAIN_BAPI method.

I have tried with task 'I','U' and 'M'. Please suggest.

0
avatar image
Former Member Jun 28, 2017 at 12:13 PM
1

I not found any direct BAPI to create data in LFB1 and LFM1 , currently Purchase and Company view, but there is a exit in BP creation that is called in BP transaction and 'BUPA_CREATE_FROM_DATA'. So, I did the following steps to create these two structure.

1) Create a enhancement based on CVI_CUSTOM_MAPPER method IF_EX_CVI_CUSTOM_MAPPER~MAP_VENDOR_TO_BP, this BADI is called at save moment of customer. The content is very simply. Call Z methods into exit:

TRY .

zcl_bc0001_bp_update=>get_purchansing( CHANGING cs_structure = c_vendor ).

zcl_bc0001_bp_update=>get_company( CHANGING cs_structure = c_vendor ).

CATCH cx_root.

ENDTRY.

2) Define the zcl_bc0001_bp_update class and methods get_company and get_purchansing

METHOD get_purchansing.

IF gs_purchasing_data IS NOT INITIAL.

cs_structure-purchasing_data = gs_purchasing_data.

ENDIF.

ENDMETHOD.

METHOD get_company.

IF gs_company_data IS NOT INITIAL.

cs_structure-company_data = gs_company_data.

ENDIF.

ENDMETHOD.

3) Define methods create_bupa_purchase_company( ) . This method set global structures gs_company_data and gs_purchasing_data

METHOD create_bupa_purchase_company.

DATA: t_purchasing TYPE vmds_ei_purchasing_t.

DATA: w_purchansing TYPE vmds_ei_purchasing.

DATA: t_company TYPE vmds_ei_company_t.

DATA: w_company TYPE vmds_ei_company.

"Purchase

w_purchansing-task = 'M'.

w_purchansing-data_key = 'AAAA'.

w_purchansing-data-waers = 'USD'.

w_purchansing-data-zterm = '0001'.

w_purchansing-datax-waers = 'X'.

w_purchansing-datax-zterm = 'X'.

w_purchansing-datax = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'.

APPEND w_purchansing TO t_purchasing.

gs_purchasing_data-purchasing = t_purchasing.

"Company

w_company-task = 'M'.

w_company-data_key = 'XXXX'.

w_company-data-akont = '2101309999'.

w_company-data-zwels = 'D'.

w_company-data-zterm = '0001'.

w_company-data-zuawa = '000'.

w_company-data-reprf = 'X'.

w_company-datax-reprf = 'X'.

w_company-datax-akont = 'X'.

w_company-datax-zwels = 'X'.

w_company-datax-zterm = 'X'.

w_company-datax-reprf = 'X'.

w_company-datax = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'.

APPEND w_company TO t_company.

gs_company_data-company = t_company.

ENDMETHOD.

4) Final step, call BAPI 'BUPA_CREATE_FROM_DATA', our method create_bupa_purchase_company( ) and so 'BAPI_TRANSACTION_COMMIT'. Our method set the golbal static gs_purchasing_data and gs_company_data defined as attribute in zcl_bc0001_bp_update,

GS_PURCHASING_DATA Static AttributePrivateTypeVMDS_EI_VMD_PURCHASING

GS_COMPANY_DATA Static AttributePrivateTypeVMDS_EI_VMD_COMPANY

and in bapi_transaction_commit our enhacement is called before save BP data. Basically, we will replace the value of c_vendor structure, which come empty, for our values in gt_ structures.

Regards.

Wagner Baldi.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Dear,

I am getting one error "Field: TASK, value: is not permitted" in the VMD_EI_API=>MAINTAIN_BAPI method.

I have tried with task 'I','U' and 'M'. Please suggest.

0
Ketan Lokhande Sep 13, 2017 at 07:23 AM
0

Hi ...

It has been resolved !!

We need to update the task in Header also then it will work.

regards,

Bhupendra Singh

Share
10 |10000 characters needed characters left characters exceeded
Ketan Lokhande Sep 13, 2017 at 07:23 AM
0

Hi ...

It has been resolved !!

We need to update the task in Header also then it will work.

regards,

Bhupendra Singh

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Mar 28 at 02:32 PM
0

Hi all,

Can anyone please provide me the code to convert Business partner to Customer using FM '

'BUPA_CREATE_FROM_DATA'. My requirement is to change the change general business partner to customer(MKK role) through coding.

Thanks

sub

Share
10 |10000 characters needed characters left characters exceeded