cancel
Showing results for 
Search instead for 
Did you mean: 

MSA Sales Main Employee Responsible

brandongailey
Participant
0 Kudos

Hello All,

I am trying to add some logic in the msa badi to set the employee responsible when an account is created on a mobile device.

Are there any standard functions to get relationship number based on the newly created account and the employee responsible?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Brandon.

If you need the value of Relationship number, you can make a select to table BUT050, an obtain RELNR field.

First, you need the partner number of new account. This value are in field PARTNER of variable CT_HEADER.

In second instance, you need the partner number of employee. For this, you can use this code:

READ TABLE ct_bupa_employee INDEX 1 INTO cs_bupa_employee.

     IF sy-subrc = 0.

       lv_username = cs_bupa_employee-employee_id.

       CALL FUNCTION 'COM_BPUS_BUPA_FOR_USER_GET'

         EXPORTING

           is_username           = lv_username

         IMPORTING

           ev_businesspartner    = lv_partner2

         TABLES

           et_return             = lt_return

         EXCEPTIONS

           no_central_person     = 1

           no_business_partner   = 2

           no_id                 = 3

           no_user               = 4

           no_alias              = 5

           alias_and_user_differ = 6

           internal_error        = 7

           OTHERS                = 8.

     ENDIF.


Then, you can make the select:


SELECT SINGLE relnr

INTO lv_relnr

FROM BUT050

WHERE partner1 = lv_partner1 " Partner number of new account

      AND partner2 = lv_partner2 " Partner number of employee

       AND reltyp = 'BUR011'       " Employee Responsible Relationship  


Regards,


Renzo.


Answers (0)