Skip to Content

Purpose

This page shows how to find out the outbound mail information with their linked service ticket no in ERMS.

Overview

In ERMS we can easily find out the inbound mails and out outbound mails Information but it’s difficult to find out the outbound mail with their linking service ticket number information.

This wiki will help you how to find out the outbound mails with their linking service ticket numbers before that I will explain what are the tables which are frequently used in ERMS.

Detailed Explanation about ERMS tables

CRMD_ERMS_HEADER : This will gives Header Details information.

This table will give’s the information about mails like From mail address,TO mail address, Creation Date, Changed Date, Status, Work Item ID, Employee responsible etc..

each and every mail will attached with there corresponding service ticket.

CRMD_ERMS_E21O : link email to one order.

This table will give’s the information about the Linkage from E-Mail to one order object. Here every mail id have there own id that is CON_ID and linked GUID. This GUID will gives the service ticket no.

CRMD_ERMS_CONTNT : Get subject of the mail.

This table will give’s the E-Mail subject information based on CON_ID.

CRMD_ERMS_EVENTT : This will give’s the E-Mail event text.

This table will give’s Email event text which is like replied, rejected,process, new etc..

eventerms.JPG

CRMD_ERMS_STATUS :  E-Mail status.

This table will give’s E-Mail Status Description based on Status_id.

SOOD,SOST,SOES this table are helpful to find out the outbound mail info with there linked service ticket number.

SOOD: SAPoffice: Object definition.

This table will give’s the email information like Created Date, Created Time,Description based on OWNTP = ‘USR’.

SOST : SAPoffice: Status log table.

This table will gives the Status log details.

SOOS : Send process.

This table will gives the TO,CC and BCC mails information.

SOES : This will gives the outbound From mail address , outbound To mail address and Status.

If we observe standard ERMS Process For each service ticket under there is inbound and outbound mails. This mails are having their own ids that is CON_ID.

zsrvo.JPG

if we want to know the service ticket no for the replied mail id we have a function module.

In that function module we have to pass CON_ID  and object type = ‘SOFM’ then will get guid for the corresponding linked service ticket.

Pass that GUID into crmd_order_read or crmd_orderadm_h you will get service ticket no.

     lv_root-objkey = lv_conid.
      lv_root-objtype = ‘SOFM’.

* Get the persisted doc flows
      CALL FUNCTION ‘SREL_GET_NEXT_RELATIONS’
        EXPORTING
          object         = lv_root
          max_hops       = 1
        TABLES
          links          = lt_bor
        EXCEPTIONS
          internal_error = 1
          no_logsys      = 2
          OTHERS         = 3.
      IF sy-subrc <> 0.
        RETURN.
      ENDIF.

      READ TABLE lt_bor INTO ls_bor INDEX 1.
      IF sy-subrc = 0.
        lv_guid = ls_bor-objkey_a.

APPEND lv_guid TO it_header_guid.

        CALL FUNCTION ‘CRM_ORDER_READ’
          EXPORTING
            it_header_guid       = it_header_guid[]
          IMPORTING
            et_orderadm_h        = it_orderadm_h[]
          CHANGING
            cv_log_handle        = lv_log_handle
          EXCEPTIONS
            document_not_found   = 1
            error_occurred       = 2
            document_locked      = 3
            no_change_authority  = 4
            no_display_authority = 5
            no_change_allowed    = 6
            OTHERS               = 7.
        IF sy-subrc <> 0.
*   Implement suitable error handling here
        ENDIF.

        READ TABLE it_orderadm_h INTO wa_orderadm_h WITH KEY process_type = ‘ZSRT’.

        IF sy-subrc <> 0.
        wa_data-service_tkt =  wa_orderadm_h-object_id.

       ENDIF.
      ENDIF.

Actual Requirement :

I have designed one BSP Component which is like search and result and custom model too.

Step by step procedure to achieve this requirement.

1)       Create one custom model.

2)      create search/result bsp component.

3)      Attach model to that component.

4)      Create search and result view.

Here we have so many blogs which is already explained how to create custom model and search/result bsp component.

