cancel
Showing results for 
Search instead for 
Did you mean: 

Assignment of Employee Responsible to Account using BOL

0 Kudos

Dear all,


I am creating new account using BOL and want to assign employee responsible to that account.

I have written below code where relation is created properly but not able to assign the partner. I have not added code to assign Partner1 and Partner2 since while creation of related entity BuilEmplResponsRel there is no account generated to assign it to Partner1 and I am not getting how to assign Employee Responsible assigned to user to Partner2.

I have searched some posts but they are saying Employee Responsible will be created automatically but in my case it is not creating.

When I create a partner using WebUI Employee Responsible is coming automatically I debugged the entity during save but the Employee Responsible relationship entity is there but it is showing as Initial means no data is there.

lr_entity_emp = lr_entity->create_related_entity( 'BuilEmplResponsRel' ).

ls_emp-relationshipcategory = 'BUR011'.

ls_emp-defaultrelationship = 'X'.

lr_entity_emp->set_properties( ls_emp ).

Thanks & Regards,

Rohan

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Solved it myself!!!!!!!!!!!!!!!

ceedee666
Active Contributor
0 Kudos

Hi Rohan,

please post a short description of the solution. Might be helpful for others having the issue.

Christian

0 Kudos

I have modified the core and found out Partner1 (Account about to create) and found out Partner2 (Employee Responsible linked to User) from HRP1001 table. I have then created the related entity BuilEmplResponsRel and passed both partners along with the relationship category BUR011 then modified the core again and finally committed the transaction.

The code used is as follows:

CONCATENATE 'US' sy-uname INTO varyf.
SELECT SINGLE objid INTO hr_objid FROM hrp1001 WHERE otype = 'CP' AND varyf = varyf.
IF sy-subrc = 0.
SELECT SINGLE sobid INTO empl_resp FROM hrp1001 WHERE otype = 'CP' AND objid = hr_objid AND sclas = 'BP'.
ENDIF.

lr_core->modify( ).
lv_partner = lr_entity->get_property_as_string( 'BP_NUMBER' ).
lr_entity_emp = lr_entity->create_related_entity( 'BuilEmplResponsRel' ).
ls_emp-partner1 = lv_partner.
ls_emp-partner2 = empl_resp.
ls_emp-relationshipcategory = 'BUR011'.
ls_emp-defaultrelationship = 'X'.
lr_entity_emp->set_properties( ls_emp ).
lr_core->modify( ).
lr_transaction = lr_core->get_transaction( ).
lr_transaction->commit( ).

Answers (0)