Skip to Content
avatar image
Former Member

CRM_CMG_ACTION_99

Dear expert

The PPF action CRM_CMG_ACTION_99 of the action profile CRM_CMG_DEMO is designed to be executed when creating a new case. I wanted to test it and this action was successfully processed (in the log message).

However, I don't know what this action should do as nothing happened in the system ...

Does anyone know about this action?

Thanks in advance

Stephanie

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Oct 11, 2007 at 07:43 AM

    Hello Stephanie,

    Which application does this action belong to like Trasaction,Billing,industries,Rebates,Account Planning?

    Please reward points.

    regards,

    Muralidhar Prasad.C

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 11, 2007 at 09:44 PM

    Hi

    This action belongs to case management. The ABAP Code is:

    METHOD if_ex_exec_methodcall_ppf~execute.
    
      DATA:
    *   used for PPF
        lr_appl         TYPE REF TO cl_scmg_case_ppf,
        lt_case_guid    TYPE scmg_tt_case_guid,
    
    *   Case-specific attributes
        lv_value        TYPE string,
        lv_case_guid    TYPE scmg_case_guid,
        lr_case         TYPE REF TO if_scmg_case_api,
    
    *   used for sending mail
        lv_date(10)     TYPE c,
        lv_time(8)      TYPE c,
        lr_recipient    TYPE REF TO if_recipient_bcs,
        lr_bcs          TYPE REF TO cl_bcs,
        lr_doc_bcs      TYPE REF TO cl_document_bcs,
        lv_username     TYPE uname,
        lv_mail_address TYPE ad_smtpadr,
        lv_subject      TYPE sood-objdes,
        ls_text         TYPE soli,
        lt_text         TYPE bcsy_text.
    
    * Initialize
      rp_status = '0'. "not processed
    
    ** Get application object
    *  CREATE OBJECT lr_context.
    *  lr_context->appl = io_appl_object.
    *  lr_appl ?= lr_context->appl.
    
    * Cast object to application object
      lr_appl ?= io_appl_object.
    
    * Get guid of application object
      TRY.
          lv_case_guid = lr_appl->get_case_guid( ).
        CATCH cx_os_object_not_found.
          rp_status = '2'. "processing failed
          EXIT.
      ENDTRY.
    
    
    * Get case reference
      CALL METHOD cl_scmg_case_api=>if_scmg_case_api~get_case
        EXPORTING
          im_case_guid    = lv_case_guid
    *     IM_ENQUEUE      = SPACE
    *     IM_MODE         = IF_SRM_SP_ENQUEUE=>MODE_EXCLUSIVE
    *     IM_SCOPE        = IF_SRM_SP_ENQUEUE=>SCOPE_DIALOG
    *     IM_UPDATE_TASK  = IF_SRM=>FALSE
        RECEIVING
          re_case         = lr_case
        EXCEPTIONS
          failed          = 1
          enqueue_failed  = 2
          invalid_guid    = 3
          cx_srm_gsp_back = 4
          OTHERS          = 5.
      IF sy-subrc NE 0.
        rp_status = '2'. "processing failed
        EXIT.
      ENDIF.
    
    * Prepare mail
    * - Set subject
    * -- Get Case Id
      lv_value = lr_case->attribute_get(
        im_fieldname = 'EXT_KEY' ).
    
      CONCATENATE 'Case Id:' lv_value
        INTO lv_subject SEPARATED BY space.                     "#EC NOTEXT
    
    * - Set message text
      CLEAR ls_text.
      CONCATENATE 'Dear user' sy-uname
        INTO ls_text-line SEPARATED BY space.                   "#EC NOTEXT
      CONCATENATE ls_text-line ',' INTO ls_text-line.           "#EC NOTEXT
      APPEND ls_text TO lt_text.
    
    * Insert empty line
      CLEAR ls_text.
      APPEND ls_text TO lt_text.
    
      WRITE sy-datum TO lv_date.
      WRITE sy-uzeit TO lv_time.
      CLEAR ls_text.
      CONCATENATE 'this mail was sent by action' ip_action
        'on' lv_date lv_time
        INTO ls_text-line
        SEPARATED BY space.                                     "#EC NOTEXT
      CONCATENATE ls_text-line '.' INTO ls_text-line.           "#EC NOTEXT
      APPEND ls_text TO lt_text.
    
    * Insert empty line
      CLEAR ls_text.
      APPEND ls_text TO lt_text.
    
      CLEAR ls_text.
      CONCATENATE 'Regards, system' sy-sysid INTO ls_text-line
        SEPARATED BY space.                                     "#EC NOTEXT
      APPEND ls_text TO lt_text.
    
      TRY.
          CALL METHOD cl_document_bcs=>create_from_text
            EXPORTING
              i_text          = lt_text
    *         I_DOCUMENTTYPE  = 'RAW'
              i_subject       = lv_subject
    *         I_IMPORTANCE    = '0'
    *         I_SENSITIVITY   = 'F'
            RECEIVING
              result          = lr_doc_bcs.
    
        CATCH cx_document_bcs .
    *     error handling
          rp_status = '2'. "processing failed
          EXIT.
      ENDTRY.
    
    * create send request
      TRY.
          lr_bcs = cl_bcs=>create_persistent( ).
        CATCH cx_send_req_bcs.
    *     error handling
          rp_status = '2'.
          EXIT.
      ENDTRY.
    
      TRY.
          lr_bcs->set_document( i_document = lr_doc_bcs ).
        CATCH cx_send_req_bcs.
    *     error handling
          rp_status = '2'.
          EXIT.
      ENDTRY.
    
    * create recipient
      lv_username     = sy-uname.
    
      TRY.
          lr_recipient = cl_sapuser_bcs=>create( lv_username ).
    **    Set lv_mail_address here
    *    lv_mail_adress = 'muster@domain.de'.
    *    lr_recipient = cl_cam_address_bcs=>create_internet_address(
    *      i_address_string = lv_mail_address ).
        CATCH cx_address_bcs.
    *     error handling
          rp_status = '2'.
          EXIT.
      ENDTRY.
    
    
      TRY.
          lr_bcs->add_recipient( i_recipient = lr_recipient ).
        CATCH cx_send_req_bcs.
    *     error handling
          rp_status = '2'.
          EXIT.
      ENDTRY.
    
    * send mail
      TRY.
          lr_bcs->send( ).
        CATCH cx_send_req_bcs.
    *     error handling
          rp_status = '2'.
          EXIT.
      ENDTRY.
    
    
    ** Reset PPF Object Pool
    *  INSERT lv_case_guid INTO TABLE lt_case_guid.  "MIT, 11.08.2004
    *
    *  CALL FUNCTION '/CRMS/CMG_PPF_HANDLE_OBJSRV'   "MIT, 11.08.2004
    *    EXPORTING
    *      it_header   = lt_case_guid
    *      iv_stage    = 'RESET'
    *    EXCEPTIONS
    *      param_error = 1
    *      OTHERS      = 2.
    *  IF sy-subrc NE 0.
    **     "should not happen
    *  ENDIF.
    
    
    * successfully processed
      rp_status = '1'.
    
    ENDMETHOD.
    

    Add comment
    10|10000 characters needed characters exceeded