Skip to Content
author's profile photo Former Member
Former Member

BAPI_BUPA_ROLE_ADD_2 - Add role To partner

Hi,

I am using BAPI "BAPI_BUPA_ROLE_ADD_2" to add a Role to Business Partner.

When i try to do that manually using transaction BP, in change mode i select the role to be added and SAVE. The role gets added to the BP.

But when i try the same using BAPI, it does not work. The code is written as below.

-- code ---

DATA IT_BAPIRET2 TYPE TABLE OF BAPIRET2.

CALL FUNCTION 'BAPI_BUPA_ROLE_ADD_2'

EXPORTING

BUSINESSPARTNER = '900001'

BUSINESSPARTNERROLE = 'TR0809'

TABLES

RETURN = IT_BAPIRET2.

IF IT_BAPIRET2 is Initial. "Checking if there are any Error Messages

COMMIT WORK.

ENDIF.

-


Note:-

IT_BAPIRET2 is initial. No messages in IT_BAPIRET2.

After which i go to the Table BUT100, give the Business partner number, No records are found.

Also checked in the Transaction BP, to see if the role is added for te Partner.

It did not happen.

  1. Please give me a solution or an alternative to add role to BP.

Regards,

Santosh

Add comment
10|10000 characters needed characters exceeded

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Dec 11, 2007 at 03:52 PM

    pass 'X' to ALL_BUSINESSPARTNERROLES

    and instead of commit work, use

    FM BAPI_TRANSACTION_COMMIT

    check it now.

    Add comment
    10|10000 characters needed characters exceeded

  • Posted on Mar 26 at 03:50 AM

    I have the same problem... have you solved this issue´╝č

    Add comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 25 at 06:41 AM

    Hello All,

    Even I faced the same issue while using BAPI_BUPA_ROLE_ADD_2 to add role to Business Partner. The Return table it_ret was initial but no roll added to Business Partner.
    Bapi_commit_work was also used. This issue was more of intermittent issue for me where once it was adding role and next time it was not.
    When I debugged more this was issue that - There was a code to add payment card details to business partner before adding this role to BP. So there were 2 back to back transactions on same BP , one is to add payment card and next is to add role. Although it was not giving any locking error for BP , but this was causing the problem to modify same object multiple times in single LUW.

    As a solution to this issue -

    call function 'TRANSACTION_BEGIN' .

    call function 'BAPI_BUPA_PCARD_ADD' .

    call function 'BAPI_TRANSACTION_COMMIT'.

    call function 'TRANSACTION_BEGIN' .

    call function 'BAPI_BUPA_ROLE_ADD_2' .

    call function 'BAPI_TRANSACTION_COMMIT'.

    TRANSACTION_BEGIN here creates a new LUW and TRANSACTION_COMMIT completes the LUW.

    Hence the issue was resolved. You can check if something similar to this happening in your code.

    Add comment
    10|10000 characters needed characters exceeded