Skip to Content
Technical Articles
Author's profile photo Uladzislau Pralat

Simplify UKM_CASE Transaction to Support S/4HANA Insight to Action

S/4HANA transitions from using VKM3 transaction to UKM_CASE transaction for releasing credit blocked documents. UKM_CASE transaction is a typical ERP mega transaction that has a lot of functionality and over-complicated user interface. The latter makes it complicated to use UKM_CASE transaction for S/4HANA insight to action. In my blog I will explain how to apply Fiori Simplify strategy to UKM_CASE transaction.

As you can see, UKM_CASE has organizer panel (on the left) for activities switching RMS and menu navigation.

I simplified transaction hiding organizer panel, eliminating navigating to Credit Limit Request – Search menu item and directly passing sales document. Below is custom ZUKM_CASE transaction. So it takes you right where need to be for specific Sales Document.

Below is release credit block insight to action scenario that is making use of simplified UKM_CASE transaction. Starting from Fiori Overview Page insight (1), navigating to Fiori List report (2) and finally jumping to action in UKM_CASE transaction (3).

All it takes to simplify UKM_CASE transaction are four simple steps:

Create ZUKM_CASE wrapper program

This program hides UKM_CASE has organizer panel. This program also takes Sales Document as input parameter and store it in AUN memory id

REPORT zukm_case.

*&---------------------------------------------------------------------*
*& Report  SAPSRMSTART                                                 *
*&                                                                     *
*&---------------------------------------------------------------------*
*&                                                                     *
*&                                                                     *
*&---------------------------------------------------------------------*
* report to start any SRM application with any activity
TYPE-POOLS: srmif.

* -- parameter declaration
PARAMETERS: vbeln TYPE vbeln_va MEMORY ID AUN.
PARAMETERS: spsid TYPE srmspsid DEFAULT 'UKM_SPS_LOC_DCD',
            poidid TYPE srmpoidid,
            activity TYPE srmactid,
            rmsid TYPE srmspsid DEFAULT 'UKM_CREDIT_CASE',
            navi TYPE c AS CHECKBOX,
            organ TYPE c AS CHECKBOX,
            orgsps type srmspsid default 'SRM_SPS_ORGANIZER',
            orgrms type srmrmsid default 'S_RMS_DATA',
            cfwsps type srmspsid default 'SRM_RMS_CLIENTFRAME_WIN',
            resspa type c as checkbox default ' '.

INITIALIZATION.

  activity = if_srm_activity_list=>display.

* -- local objects & data

  DATA: ex_srm_initialization TYPE REF TO cx_srm_initialization,
        ex_srm_authorization TYPE REF TO cx_srm_no_authorization,
        ex_srm_poid TYPE REF TO cx_srm_poid,
        ex_srm_registration_data TYPE REF TO cx_srm_registration_data,
        ex_srm_poid_dir TYPE REF TO cx_srm_poid_dir,
        ex_srm TYPE REF TO cx_srm.

  DATA: lcl_start_framework TYPE REF TO cl_srm_start_framework,
        sp_poid TYPE srm_list_poid.

  DATA: s_spsid TYPE string,
        s_pdirid TYPE string,
        s_rmsid  TYPE string.

START-OF-SELECTION.

*  SET PARAMETER ID 'AUN' FIELD p_vbeln.   "!!!
* hack (cv-2003-07-21): reset SPA/GPA by flag
  if resspa = 'X'.
    data: c_title(70) type c.

    SET PARAMETER ID 'SRM_DEFAULT_TITLE' FIELD c_title.
    SET PARAMETER ID 'SRM_WELCOME_SCREEN' FIELD c_title.

  endif.

  CREATE OBJECT lcl_start_framework exporting im_clientframe_sps_id = cfwsps.
  s_spsid = spsid.
  s_pdirid = poidid.
  s_rmsid = rmsid.

