To maintain orders in Assetmanagement (SAP component PM-WOC-MO "Maintenance Orders") we can currently use these different UIs:
- classic WinGUI (e.g. Transaction IW32)
- htmlGUI (e.g. Transaction IW32 html-based)
- WebDynpro for ABAP (App EAMS_WDA_ORDNTF_OIF)
- Fiori/UI5 (e.g. App F2175 "Find Maintenance Orders")
Depending on the UI, the message-handling in userexits like IWO10002 "PM maintenance order: Customer check for order release" or BADIs like WORKORDER_UPDATE "Business Add-Inn PM/PP/PS/Pi Orders: Operation: UPDATE" can be quite different.
To enable all the possible UIs for users of several company areas and to increase usabilitiy, I had to implement a different message-handling depending on the UI.
So at first I had to determine the UI-Technology the User is currently using. This is the method to do this:
*"----------------------------------------------------------------------
*"Methoden Signatur:
*" Returning
*" VALUE(MES_GUI) TYPE IHTTPNVP
*"----------------------------------------------------------------------
METHOD get_ui_type.
*-- HGU - Html SAP GUI
DATA: lv_its_active TYPE flag.
CALL FUNCTION 'GUI_IS_ITS'
IMPORTING
return = lv_its_active.
IF lv_its_active IS NOT INITIAL.
mes_gui-name = 'HGU'.
mes_gui-value = 'Html SAP GUI'.
RETURN.
ENDIF.
*- BatchInput (muss vor WGU stehen!)
IF sy-binpt IS NOT INITIAL.
mes_gui-name = 'BNP'.
mes_gui-value = 'BatchInput'.
RETURN.
ENDIF.
*-- WGU - Windows SAP GUI
DATA: lv_gui_active TYPE flag.
CALL FUNCTION 'GUI_IS_AVAILABLE'
IMPORTING
return = lv_gui_active.
IF lv_gui_active IS NOT INITIAL.
mes_gui-name = 'WGU'.
mes_gui-value = 'Windows SAP GUI'.
RETURN.
ENDIF.
*-- BSP - Business Server Pages
DATA(lr_bsp_server) = cl_bsp_runtime=>if_bsp_runtime~server.
IF lr_bsp_server IS BOUND.
mes_gui-name = 'BSP'.
mes_gui-value = 'Business Server Pages'.
RETURN.
ENDIF.
*-- WDA - WebDynpro for ABAP
DATA(lr_wd_server) = wdr_task=>server.
IF lr_wd_server IS BOUND.
mes_gui-name = 'WDA'.
mes_gui-value = 'WebDynpro ABAP'.
RETURN.
ENDIF.
*-- ODA - oData (Fiori, ...)
DATA(lo_batch_helper) = /iwfnd/cl_mgw_batch_helper=>get_batch_helper( ). "wird angelegt, wenn nicht aktiv!
lo_batch_helper->batch_get_service_name_version( "Daher keine Prüfung 'IS BOUND'nötig
IMPORTING
ev_service_name = DATA(lv_service_name)
ev_service_version = DATA(lv_service_version)
).
IF lv_service_name IS NOT INITIAL.
mes_gui-name = 'ODA'.
mes_gui-value = 'oData (Fiori, ...)'.
RETURN.
ENDIF.
*-- Hintergrundverarbeitung/Background (Job/...)
IF sy-batch IS NOT INITIAL.
mes_gui-name = 'BAT'.
mes_gui-value = 'batch / background'.
RETURN.
ENDIF.
ENDMETHOD.
The method determines the UI Technology and returns a 3 character long ID for the UI (mes_gui-name) and a short explanation (mes_gui-value):
- HGU - Html SAP GUI
- BNP - BatchInput
- WGU - Windows SAP GUI
- BSP - Business Server Pages (or WCF Web Client Framework in S/4-Service)
- WDA - WebDynpro for ABAP
- ODA - oData (Fiori, ...)
- BAT - Batch / Background (Job, ...)
These results are similar to, but not exactly the same than the Framework-IDs you can get from the "Info"-entry in Launchpad user menu for each app:
I suppose it is not possible to identify the UI "Fiori" or "UI5" directly from ABAP in general, as there is always something like an oData-Service in between the UI and my custom ABAP-code, and this oData-Service can be consumed by any possible UI or even without UI. But for my purposes during message-handling in Assetmanagement it is enough to know, that an oData-Service is active and then I conclude the UI is Fiori/UI5.
It seems that there are some more ways to identify the different UIs like "CHECK CL_WEB_DYNPRO=>IS_ACTIVE = abap_true." for WDA or "CHECK cl_gui_object=>gui_is_running = abap_true." for GUI. If you know/find some more, please feel free to comment.
Hint: The identification of UI-Technology WCF (Web Client Framework) in S/4-Service can be done via the BSP-Check within above method, too. But as far as I know, there does not exist any different UI than WCF in S/4-Service. So the check would not be necessary there (e.g. in BADI CRMS4_SERV_CHECK_BEFORE_SAVE).
No comments:
Post a Comment