So that I haven’t explain procedure to create model or search/result view.

Creating Custom Search/result view link..

http://scn.sap.com/docs/DOC-26564

http://scn.sap.com/community/crm/webclient-ui-framework/blog/2012/05/29/custom-component-based-on-custom-genil-component

Creating Custom Model..

http://scn.sap.com/community/crm/webclient-ui-framework/blog/2012/05/28/custom-genil-object-model-an-overview

ZCRM_ERMS_SRVO this is my structure which is I have used in my model.

zcrm_erms_srvo.JPG

This is the my Custom Model class ZCL_CRM_ERMS_SRVO.

zcl_crm.JPG

Redefine the method IF_GENIL_APPL_INTLAY~GET_DYNAMIC_QUERY_RESULT and write the logic.

srvo_srch.JPG

*****************************************************
*    Declaring  select-options                      *
*****************************************************
  TYPES : BEGIN OF t_selopttab,
           sign   TYPE crmsignran,
           option TYPE crmoptran,
           low    TYPE symsgv,
           high   TYPE symsgv,
          END OF t_selopttab.

  DATA : it_sel_objdes      TYPE STANDARD TABLE OF t_selopttab,
         it_sel_crdate        TYPE STANDARD TABLE OF t_selopttab,
         it_sel_emaifrom    TYPE STANDARD TABLE OF t_selopttab,
         it_sel_emailto     TYPE STANDARD TABLE OF t_selopttab,
         wa_sel             TYPE t_selopttab,
         wa_param           TYPE genilt_selection_parameter,
         lr_entity           TYPE REF TO if_genil_cont_root_object,
         lr_attr_props       TYPE REF TO if_genil_obj_attr_properties,
         v_key               TYPE string,
         lv_conid            TYPE string.

  DATA it_data TYPE STANDARD TABLE OF zcrm_erms_srvo,
          wa_data TYPE zcrm_erms_srvo,
          it_srvkt TYPE STANDARD TABLE OF zcrm_srvtkt_emp,
          wa_srvkt TYPE zcrm_srvtkt_emp.

  DATA lv_root          TYPE borident,
          lt_bor           TYPE crmt_ic_irec_links,
          ls_bor           TYPE relgraphlk,
          lv_guid          TYPE swo_typeid,
          it_header_guid   TYPE crmt_object_guid_tab,
          it_orderadm_h    TYPE crmt_orderadm_h_wrkt,
          wa_orderadm_h    TYPE crmt_orderadm_h_wrk,
          lv_log_handle    TYPE balloghndl.

*****************************************************
*            DECLARE THE TYPES                      *
*****************************************************

  TYPES : BEGIN OF t_sood,
          objtp  TYPE soodobjtp,
          objyr  TYPE soodobjyr,
          objno  TYPE soodobjno,
          objdes TYPE soodobjdes,
          crdat  TYPE soodcrdat,
          crtim  TYPE soodcrtim,
          END OF t_sood,
          BEGIN OF t_sost,
          rectp  TYPE sostrectp,
          recyr  TYPE sostrecyr,
          recno  TYPE sostrecno,
          objtp  TYPE sostobjtp,
          objyr  TYPE sostobjyr,
          objno  TYPE sostobjno,
          msgid  TYPE sostmsgid,
          END OF t_sost.

  TYPES   : BEGIN OF t_soes,
            rectp  TYPE soesrectp,
            recyr  TYPE soesrecyr,
            recno  TYPE soesrecno,
            msgid  TYPE soesmsgid,
            msgv1  TYPE soesmsgv1,
            msgv2  TYPE soesmsgv2,
            msgv4  TYPE soesmsgv4,
            status TYPE soesstatus,
            END OF t_soes.

  DATA : lv_msgid TYPE symsgid,
         lv_langu TYPE char2 VALUE ‘EN’,
         lv_msgno TYPE char3,
         lv_msgv1 TYPE string,
         lv_msgv2 TYPE string,
         lv_msgv4 TYPE string,
         lv_message TYPE string.

  DATA : gt_sood TYPE STANDARD TABLE OF t_sood,
         gs_sood TYPE t_sood,
         gt_sost TYPE STANDARD TABLE OF t_sost,
         gs_sost TYPE t_sost,
         gt_soes TYPE STANDARD TABLE OF t_soes,
         gs_soes TYPE t_soes.

