Skip to Content

Create Universal Worklist Configuration file for EHS Management

The Universal Worklist (UWL) provides users central access to various work items in the SAP NetWeaver Portal. An UWL collects work items from multiple provider systems in one list.

For SAP EHS Management, you have the possibility to include all your EHS Management related tasks into an UWL. By selecting an EHS Management task in the UWL, you can directly navigate into the application by object-based navigation. To do so, an UWL configuration file is needed. This file contains information about the tasks that are available for EHS Management and the objects, methods, and parameters that are needed for the navigation.

To create an EHS Management specific UWL configuration file, execute the following Z-report ZR_EHFND_CREATE_UWL_CONFIG in your EHS Management backend system. The report extracts the needed data and creates an XML-file that you can save on you PC and upload to your SAP NetWeaver Portal.
Afterwards, you have to perform the general configuration steps described in the documentation for Universal Worklists on the SAP Help Portal under http://help.sap.com/nw74
. In section Application Help, open the documentation for SAP NetWeaver Portal. Go to SAP Enterprise Portal -> Universal Worklist -> Configuring the Universal Worklist.

Source code ZR_EHFND_CREATE_UWL_CONFIG:

*&---------------------------------------------------------------------*
*& Report  ZR_EHFND_CREATE_UWL_CONFIG
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  zr_ehfnd_create_uwl_config.

**********************************************************************
* TYPE DEFINITION
**********************************************************************

CLASS lcl_ibo_provider DEFINITION.

 
PUBLIC SECTION.

   
INTERFACES if_ehfnd_wff_ibo_cfg_prov .
ENDCLASS.                    "lcl_ibo_provider DEFINITION

**********************************************************************
* DATA DEFINITION
**********************************************************************
DATA: lo_config_provider TYPE REF TO lcl_ibo_provider.
DATA: lo_uwl_util        TYPE REF TO cl_ehfnd_wff_uwl_util.
DATA: lv_uwl_config      TYPE string.
DATA: lv_transl_props    TYPE string.

DATA: lt_app_ids         TYPE ehfndt_wff_powl_atyp_range.
DATA: ls_app_ids         TYPE ehfnds_wff_powl_atyp_range.
DATA: lt_app_id          TYPE TABLE OF ibo_c_wf_ta_p_ty-appl_id.
DATA: lv_app_id          TYPE ibo_c_wf_ta_p_ty-appl_id.

DATA: lo_zip             TYPE REF TO cl_abap_zip.
DATA: lv_file_data       TYPE xstring.
DATA: lv_uwl_xml_data    TYPE xstring.
DATA: lv_properties_data TYPE xstring.

DATA: lv_file_name       TYPE string.

DATA: lv_flag_abort      TYPE abap_bool.

DATA: gv_navn            TYPE string VALUE `com.sap.pct.eh.uwl.ehsm`.

**********************************************************************
* PARAMETERS
**********************************************************************
PARAMETERS: p_transl TYPE abap_bool DEFAULT abap_true AS CHECKBOX.
PARAMETERS: p_incvws TYPE abap_bool DEFAULT abap_false AS CHECKBOX.
PARAMETERS: p_noact  TYPE abap_bool DEFAULT abap_false AS CHECKBOX.

**********************************************************************
* Do some work
**********************************************************************
START-OF-SELECTION.

 
CLEAR: lt_app_ids, lt_app_id.

  ls_app_ids
-sign   = 'I'.

  ls_app_ids
-option = 'EQ'.


* Find out Application IDs for EHSM Inboxes
*--------------------------------------------------------------------*

* Query all EH* Applications from the IBO_C_WF_TA_P_TY table

 
SELECT appl_id FROM ibo_c_wf_ta_p_ty INTO TABLE lt_app_id.

 
DELETE ADJACENT DUPLICATES FROM lt_app_id.

 
LOOP AT lt_app_id INTO lv_app_id.

   
IF lv_app_id CP 'EH*'.

      ls_app_ids
-low    = lv_app_id.

     
APPEND ls_app_ids TO lt_app_ids.

   
ENDIF.

 
ENDLOOP.