* if poid id is given, set instance data

  IF NOT poidid IS INITIAL.
    TRY.
        CALL METHOD lcl_start_framework->set_instance_data
          EXPORTING
            im_activity              = activity
*        IM_RMS_ID                =
*        IM_SPS_ID                =
*        IM_SP_POID               =
            im_pdir_id               = s_pdirid
            .
      CATCH cx_srm_initialization INTO ex_srm_initialization.
        cl_srm_application_log=>write_log( ex_srm_initialization ).
        MESSAGE e011(srmf). "internal error (see system log)

      CATCH cx_srm_no_authorization .
        MESSAGE e061(srmf). "not authorized

      CATCH cx_srm_poid INTO ex_srm_poid.
        cl_srm_application_log=>write_log( ex_srm_poid ).
        MESSAGE e023(srmf) WITH s_spsid. "bad sps id

      CATCH cx_srm_registration_data INTO ex_srm_registration_data.
        cl_srm_application_log=>write_log( ex_srm_registration_data ).
        MESSAGE e011(srmf). "internal error (see system log)

      CATCH cx_srm_poid_dir INTO ex_srm_poid_dir.
        cl_srm_application_log=>write_log( ex_srm_poid_dir ).
        MESSAGE e082(srmf). "poid directory error

      CATCH cx_srm INTO ex_srm.
        cl_srm_application_log=>write_log( ex_srm ).
        MESSAGE e011(srmf).
    ENDTRY.

  ENDIF.

  IF ( poidid IS INITIAL ) AND ( NOT spsid IS INITIAL ) .
* -- set model data
    TRY.
        CALL METHOD lcl_start_framework->set_model_data
          EXPORTING
            im_activity = activity
            im_sps_id   = s_spsid
            im_rms_id   = s_rmsid.

      CATCH cx_srm_initialization INTO ex_srm_initialization.
        cl_srm_application_log=>write_log( ex_srm_initialization ).
        MESSAGE e011(srmf). "internal error (see system log)

      CATCH cx_srm_no_authorization .
        MESSAGE e061(srmf). "not authorized

      CATCH cx_srm_poid INTO ex_srm_poid.
        cl_srm_application_log=>write_log( ex_srm_poid ).
        MESSAGE e023(srmf) WITH s_spsid. "bad sps id

      CATCH cx_srm_registration_data INTO ex_srm_registration_data.
        cl_srm_application_log=>write_log( ex_srm_registration_data ).
        MESSAGE e011(srmf). "internal error (see system log)

      CATCH cx_srm_poid_dir INTO ex_srm_poid_dir.
        cl_srm_application_log=>write_log( ex_srm_poid_dir ).
        MESSAGE e082(srmf). "poid directory error

      CATCH cx_srm INTO ex_srm.
        cl_srm_application_log=>write_log( ex_srm ).
        MESSAGE e011(srmf).

    ENDTRY.

  ENDIF.

  TRY.
      data: s_orgrms type string,
            s_orgsps type string.

      s_orgrms = orgrms.
      s_orgsps = orgsps.

      lcl_start_framework->start( option_navigation = navi
                                  option_organizer = organ
                                  organizer_rms_id = s_orgrms
                                  organizer_sps_id = s_orgsps ).

      CATCH cx_srm_initialization INTO ex_srm_initialization.
        cl_srm_application_log=>write_log( ex_srm_initialization ).
        MESSAGE e011(srmf). "internal error (see system log)

      CATCH cx_srm_no_authorization .
        MESSAGE e061(srmf). "not authorized

      CATCH cx_srm_poid INTO ex_srm_poid.
        cl_srm_application_log=>write_log( ex_srm_poid ).
        MESSAGE e023(srmf) WITH s_spsid. "bad sps id

      CATCH cx_srm_registration_data INTO ex_srm_registration_data.
        cl_srm_application_log=>write_log( ex_srm_registration_data ).
        MESSAGE e011(srmf). "internal error (see system log)

      CATCH cx_srm_poid_dir INTO ex_srm_poid_dir.
        cl_srm_application_log=>write_log( ex_srm_poid_dir ).
        MESSAGE e082(srmf). "poid directory error

      CATCH cx_srm INTO ex_srm.
        cl_srm_application_log=>write_log( ex_srm ).
        MESSAGE e011(srmf).

  ENDTRY.

 