*****************************************************
*    Search Qurey and Selection Screen inputs       *
*****************************************************

  IF iv_query_name = ‘SEARCH_SRVO’.

    LOOP AT it_selection_parameters INTO wa_param.
      CASE wa_paramattr_name.
        WHEN ‘DESCRIPTION’.
          MOVE-CORRESPONDING wa_param TO wa_sel.
          REPLACE ALL OCCURRENCES OF ‘*’ IN wa_sel WITH ‘%’.
          APPEND wa_sel TO it_sel_objdes.
        WHEN ‘FROM_DATE’.
          MOVE-CORRESPONDING wa_param TO wa_sel.
          APPEND wa_sel TO  it_sel_crdate.
        WHEN ‘EMAIL_FROM’.
          MOVE-CORRESPONDING wa_param TO wa_sel.
          APPEND wa_sel TO it_sel_emaifrom.

        WHEN ‘EMAIL_TO’.
          TRANSLATE wa_paramlow TO LOWER CASE.
          TRANSLATE wa_paramhigh TO LOWER CASE.
          MOVE-CORRESPONDING wa_param TO wa_sel.

          APPEND wa_sel TO it_sel_emailto.
      ENDCASE.
      CLEAR : wa_param,wa_sel.
    ENDLOOP.

* <—data fetching logic based on selection screen inputs—>

    SELECT objtp objyr objno objdes crdat crtim INTO CORRESPONDING FIELDS OF TABLE gt_sood FROM sood
                                                                                  WHERE crdat IN it_sel_crdate
                                                                                  AND   owntp = ‘USR’.

    IF gt_sood[] IS NOT INITIAL.

      SELECT rectp recyr recno objtp objyr objno msgid FROM sost INTO CORRESPONDING FIELDS OF TABLE gt_sost
                                                      FOR ALL ENTRIES IN gt_sood WHERE objtp = gt_soodobjtp
                                                                                 AND   objyr = gt_soodobjyr
                                                                                 AND   objno = gt_soodobjno
                                                                                 AND   msgid = ‘SO’.
      IF gt_sost[] IS NOT INITIAL.
        SELECT rectp recyr recno msgid msgv1 msgv2 msgv4 status FROM soes INTO CORRESPONDING FIELDS OF TABLE gt_soes FOR ALL ENTRIES IN gt_sost
                                                         WHERE   rectp = gt_sostrectp
                                                         AND     recyr = gt_sostrecyr
                                                         AND     recno = gt_sostrecno
                                                         AND     msgv1 IN it_sel_emailto
                                                         AND     msgv2 IN it_sel_emaifrom.
      ENDIF.
    ENDIF.

    LOOP AT gt_soes INTO gs_soes.

      READ TABLE gt_sost INTO gs_sost WITH KEY rectp = gs_soesrectp
                                               recyr = gs_soesrecyr
                                               recno = gs_soesrecno.
      IF sysubrc = 0.

        READ TABLE gt_sood INTO gs_sood WITH KEY objtp = gs_sostobjtp
                                                 objyr = gs_sostobjyr
                                                 objno = gs_sostobjno.
        IF sysubrc = 0.

          wa_dataobjtp = gs_soodobjtp.
          wa_dataobjyr = gs_soodobjyr.
          wa_dataobjno = gs_soodobjno.
          wa_datadescription = gs_soodobjdes.
          wa_datafrom_date = gs_soodcrdat.
          wa_datasend_time = gs_soodcrtim.

          wa_dataemail_from = gs_soesmsgv2.
          wa_dataemail_to = gs_soesmsgv1.

          lv_msgid = gs_soesmsgid.
          lv_msgno = gs_soesstatus.
          lv_msgv1 = gs_soesmsgv1.
          lv_msgv2 = gs_soesmsgv2.
          lv_msgv4 = gs_soesmsgv4.

          CALL FUNCTION ‘CONVERSION_EXIT_ALPHA_INPUT’
            EXPORTING
              input  = lv_msgno
            IMPORTING
              output = lv_msgno.

          CALL FUNCTION ‘FORMAT_MESSAGE’
           EXPORTING
             id              = lv_msgid
             lang            = ‘EN’
             no              = lv_msgno
             v1              = lv_msgv1
             v2              = lv_msgv2
