Skip to Content
0
Former Member
Sep 11, 2007 at 08:57 PM

Adding BP to existing Acitivity?

12 Views

Folks below is the code i have used to add a business partner to an activity. iam not getting any error return messages but the BP is not attached to the activity. refer the code and let me know if im missing anything.

  • Fill the header information

lf_header-guid = l_objnr.

lf_header-mode = 'B'.

APPEND lf_header TO lit_header.

lf_headerx-guid = 'X'.

lf_headerx-mode = 'X'.

APPEND lf_headerx TO lit_headerx.

lf_partner-ref_guid = l_objnr.

lf_partner-ref_kind = 'A'.

lf_partner-partner_fct = 'Z_EMP'.

lf_partner-kind_of_entry = 'C'.

lf_partner-display_type = 'BP'.

lf_partner-no_type = 'BP'.

lf_partner-partner_no = l_partner.

APPEND lf_partner TO lit_partner.

lf_partnerx-ref_guid = 'X'.

lf_partnerx-ref_kind = 'X'.

lf_partnerx-partner_fct = 'X'.

lf_partnerx-kind_of_entry = 'X'.

lf_partnerx-display_type = 'X'.

lf_partnerx-no_type = 'X'.

lf_partnerx-partner_no = 'X'.

APPEND lf_partnerx TO lit_partnerx.

  • * Changing the reason

CALL FUNCTION 'BAPI_ACTIVITYCRM_CHANGEMULTI'

TABLES

header = lit_header

headerx = lit_headerx

partner = lit_partner

partnerx = lit_partnerx

return = lit_return.

lf_to_save-guid = l_objnr.

APPEND lf_to_save TO lit_to_save.

  • Save the changes in the BAPI Save

CALL FUNCTION 'BAPI_ACTIVITYCRM_SAVE'

TABLES

objects_to_save = lit_to_save

saved_objects = lit_saved

return = lit_return.

  • Saving the changes in the transaction

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'.