* Then create the configuration
*--------------------------------------------------------------------*

 
CREATE OBJECT lo_config_provider.

 
CREATE OBJECT lo_uwl_util

   
EXPORTING

      io_config_provider
= lo_config_provider.

  lv_uwl_config
= lo_uwl_util->create_uwl_config_multi_app(

      it_application_id       
= lt_app_ids

      iv_nav_node_name        
= gv_navn

      iv_include_views        
= p_incvws

      iv_incl_task_without_act
= p_noact  ).


* Transform the UWL XML Textdata into a binary string

  lv_uwl_xml_data
= cl_ehfnd_file_util=>convert_textfile_to_xstring( iv_data = lv_uwl_config

                                                                     iv_codepage
= 'UTF-8' ).


* Prepare the export file

 
IF p_transl EQ abap_true.

    lv_transl_props
= lo_uwl_util->get_properties_file_string( ).

    lv_properties_data
= cl_ehfnd_file_util=>convert_textfile_to_xstring( iv_data = lv_transl_props

                                                                          iv_codepage
= 'UTF-8' ).

   
CREATE OBJECT lo_zip.

    lo_zip
->add( EXPORTING name    = 'ehsm.xml'     " Name (Case-Sensitive)

                           content
= lv_uwl_xml_data ).

    lo_zip
->add( EXPORTING name    = 'ehsm.properties'     " Name (Case-Sensitive)

                           content
= lv_properties_data ).

    lv_file_data
= lo_zip->save( ).

    lv_file_name
= 'uwl_ehsm.zip'.

 
ELSE.

    lv_file_data
= lv_uwl_xml_data.

    lv_file_name
= 'uwl_ehsm.xml'.

 
ENDIF.


* Download the file

  cl_ehfnd_file_util
=>download_from_sap_gui(

   
EXPORTING

      iv_default_file_name
= lv_file_name  " Name of the file without path

      iv_file_data        
= lv_file_data    " Data of the file

   
IMPORTING

      ev_flg_abort        
= lv_flag_abort

 
).


 
IF lv_flag_abort EQ abap_true.

   
" an error occurred. show the message and return

   
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

              
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

 
ELSE.

   
WRITE:/ 'Success: File downloaded'.                     "#EC NOTEXT

 
ENDIF.


 
"LCL_IBO_PROVIDER DEFINITION


*----------------------------------------------------------------------*
*       CLASS lcl_ibo_provider IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_ibo_provider IMPLEMENTATION.

 
METHOD if_ehfnd_wff_ibo_cfg_prov~get_actions_for_task_type.


   
DATA: lt_action_list          TYPE ibo_t_wf_cfg_action_info.

   
DATA: lr_s_action_list        TYPE REF TO ibo_s_wf_cfg_action_info.

   
DATA: ls_ehfnd_action_param   TYPE ehfnds_wf_cfg_action_info.


   
TRY.

        cl_ibo_wf_inbox_cfg_prov
=>get_actions_for_task_type(

                                   
EXPORTING iv_powl_applid = iv_powl_applid

                                              iv_task_type  
= iv_task_type

                                              iv_wi_status  
= 'READY'

                                   
IMPORTING et_action_list = lt_action_list ).
*       convert the IBO table into EHSM table

       
CLEAR: et_action_list.

       
LOOP AT lt_action_list REFERENCE INTO lr_s_action_list.


         
CLEAR: ls_ehfnd_action_param.

         
MOVE-CORRESPONDING lr_s_action_list->* TO ls_ehfnd_action_param.

         
INSERT ls_ehfnd_action_param INTO TABLE et_action_list.


       
ENDLOOP.


     
CATCH cx_ibo_wf_error cx_ibo_wf_abort.

       
CLEAR et_action_list.

   
ENDTRY.

 
ENDMETHOD.                    "if_ehfnd_wff_ibo_cfg_prov~get_actions_for_task_type


 
METHOD if_ehfnd_wff_ibo_cfg_prov~get_action_info.

   
TRY.

       
DATA: ls_action_info TYPE ibo_s_wf_cfg_action_info.

        ls_action_info