*         V3              = lv_MSGV3
             v4              = lv_msgv4
           IMPORTING
             msg             = lv_message
*       EXCEPTIONS
*         NOT_FOUND       = 1
*         OTHERS          = 2
                    .
          IF sysubrc <> 0.
* Implement suitable error handling here
          ENDIF.

          wa_datastatus = lv_message.

          CLEAR : lv_msgid,lv_msgno,lv_msgv1,lv_msgv2,lv_msgv4.

          CONCATENATE gs_soodobjtp gs_soodobjyr gs_soodobjno INTO lv_conid.
          wa_dataconid = lv_conid.

          SHIFT lv_conid BY 17 PLACES RIGHT.

          lv_rootobjkey = lv_conid.
          lv_rootobjtype = ‘SOFM’.

* Get the persisted doc flows
          CALL FUNCTION ‘SREL_GET_NEXT_RELATIONS’
            EXPORTING
              object         = lv_root
              max_hops       = 1
            TABLES
              links          = lt_bor
            EXCEPTIONS
              internal_error = 1
              no_logsys      = 2
              OTHERS         = 3.
          IF sysubrc <> 0.
            RETURN.
          ENDIF.

          READ TABLE lt_bor INTO ls_bor INDEX 1.
          IF sysubrc = 0.
            lv_guid = ls_borobjkey_a.

            APPEND lv_guid TO it_header_guid.

            CALL FUNCTION ‘CRM_ORDER_READ’
              EXPORTING
                it_header_guid       = it_header_guid[]
              IMPORTING
                et_orderadm_h        = it_orderadm_h[]
              CHANGING
                cv_log_handle        = lv_log_handle
              EXCEPTIONS
                document_not_found   = 1
                error_occurred       = 2
                document_locked      = 3
                no_change_authority  = 4
                no_display_authority = 5
                no_change_allowed    = 6
                OTHERS               = 7.
            IF sysubrc <> 0.
*   Implement suitable error handling here
            ENDIF.

            READ TABLE it_orderadm_h INTO wa_orderadm_h WITH KEY process_type = ‘ZSRT’.

            wa_dataservice_tkt =  wa_orderadm_hobject_id.
          ENDIF.

          APPEND wa_data TO it_data.
        ENDIF.
      ENDIF.
      CLEAR : wa_data,lv_conid,lv_guid,it_header_guid,wa_orderadm_h,it_orderadm_h,lt_bor,lv_root,lv_log_handle.
      CLEAR : gs_soes,gs_sood.
    ENDLOOP.

*populating data into result

    LOOP AT it_data INTO wa_data.

      TRY.
          CALL METHOD iv_root_list->add_object
            EXPORTING
              iv_object_name = ‘RESULT_SRVO’
              is_object_key  = wa_data
            RECEIVING
              rv_result      = lr_entity.

        CATCH cx_crm_genil_duplicate_rel .
        CATCH cx_crm_genil_model_error .
      ENDTRY.
      CALL METHOD lr_entity->set_attributes
        EXPORTING
          is_attributes = wa_data.

      CLEAR : wa_data.
    ENDLOOP.

  ENDIF.

srvrelt.JPG

this is the final output here we can come to know sent mails based on creating date.

Related Content

http://scn.sap.com/thread/1340812

http://scn.sap.com/thread/3181618

Related Documents

E-MAIL INBOUND CONFIGURATION- ALM: Incident Management#MAILINBOUNDCONFIGURATION-ALM:IncidentManagement-3SAPBusinessWorkflowandCommunicationSettings

How to set up Threading in ERMS

To report this post you need to login first.

4 Comments

You must be Logged on to comment or reply to a post.

Leave a Reply