Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Lluis
Active Contributor
0 Kudos

Hello forum,

For update an old un-anwsered question on that forum that today sure that can be moved to a idea places, i just found a good method to allow basis team lose less time for that option when something need the sap solution manager key ).

Original Post:

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

Process:

The goal is to reduce the number of request from customers/colleges/friend that need that wanted Sap Solution Manager Key that on SAP Solution Manager 701 was generated from SMSY transawction and now after 7.1 you need access from LMDB; the goal is to allow the automatic generation of SSM key trough a message creation in ITSM.

Process wished:

User create a incident/message on ITM selection sap component "SV-SMG-SER"  (as sample, can be anyone but get carefull to don't send that message to sap if you are on a VAR escenario) and automatically after incident creation, user can see inside incident text or notification mail the key for the system selected.

Technical information:

Application:                 CRM_ORDER

Action profile:              AI_SDK_STANDARD

Action definition:          Z_AI_SDK_AUTO_RESPONSE

Implemented class:      ZCL_IM_AI_SDK_SEND_MESSAGE

Class Methond:            Z_AI_SDK_SEND_MESSAGE

Code that calculate the key:    Z_DSWPCLIENTKEY

On Solution Manager 701, the result is something like that after message creation:

How to improve that functionality:

- Adding the key on the mail notification that will be send to the user,

- Adding that option as a web service that user can request from some solman workcenter

Action Profile Code:

method IF_EX_EXEC_METHODCALL_PPF~EXECUTE.

  DATA: lv_header_guid     TYPE crmt_object_guid.

  DATA: lc_action_execute  TYPE REF TO cl_action_execute.

  DATA: ls_object          TYPE borident.

  DATA: lp_subject         TYPE so_obj_des.

  DATA: lt_note            TYPE soli_tab.

  DATA: lp_link            TYPE flag.

  DATA: lv_object_s(33)    TYPE c.

  DATA: lp_send_request    TYPE os_guid.

  DATA: lv_appl_object     TYPE REF TO cl_notif_ppf.

  DATA: lt_text            TYPE TABLE OF tline.

  DATA: lv_tdid            TYPE tdid.

  DATA: lt_exception       TYPE crmt_exception_t.

  DATA: lv_return          TYPE sysubrc.

  DATA: ls_container       TYPE swcont.

  DATA: lt_container       TYPE swconttab.

  DATA: lt_tdid_displ      TYPE dswptdid.

  DATA: lv_mark_first      TYPE char01 VALUE space.

  DATA: lv_mark_last       TYPE char01 VALUE space.

  DATA: lv_mode            TYPE char01 VALUE 'O'.

  DATA: lv_title           TYPE string.

  DATA: lv_description     TYPE string.

  DATA: lt_con_defaults TYPE swconttab.

* get header guid of crm transaction

  CREATE OBJECT lc_action_execute.

  CALL METHOD lc_action_execute->get_ref_object

    EXPORTING

      io_appl_object = io_appl_object

      ii_container   = ii_container

    IMPORTING

      ev_guid_ref    = lv_header_guid.

* get attributes from container

  IF ii_container IS BOUND.

    lt_container = ii_container->get_values( ).

    READ TABLE lt_container INTO ls_container

    WITH KEY element = 'MARK_FIRST'.

    IF sy-subrc IS INITIAL.

      lv_mark_first = ls_container-value.

    ENDIF.

    READ TABLE lt_container INTO ls_container

    WITH KEY element = 'MARK_LAST'.

    IF sy-subrc IS INITIAL.

      lv_mark_last = ls_container-value.

    ENDIF.

    READ TABLE lt_container INTO ls_container

    WITH KEY element = 'MODE'.

    IF sy-subrc IS INITIAL.

      lv_mode = ls_container-value.

    ENDIF.

    LOOP AT lt_container INTO ls_container WHERE element = 'TEXTID_DISPLAY'.

      lv_tdid = ls_container-value.

      APPEND lv_tdid TO lt_tdid_displ.

    ENDLOOP.

    READ TABLE lt_container INTO ls_container

    WITH KEY element = 'TEXT_ID'.

    IF sy-subrc IS INITIAL.

      lv_tdid = ls_container-value.

    ENDIF.

    READ TABLE lt_container INTO ls_container

    WITH KEY element = 'TITLE'.

    IF sy-subrc IS INITIAL.

      lv_title = ls_container-value.

    ENDIF.

    READ TABLE lt_container INTO ls_container

    WITH KEY element = 'DESCRIPTION'.

    IF sy-subrc IS INITIAL.

      lv_description = ls_container-value.

    ENDIF.

  ENDIF.

* Get PPF default values for provided filter

  cl_ags_crm_1o_customizing_sd=>get_ppf_default_contain_values(

  EXPORTING

    iv_flt_val                   = flt_val

  IMPORTING

    et_container                 = lt_con_defaults

  EXCEPTIONS

    no_default_values_for_filter = 1

    OTHERS                       = 2 ).

* Set default values if needed

  IF sy-subrc EQ 0.

    IF lv_tdid IS INITIAL.

      READ TABLE lt_con_defaults INTO ls_container

      WITH KEY element = 'TEXT_ID'.

      IF sy-subrc EQ 0.

        lv_tdid = ls_container-value.

      ENDIF.

    ENDIF.

    IF lv_mode IS INITIAL.

      READ TABLE lt_con_defaults INTO ls_container

      WITH KEY element = 'MODE'.

      IF sy-subrc IS INITIAL.

        lv_mode = ls_container-value.

      ENDIF.

    ENDIF.

  ENDIF.


*INS{ lsalvador(12/07/2012) - adding sap solution manager key

  DATA: wa type CRMT_OBJECT_GUID,

        lt_header_guid      TYPE crmt_object_guid_tab,

        v_display type  crmt_mode   VALUE   'C',

        lt_doc_flow         TYPE crmt_doc_flow_wrkt,

        wb TYPE CRMT_DOC_FLOW_WRK,

        lt_req_objects  TYPE crmt_object_name_tab,

        it_sapdata TYPE table of RDNO_UISUB_SAP_DATA ,

        wc TYPE RDNO_UISUB_SAP_DATA,

        v_guidh TYPE DNOT_GUIDH,

        ls_notif_h     type dnos_notif_ext,

        lt_text_lines  type table of rdno_uisub_text_lines,

        wd type TLINE, we type SMSY_SYSTEM_SAP,

        iv_header_guid TYPE CRMT_OBJECT_GUID,

        lt_notes          type table of rdno_uisub_note,

        lt_sap_data       type table of rdno_uisub_sap_data,

        lv_notif_type     TYPE dnot_type_n,

        ls_return         TYPE bapiret1,

        lt_text_header    type table of rdno_uisub_text_header.

DATA: BEGIN OF gs_dynpinfo_iuk,

  smsy_sys_id      TYPE smsy_name,

  smsy_sys_numb    TYPE smsy_system_sap-sysnr,

  smsy_msg_server  TYPE smsy_system_sap-messserver,

  smsy_inst_numb   type smsy_system_sap-inst_number,

  sys_id(3)        TYPE c,

  sys_numb(2)      TYPE c,

  msg_server(15)   TYPE c,

  key(10)          TYPE c,

END OF gs_dynpinfo_iuk.

clear:   wa , v_display , lt_doc_flow, wb, it_sapdata, wc, v_guidh, ls_notif_h, wd.

refresh: lt_header_guid, lt_req_objects.

append lv_header_guid to lt_header_guid.

append 'DOC_FLOW' to lt_req_objects.

iv_header_guid = lv_header_guid.

  CALL FUNCTION 'CRM_ORDER_READ'

    EXPORTING

      it_header_guid       = lt_header_guid

      iv_mode              = v_display

      it_requested_objects = lt_req_objects

    IMPORTING

      et_doc_flow          = lt_doc_flow

    EXCEPTIONS

      OTHERS               = 1.

Read table lt_doc_flow into wb index 1.

      v_guidh = WB-OBJKEY_A.

      CALL FUNCTION 'DNO_OW_READ_SAP_DATA'

        EXPORTING

          I_GUIDH           = v_guidh

       TABLES

         TE_SAP_DATA       = it_sapdata.

         read table it_sapdata index 1 into wc.

  call function 'CRM_DNO_MAP_TO_NOTIF'

    exporting

      iv_header_guid  = iv_header_guid

      iv_notif_type   = LV_NOTIF_TYPE

    importing

      es_notif_h      = ls_notif_h

    tables

      et_notes        = lt_notes

      et_sap_data     = lt_sap_data

      et_text_header  = lt_text_header

      et_text_lines   = lt_text_lines.

       read table IT_SAPDATA index 1 into wc.

       message wc-COMP TYPE 'I'.

check: wc-comp = 'SV-SMG-SER'. 

select single * into we from SMSY_SYSTEM_SAP where systemname like wc-SYSID(3) and version = 'ACTIVE' and inst_number = wc-instn.

check sy-subrc = 0.

gs_dynpinfo_iuk-sys_id = wc-SYSID.

gs_dynpinfo_iuk-sys_numb = ''.

gs_dynpinfo_iuk-msg_server = we-MESSSERVER.

gs_dynpinfo_iuk-smsy_inst_numb = we-inst_number.

perform get_sp_value in program Z_DSWPCLIENTKEY        USING

            gs_dynpinfo_iuk-sys_id

            gs_dynpinfo_iuk-sys_numb

            gs_dynpinfo_iuk-msg_server

            gs_dynpinfo_iuk-smsy_inst_numb

          CHANGING

            gs_dynpinfo_iuk-key.

wd-TDFORMAT = '*'.

wd-TDLINE  ='SAP SOlution Manager Key'.  wd-TDLINE+30 = gs_dynpinfo_iuk-key.

append wd to lt_text.

wd-TDFORMAT = '*'.

wd-TDLINE  ='For:'..

append wd to lt_text.

wd-TDFORMAT = '*'.

wd-TDLINE  ='Server:'.     wd-TDLINE+15 = we-MESSSERVER.

append wd to lt_text.

wd-TDFORMAT = '*'.

wd-TDLINE  ='System:'.      wd-TDLINE+15 = we-systemname.

append wd to lt_text.

wd-TDFORMAT = '*'.

wd-TDLINE  ='Instalattion number:'.  wd-TDLINE+15 = we-inst_number.

append wd to lt_text.

wd-TDLINE  ='*'.             wd-TDLINE+15 = ''.

append wd to lt_text.

*INS] ------

  IF lt_text IS NOT INITIAL.

    CALL FUNCTION 'AI_SDK_ADD_TEXT_TO_CRM_MESSAGE'

      EXPORTING

        iv_guid_crm  = lv_header_guid

        iv_tdid      = lv_tdid

        iv_save_mode = ' '

        iv_event     = ' '

        iv_commit    = ' '

      IMPORTING

        ev_return    = lv_return

        et_exception = lt_exception

      TABLES

        it_text      = lt_text.

lv_return = '1'.

    IF ( lt_exception IS INITIAL ) AND

    ( lv_return = 0 ).

      CALL METHOD lc_action_execute->register_for_save

        EXPORTING

          iv_source_header_guid = lv_header_guid

          ip_application_log    = ip_application_log.

      rp_status = 1.

    ENDIF.

  ENDIF.

endmethod.

Take a look in attachment for Z_DSWPCLIENTKEY code that calculate the key.

Hope that can be useful for you for avoid losing time while need to generate that key for others .

Best Regards,

Luis

Labels in this area