HI SCN Folks,
Note:
01. There are several ways to implement it, and the blog that’s written is one of the ways.
02. There are no screenshots attached related to SAP Logon & SAP MDG UI Screens.
03. In this blog, example which i taken the development of one of the Enhancement UIBB & a Method is GET_DATA.
Faced Problem:
Every time i used to call the below program for different placeholders & for different requirements. In short, making use of the same code again & again.
ZSU_MDG_CL_ENH_CUS_UIBB
DATA :
lv_cr_number TYPE usmd_crequest,
lv_crtype TYPE usmd_crequest_type,
lv_process TYPE usmd_process.
DATA(lo_context) = cl_usmd_app_context=>get_context( ).
IF lo_context IS BOUND.
CALL METHOD lo_context->get_attributes
IMPORTING
ev_crequest_id = lv_cr_number
ev_crequest_type = lv_crtype
ev_process = lv_process.
ENDIF.
IF lv_crtype EQ ‘ZSUCRTYPE’.
“Requirement Logic
ENDIF.
How to reduce this reusability? Please follow the below process
01. Create one custom class.
ZSU_MDG_CL_GENERIC (Class)
02. Create one Static Method (Level), Public (Visibility) & Exporting Parameters.
GET_CR_RELATED
class-methods GET_CR_RELATED
exporting
!EO_MODEL type ref to IF_USMD_MODEL_EXT
!EV_PARENT_PROCESS type USMD_PROCESS
!EV_PROCESS type USMD_PROCESS
!EV_WI_ID type SWW_WIID
!EV_CREQUEST_ID type USMD_CREQUEST
!EV_CREQUEST_TYPE type USMD_CREQUEST_TYPE
!EV_CREQUEST_STEP type USMD_CREQUEST_APPSTEP
!EV_CREQUEST_INDEX type USMD_CREQUEST_WFINDEX
!EV_EDITION type USMD_EDITION
!EV_OTC type USMD_OTC .
03. Now enter the below code in the method (Source Code).
method GET_CR_RELATED.
DATA:
lo_app_ctxt TYPE REF TO if_usmd_app_context.
lo_app_ctxt = cl_usmd_app_context=>get_context( ).
IF lo_app_ctxt IS BOUND.
lo_app_ctxt->get_attributes(
IMPORTING
eo_model = eo_model
ev_process = ev_process
ev_wi_id = ev_wi_id
ev_crequest_id = ev_crequest_id
ev_crequest_type = ev_crequest_type
ev_crequest_step = ev_crequest_step
ev_crequest_index = ev_crequest_index
ev_otc = ev_otc
).
ENDIF.
endmethod.
Done with part of this class (ZSU_MDG_CL_GENERIC).
Now It’s time to use it in any development placeholder; in this blog, implementing it in (ZSU_MDG_CL_ENH_CUS_UIBB).
DATA: lv_creq_type TYPE usmd_crequest_type,
lv_wf_step TYPE usmd_crequest_appstep.
CALL METHOD ZSU_MDG_CL_GENERIC=>get_cr_related
IMPORTING
ev_crequest_type = lv_creq_type ” Type of Change Request
ev_crequest_step = lv_wf_step.
IF lv_crtype EQ ‘ZSUCRTYPE’.
IF lv_wf_step = ’00’.
“Requirement Logic
ENDIF.
ENDIF.
Thank You,
Sandeep Suggu.
SAP Community Profile | SAP Profile | LinkedIn
HI SCN Folks, Note:01. There are several ways to implement it, and the blog that’s written is one of the ways.02. There are no screenshots attached related to SAP Logon & SAP MDG UI Screens.03. In this blog, example which i taken the development of one of the Enhancement UIBB & a Method is GET_DATA.Faced Problem:Every time i used to call the below program for different placeholders & for different requirements. In short, making use of the same code again & again.ZSU_MDG_CL_ENH_CUS_UIBBDATA :
lv_cr_number TYPE usmd_crequest,
lv_crtype TYPE usmd_crequest_type,
lv_process TYPE usmd_process.
DATA(lo_context) = cl_usmd_app_context=>get_context( ).
IF lo_context IS BOUND.
CALL METHOD lo_context->get_attributes
IMPORTING
ev_crequest_id = lv_cr_number
ev_crequest_type = lv_crtype
ev_process = lv_process.
ENDIF.
IF lv_crtype EQ ‘ZSUCRTYPE’.
“Requirement Logic
ENDIF.How to reduce this reusability? Please follow the below process01. Create one custom class. ZSU_MDG_CL_GENERIC (Class)02. Create one Static Method (Level), Public (Visibility) & Exporting Parameters. GET_CR_RELATED class-methods GET_CR_RELATED
exporting
!EO_MODEL type ref to IF_USMD_MODEL_EXT
!EV_PARENT_PROCESS type USMD_PROCESS
!EV_PROCESS type USMD_PROCESS
!EV_WI_ID type SWW_WIID
!EV_CREQUEST_ID type USMD_CREQUEST
!EV_CREQUEST_TYPE type USMD_CREQUEST_TYPE
!EV_CREQUEST_STEP type USMD_CREQUEST_APPSTEP
!EV_CREQUEST_INDEX type USMD_CREQUEST_WFINDEX
!EV_EDITION type USMD_EDITION
!EV_OTC type USMD_OTC .03. Now enter the below code in the method (Source Code). method GET_CR_RELATED.
DATA:
lo_app_ctxt TYPE REF TO if_usmd_app_context.
lo_app_ctxt = cl_usmd_app_context=>get_context( ).
IF lo_app_ctxt IS BOUND.
lo_app_ctxt->get_attributes(
IMPORTING
eo_model = eo_model
ev_process = ev_process
ev_wi_id = ev_wi_id
ev_crequest_id = ev_crequest_id
ev_crequest_type = ev_crequest_type
ev_crequest_step = ev_crequest_step
ev_crequest_index = ev_crequest_index
ev_otc = ev_otc
).
ENDIF.
endmethod.Done with part of this class (ZSU_MDG_CL_GENERIC). Now It’s time to use it in any development placeholder; in this blog, implementing it in (ZSU_MDG_CL_ENH_CUS_UIBB). DATA: lv_creq_type TYPE usmd_crequest_type,
lv_wf_step TYPE usmd_crequest_appstep.
CALL METHOD ZSU_MDG_CL_GENERIC=>get_cr_related
IMPORTING
ev_crequest_type = lv_creq_type ” Type of Change Request
ev_crequest_step = lv_wf_step.
IF lv_crtype EQ ‘ZSUCRTYPE’.
IF lv_wf_step = ’00’.
“Requirement Logic
ENDIF.
ENDIF. Thank You, Sandeep Suggu.SAP Community Profile | SAP Profile | LinkedIn Read More Technology Blog Posts by Members articles
#SAP
#SAPTechnologyblog