Create ZUKM_CASE wrapper transaction

This transaction is later used in Fiori Launchpad Designer target mapping to facilitate insight to action intent navigation.

 

Enhance CL_UDM_LOC_SAPGUI_FE->APPEND_DEFAULT_PARA_VIS method

This enhancement reads Sales Document from AUN memory id and set as Sales Order selection for UKM_CASE transaction. The enhancement checks call stack and is only executed if called from ZUKM_CASE transaction (only for insight to action scenario).

METHOD append_default_para_vis.

  DATA: ls_locpcat TYPE srmlocpcat.

  CALL METHOD super->append_default_para_vis
    EXPORTING
      im_highest_row_no = im_highest_row_no
    CHANGING
      ch_properties     = ch_properties
      ch_para_cat       = ch_para_cat.

  DELETE TABLE ch_properties WITH TABLE KEY id = c_propid_current_only.

  LOOP AT ch_para_cat INTO ls_locpcat.
    CHECK ls_locpcat-id EQ cl_srm_loc_sapgui_fe=>c_propid_num_hits.
    ls_locpcat-val->if_srm_edit_av_single~integer_set( 500 ).
  ENDLOOP.

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(1) Class CL_UDM_LOC_SAPGUI_FE, Method APPEND_DEFAULT_PARA_VIS, End                                                                                   A
*$*$-Start: (1)---------------------------------------------------------------------------------$*$*
ENHANCEMENT 1  ZUKM_CASE1.    "active version
DATA: wt_abap_stack TYPE  abap_callstack,
      wt_sys_stack  TYPE  sys_callst.
*
  CALL FUNCTION 'SYSTEM_CALLSTACK'
       IMPORTING
            callstack          = wt_abap_stack
            et_callstack       = wt_sys_stack.
  CHECK wt_abap_stack[ LINES( wt_sys_stack ) ]-mainprogram = 'ZUKM_CASE'.

  GET PARAMETER ID 'AUN' FIELD DATA(w_vbeln).
  SELECT SINGLE partner
  INTO @DATA(w_partner)
  FROM vbak INNER JOIN cvi_cust_link
                    ON vbak~kunnr = cvi_cust_link~customer
            INNER JOIN but000
                    ON cvi_cust_link~partner_guid = but000~partner_guid
  WHERE vbeln = @w_vbeln.
  SHIFT w_vbeln LEFT DELETING LEADING '0'.

  LOOP AT ch_para_cat INTO DATA(ws_locpcat).
    CASE ws_locpcat-id.
    WHEN 'DCD_OBJ_ID'.
      cl_srm_attr_val_helper=>set_attr_value_by_string(
        im_val       = ws_locpcat-val
        im_new_value = CONV string( w_vbeln ) ).
    WHEN 'DCD_PARTNER'.
       cl_srm_attr_val_helper=>set_attr_value_by_string(
         im_val       = ws_locpcat-val
         im_new_value = CONV string( w_partner ) ).
    ENDCASE.
  ENDLOOP.

ENDENHANCEMENT.
*$*$-End:   (1)---------------------------------------------------------------------------------$*$*
ENDMETHOD.

 

Enhance CL_UDM_CASE_LOCATOR_BE->IF_SRM_LOC_BE~GET_SELECTION_PARA method

This selection fixes UKM_CASE selection criteria presentation issues. The enhancement checks call stack and is only executed if called from ZUKM_CASE transaction (only for insight to action scenario).

