Skip to Content

CRM_ERMS_MAIL_COMPOSE - Getting data from previous service request


I am using the FM CRM_ERMS_MAIL_COMPOSE to send the personalized email. This FM internally calls another FM CRM_ERMS_MAIL_COMPOSE_NEW where it fills the mailform attributes with the actual data to compose the complete email.

The problem is, CRM_ERMS_MAIL_COMPOSE_NEW will check if there is any service request available in //currentservicerequest/btorderheader. This context has the previously opened service request number and it will compose the email for that service request number.

I am not sure how we can get the context //currentservicerequest/btorderheader to have the newly opened service request which is active now.

Request you to help me with this. Thanks a lot!


Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Dec 13, 2017 at 05:21 AM


    The context //currentservicerequest/btorderheader refers to the global data context. In business roles of profile type B IC Web Client, the global data context is filled automatically and is closely related to the activity clipboard (function profile ID CRMUI_CLIPBOARD).

    For example, you can read the currentcustomer from the global data context

    lr_gdc ?= cl_crm_ui_data_context_srv=>get_instance( iv_controller = me ).
    lr_entity ?= lr_gdc->get_entity( name = if_iccmp_global_data_cont_con=>gdc_currentcustomer ).	
    Add comment
    10|10000 characters needed characters exceeded

  • Dec 13, 2017 at 11:54 AM

    Hi Sigrid,

    Thank you for the response!

    I know it will be filled automatically in IC WebClient scenario. I will explain my issue in detail.

    In Solution Manager, I have implemented EXEC_METHODCALL_PPF to send out the email notifications. In the implementation, I am using

    the FM: CRM_ERMS_MAIL_COMPOSE, which will internally call the FM: CRM_ERMS_MAIL_COMPOSE_NEW. In this FM, this is the code from Line# 575.

    SELECT SINGLE scenario scenario_type FROM  crmc_im_scen CLIENT SPECIFIED INTO ls_cust_scenario  
            WHERE    scenario = cust_scenario.          "#EC *
        IF ls_cust_scenario-scenario_type EQ 'SQM'.
    *   Get current Service Request tracking text
              lr_bdc = cl_crm_ui_data_context_srv=>get_instance( ).
              lr_order_props = lr_bdc->get_entity_by_path( '//CURRENTSERVICEREQUEST/BTOrderHeader' ). "#EC NOTEXT
              IF lr_order_props IS BOUND.
                 IV_ATTR_NAME = 'OBJECT_ID' "#EC NOTEXT
                 EV_RESULT    = lv_srqid .
              CATCH cx_root.

    Here, it is trying to fetch the active incident number (which is currently open now) from the context //CURRENTSERVICEREQUEST/BTOrderHeader. The problem is, the context node does not have the current incident number. It has the previously opened incident number. And, I observed that this context node will be updated with the active incident number after I save the incident.

    Just wanted to understand, how I can get the //CURRENTSERVICEREQUEST/BTOrderHeader to have the current incident (before saving).



    Add comment
    10|10000 characters needed characters exceeded