Skip to Content

How to trigger action on delegated object


I am new to BOPF, I have read through a lot of the information on SDN and have a query. I have a scenario where I need to trigger an action on a delegated object, the BO is /CPD/PWS_BO_MP and the delegated object is /BOBF/ATTACHMENT_FOLDER. What I need to do is when the BO /CPD/PWS_BO_MP is created, then create delegated object /BOBF/ATTACHMENT_FOLDER and trigger CREATE_FOLDER to create some attachment folders automatically.

I have read though Navigating the BOPF: Part 3 - Working with the BOPF API to understand how to trigger an action, however this doesn't work on the delegated object directly. Having read Accessing a delegated object in BOPF is seems I have to do this via the main BO, however this blog post only really covers reading the delegated object, I haven't found a way to trigger an action on a delegated object yet.

Any tips or clues would be much appreciated.



Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Aug 23, 2016 at 07:39 AM

    Got this working in the end by debugging via /BOBF/TEST_UI - only thing I haven't figured out is which constant relates to the action GUID in iv_act_key as I cannot find one which maps to this.

    DATA: lr_srv_mgr TYPE REF TO /bobf/if_tra_service_manager.

    DATA: lr_tra_mgr TYPE REF TO /bobf/if_tra_transaction_mgr.

    DATA: lv_mp_guid TYPE /bobf/conf_key.

    DATA: ls_key TYPE /bobf/s_frw_key.

    DATA: lt_key TYPE /bobf/t_frw_key.

    DATA: lt_mp_data TYPE /cpd/t_mp_hdr_k.

    DATA: lv_rejected TYPE boole_d.

    DATA: lt_mod TYPE /bobf/t_frw_modification.

    DATA: ls_parameters TYPE /bobf/s_atf_a_create_folder.

    DATA: lt_failed_key TYPE /bobf/t_frw_key.

    DATA: lt_failed_act_key TYPE /bobf/t_frw_key.

    DATA: lr_atf_hdr TYPE REF TO /bobf/s_atf_root_k.

    DATA: lr_message TYPE REF TO /bobf/if_frw_message.

    DATA: lr_change TYPE REF TO /bobf/if_tra_change.

    DATA: lr_s_parameters TYPE REF TO data.

    FIELD-SYMBOLS: <ls_mod> LIKE LINE OF lt_mod.

    FIELD-SYMBOLS <ls_key> LIKE LINE OF lt_key.


    "Get the project GUID

    CALL METHOD /cpd/cl_pws_ws_utility=>get_mp_guid_from_id


    iv_mp_id = iv_mp_id


    rv_mp_guid = lv_mp_guid.

    IF lv_mp_guid IS INITIAL.

    RAISE invalid_id.


    "Get service manager

    lr_srv_mgr = /bobf/cl_tra_serv_mgr_factory=>get_service_manager( /cpd/if_mp_pws_bo_c=>sc_bo_key ).

    "Get transaction manager

    lr_tra_mgr = /bobf/cl_tra_trans_mgr_factory=>get_transaction_manager( ).

    "Retrieve the master project

    ls_key-key = lv_mp_guid.

    APPEND ls_key TO lt_key.

    CALL METHOD lr_srv_mgr->retrieve


    it_key = lt_key

    iv_node_key = /cpd/if_mp_pws_bo_c=>sc_node-mp_hdr

    iv_fill_data = abap_true


    et_data = lt_mp_data.

    "Create the MP_ATTACH_FOLDER association

    CREATE DATA lr_atf_hdr.

    lr_atf_hdr->key = /bobf/cl_frw_factory=>get_new_key( ).

    lr_atf_hdr->parent_key = lv_mp_guid.

    lr_atf_hdr->root_key = lv_mp_guid.


    <ls_mod>-node = /cpd/if_mp_pws_bo_c=>sc_node-mp_attach_folder.

    <ls_mod>-change_mode = /bobf/if_frw_c=>sc_modify_create.

    <ls_mod>-source_node = /cpd/if_mp_pws_bo_c=>sc_node-mp_hdr.

    <ls_mod>-association = /cpd/if_mp_pws_bo_c=>sc_association-mp_hdr-mp_doc_attachment.

    <ls_mod>-source_key = lv_mp_guid.

    <ls_mod>-key = lr_atf_hdr->key.

    <ls_mod>-data = lr_atf_hdr.

    CALL METHOD lr_srv_mgr->modify


    it_modification = lt_mod


    eo_change = lr_change

    eo_message = lr_message.

    lr_message->get_messages( IMPORTING et_message = et_messages ).

    CHECK et_messages IS INITIAL.

    "Call the CREATE_FOLDER action

    CLEAR lt_key.


    <ls_key>-key = lr_atf_hdr->key.

    ls_parameters-name = 'TEST'.

    ls_parameters-description_content = 'TEST'.

    GET REFERENCE OF ls_parameters INTO lr_s_parameters.

    CALL METHOD lr_srv_mgr->do_action


    iv_act_key = '005056B650081ED699895101DE8780EC'

    it_key = lt_key

    is_parameters = lr_s_parameters


    eo_change = lr_change

    eo_message = lr_message

    et_failed_key = lt_failed_key

    et_failed_action_key = lt_failed_act_key.

    lr_message->get_messages( IMPORTING et_message = et_messages ).

    CHECK et_messages IS INITIAL.

    CALL METHOD lr_tra_mgr->save


    eo_change = lr_change

    eo_message = lr_message

    ev_rejected = lv_rejected.

    lr_message->get_messages( IMPORTING et_message = et_messages ).

    CATCH /bobf/cx_frw.

    RAISE internal_error.


    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.