METHOD if_srm_loc_be~get_selection_para.

  DATA: ls_selection_para TYPE srmlocpara,
        lref_f4_help      TYPE REF TO cl_udm_locator_searchhelp,
        lref_f4_help_fica TYPE REF TO cl_udm_fica_locator_searchhelp,
        lref_f4_callback  TYPE REF TO if_scmg_attr_f4_callback,
        ls_adque          TYPE srmadque,
        ls_prop_uobj      TYPE srm_prop_uobj,
        lref_ead          TYPE REF TO if_srm_edit_attribute_desc.

  me->initialize( ).

  IF g_my_cases_only EQ if_srm=>true.
    CLEAR re_selection_para.
    RETURN.
  ENDIF.

  CALL METHOD super->if_srm_loc_be~get_selection_para
    RECEIVING
      re_selection_para = re_selection_para.

  READ TABLE re_selection_para WITH KEY id = udmco_fica_gpart
    TRANSPORTING NO FIELDS.
  IF sy-subrc EQ 0.
    lref_f4_help_fica ?= cl_udm_fica_locator_searchhelp=>get_instance( ).
    lref_f4_help_fica->set_locator_be( me ).
    lref_f4_callback ?= lref_f4_help_fica.
  ELSE.
    lref_f4_help ?= cl_udm_locator_searchhelp=>get_instance( ).
    lref_f4_help->set_locator_be( me ).
    lref_f4_callback ?= lref_f4_help.
  ENDIF.

  LOOP AT re_selection_para INTO ls_selection_para.
    IF ls_selection_para-id EQ udmco_customer      OR
       ls_selection_para-id EQ udmco_company       OR
       ls_selection_para-id EQ udmco_fica_gpart    OR
       ls_selection_para-id EQ udmco_fica_vkont_fd OR
       ls_selection_para-id EQ udmco_fica_vtref_fd.
      ls_adque = ls_selection_para-definition->get_query_description( ).
      ls_prop_uobj-id = 'F4'.
      ls_prop_uobj-object ?= lref_f4_callback.
      APPEND ls_prop_uobj TO ls_adque-user_objects.
      lref_ead ?= ls_selection_para-definition.
      lref_ead->set_query_description( ls_adque ).
    ENDIF.
  ENDLOOP.

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(1) Class CL_UDM_CASE_LOCATOR_BE, Interface IF_SRM_LOC_BE, Method GET_SELECTION_PARA, End                                                             A
*$*$-Start: (1)---------------------------------------------------------------------------------$*$*
ENHANCEMENT 1  ZUKM_CASE2.    "active version
DATA: wt_abap_stack TYPE  abap_callstack,
      wt_sys_stack  TYPE  sys_callst.
*
  CALL FUNCTION 'SYSTEM_CALLSTACK'
       IMPORTING
            callstack          = wt_abap_stack
            et_callstack       = wt_sys_stack.
  CHECK wt_abap_stack[ LINES( wt_sys_stack ) ]-mainprogram = 'ZUKM_CASE'.

  LOOP AT re_selection_para INTO ls_selection_para WHERE id = 'DCD_PARTNER'
                                                      OR id = 'DCD_OBJ_ID'.

    DATA(attribute_description) = CAST cl_srm_attribute_description( ls_selection_para-definition ).
    DATA(ws_query_description) = attribute_description->if_srm_attribute_desc~get_query_description( ).
    ws_query_description-is_select_option = abap_false.
    attribute_description->if_srm_edit_attribute_desc~set_query_description( ws_query_description ).
    ls_selection_para-definition = CAST #( attribute_description ).
  ENDLOOP.

ENDENHANCEMENT.
*$*$-End:   (1)---------------------------------------------------------------------------------$*$*
ENDMETHOD.

 

Bonus content

Simplified ZUKM_CASE transaction is used in Fiori target mapping

Target mapping in its turn is used in Fiori Elements List app custom action handler

 

 

 

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.