= cl_ibo_wf_inbox_cfg_prov=>get_action_info(

           iv_action_name
= iv_action_name

           iv_powl_applid
= iv_powl_applid

          
).

       
MOVE-CORRESPONDING ls_action_info TO rs_action_info.

     
CATCH cx_ibo_wf_error cx_ibo_wf_abort.

       
CLEAR rs_action_info.

   
ENDTRY.

 
ENDMETHOD.                    "if_ehfnd_wff_ibo_cfg_prov~get_action_info


 
METHOD if_ehfnd_wff_ibo_cfg_prov~get_default_action.

   
TRY.

        cl_ibo_wf_inbox_cfg_prov
=>get_default_action(

         
EXPORTING

            iv_task_type  
= iv_task_type

            iv_wi_status  
= 'READY'

            iv_powl_applid
= iv_powl_applid

         
IMPORTING

            ev_action     
= ev_action

           
).

     
CATCH cx_ibo_wf_error cx_ibo_wf_abort.

       
CLEAR ev_action.

   
ENDTRY.

 
ENDMETHOD.                    "if_ehfnd_wff_ibo_cfg_prov~get_default_action


 
METHOD if_ehfnd_wff_ibo_cfg_prov~get_tasks_for_application.

   
DATA: lt_ibo_config TYPE TABLE OF ibo_c_wf_ta_p_ty.

   
DATA: ls_ehfnd_ta_p_ty TYPE ehfnds_wf_ta_p_ty.

   
DATA: lr_s_ibo_config TYPE REF TO ibo_c_wf_ta_p_ty.

   
CLEAR rt_tasks.

   
SELECT * FROM ibo_c_wf_ta_p_ty INTO TABLE lt_ibo_config WHERE appl_id IN it_application_ids .

   
LOOP AT lt_ibo_config REFERENCE INTO lr_s_ibo_config.

      ls_ehfnd_ta_p_ty
-appl_id   = lr_s_ibo_config->appl_id.

      ls_ehfnd_ta_p_ty
-powl_type = lr_s_ibo_config->powl_type.

      ls_ehfnd_ta_p_ty
-task_id   = lr_s_ibo_config->task_id.

     
APPEND ls_ehfnd_ta_p_ty TO rt_tasks.

   
ENDLOOP.

 
ENDMETHOD.                    "if_ehfnd_wff_ibo_cfg_prov~get_tasks_for_application


 
METHOD if_ehfnd_wff_ibo_cfg_prov~get_task_info_for_task_type.

   
TRY.

        rs_task_type
= cl_ibo_wf_inbox_cfg_prov=>get_task_info_for_task_type(

            iv_powl_applid
= iv_powl_applid

            iv_task_type  
= iv_task_type

       
).

     
CATCH cx_ibo_wf_error cx_ibo_wf_abort.

       
CLEAR rs_task_type.

   
ENDTRY.

 
ENDMETHOD.                    "if_ehfnd_wff_ibo_cfg_prov~get_task_info_for_task_type


 
METHOD if_ehfnd_wff_ibo_cfg_prov~get_powl_type_descs.

   
DATA: lt_types TYPE powl_type_tty.

   
DATA: lr_s_type TYPE REF TO powl_type_sty.

   
DATA: ls_type_desc TYPE ehfnds_wff_powl_type_desc.


    lt_types
= cl_powl_type_accessor=>get_types(

       i_applid       
= iv_app_id

       i_langu        
= 'E' " Always load in english

  
).


   
CLEAR rt_type_descs.

   
LOOP AT lt_types REFERENCE INTO lr_s_type.

      ls_type_desc
-type        = lr_s_type->type.

      ls_type_desc
-description = lr_s_type->description.

     
APPEND ls_type_desc TO rt_type_descs.

   
ENDLOOP.


 
ENDMETHOD.                    "if_ehfnd_wff_ibo_cfg_prov~GET_POWL_TYPE_DESCS
ENDCLASS.                    "lcl_ibo_provider IMPLEMENTATION


Tags:

No comments