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: 

Update Business partner Grouping field in BUT000 table using BAPI.

Chintu6august
Contributor
0 Kudos

Hello Everyone,

Requirement: to update the BP Grouping field of the Business partners in the table BUT000 using BAPI or FM.

BU_GROUP Business Partner Grouping

I found some Bapi: BAPI_BUPA_CENTRAL_CHANGE and BUPA_CENTRAL_CHANGE but i didn't find any field for BP Group in their structures.

Is there anyway other FM or BAPI to update the same to avoid direct table updates or any enhancement in the above BAPI's where i can update the business group field.

thank you.

1 ACCEPTED SOLUTION

Chintu6august
Contributor

Hello,

i have created Z_BAPI which is copy of BUPA_CENTRAL_CHANGE.

i have added an importing parameter for IM_BU_GROUP for BU_GROUP.

and have pushed the Importing parameter in ls_but000_db-bu_group and it's successfully updating the database table.. Code where i implemented my logic is mentioned below.

      IF NOT iv_partner IS INITIAL.

        CALL FUNCTION 'BUP_BUT000_SELECT_SINGLE'

          EXPORTING

            i_partner    = iv_partner

            i_valdt_sel  = iv_valid_date

            i_cp_exclude = gc_x

          IMPORTING

            e_but000     = ls_but000_db

          EXCEPTIONS

            not_found    = 1

            OTHERS       = 2.

        IF sy-subrc <> 0.

          PERFORM exception_message_store TABLES et_return.

        ELSE.
          if im_bu_partner is not initial.
            ls_but000_db-bu_group = im_bu_group.<<< this where i am pushing value of importing parameter
          endif.
          MOVE-CORRESPONDING ls_but000_db TO ls_but000.

          MOVE-CORRESPONDING ls_but000_db TO ls_but000_old.

        ENDIF.

Since i am going to use this bapi in a custom report in which i will only provide partner number and BP grouping.So i want to know whether my approach is correct or not regarding pushing the data in the structures which are getting populated via 'BUP_BUT000_SELECT_SINGLE' .

or what could be the other options to achieve the same??

thank you!!

9 REPLIES 9

former_member189059
Active Contributor
0 Kudos

I haven't tried it myself, but see if FKK_BUPA_MAINTAIN_SINGLE works.

0 Kudos

Hello,

thanks, i will look into it.

0 Kudos

Hello,

FKK_BUPA_MAINTAIN_SINGLE will not fulfill my requirement since it's specific for FICA and the business partner whose Business Group i want to update are not having contract related role(contract partner).

thank you!!

Chintu6august
Contributor

Hello,

i have created Z_BAPI which is copy of BUPA_CENTRAL_CHANGE.

i have added an importing parameter for IM_BU_GROUP for BU_GROUP.

and have pushed the Importing parameter in ls_but000_db-bu_group and it's successfully updating the database table.. Code where i implemented my logic is mentioned below.

      IF NOT iv_partner IS INITIAL.

        CALL FUNCTION 'BUP_BUT000_SELECT_SINGLE'

          EXPORTING

            i_partner    = iv_partner

            i_valdt_sel  = iv_valid_date

            i_cp_exclude = gc_x

          IMPORTING

            e_but000     = ls_but000_db

          EXCEPTIONS

            not_found    = 1

            OTHERS       = 2.

        IF sy-subrc <> 0.

          PERFORM exception_message_store TABLES et_return.

        ELSE.
          if im_bu_partner is not initial.
            ls_but000_db-bu_group = im_bu_group.<<< this where i am pushing value of importing parameter
          endif.
          MOVE-CORRESPONDING ls_but000_db TO ls_but000.

          MOVE-CORRESPONDING ls_but000_db TO ls_but000_old.

        ENDIF.

Since i am going to use this bapi in a custom report in which i will only provide partner number and BP grouping.So i want to know whether my approach is correct or not regarding pushing the data in the structures which are getting populated via 'BUP_BUT000_SELECT_SINGLE' .

or what could be the other options to achieve the same??

thank you!!

0 Kudos

I did exactly as you did in the copy FM but its not updating the Table. Did I miss something here?

NTeunckens
Active Contributor
0 Kudos

Maybe you can get some pointers looking at FM "BAPI_BUPACRM_MAINTAIN" : there, you can find the FM's used when Creating a NEW Bus.Partner or when Updating one.

Unfortunately, only when having a NEW Bus.Partner the Grouping is taken into account and then it makes use of "BUPA_CREATE_FROM_DATA" ...

... or check this SAP-Wiki on Partner Grouping : link, in which the use of "BUPA_EVENTS" is also suggested ...

0 Kudos

Hello,

i am changing the business partner grouping of existing business partner.

thank you!!

0 Kudos

Just out of curiosity : so you're using "BUPA_CREATE_FROM_DATA" FM or ...?

No, i am using copy of BUPA_CENTRAL_CHANGE with an additional importing parameter for BU_GROUP(BP grouping), since BU_GROUP is not available in any importing structure or tables which are present in the interface of the standard bapi.