Skip to Content

CRM_ERMS_MAIL_COMPOSE - Getting data from previous service request

Hi,

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!

-Ricky.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Dec 13, 2017 at 05:21 AM

    Hi,

    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 a comment
    10|10000 characters needed characters exceeded

  • Posted on 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
          TRY.
              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.
               CALL METHOD LR_ORDER_PROPS->GET_PROPERTY_AS_VALUE
               EXPORTING
                 IV_ATTR_NAME = 'OBJECT_ID' "#EC NOTEXT
               IMPORTING
                 EV_RESULT    = lv_srqid .
              ENDIF.
              CATCH cx_root.
          ENDTRY.<br>

    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).

    Thanks!

    -Ricky.

    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.