Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

Universal Work List (UWL) for a Business User can be achieved via Duet Enterprise by extending pre-delivered Gateway data model for Workflow generic task. A business user can access all his workflow tasks as in a SharePoint list. User can take decision to Approve or Reject specific tasks. This can be achieved in 2 steps, extending workflow generic task model in ABAP and reworking on BDC model at SharePoint.

Pre-requisite

  • Configured Gateway System with Duet Enterprise
  • BDC Browser configurations done
  • ERP system for Business Workflow
  • RFC destination and system alias to the ERP system  should be configured
  • The System alias should be assigned to IW_WF GSDO group. (using Manage GSDO group in IMG)

Modifications in Gateway system

Update WF GSDO

Update the IMG configuration for IWF_WF_GEN_TASK GSDO. 

Transaction SPRO->SAP Reference IMG ->SAP Netweaver -> Gateway -> Former Development-> Former Generic Channel Development ->Generic Service data object (GSDO) -> GSDO Types and GSDO Contexts and GSI Impl. Execute this IMG node.

Make sure that your GSDO looks like in the screenshot. The CompName and GSDO Data Object Name must be blank. So if there is some value remove from these columns.

  1. Generate the flat service for Workflow Generic Task gateway object via BDC browser tool.

  GSDO Type Name: IWF_WF_GEN_TASK 

          Provide the prefix name and package name. Make sure that you select Update operation.

         

          A flat Web Service for UWL will get generated in the specified package.

  2.   Create a new BSO for IWF_WF_GEN_TASK.          

        A new BSO class has to be created to handle the UPDATE of a generic task. The existing BSO does not allow updating workflow task in ERP system.

  1. Go to se24 and provide the class name as /IWCNT/CL_WF_GEN_TASK_BSO.
  2. Click on Copy class button on the top menu
  3. Provide the name for new class for e.g. ZCL_BSO_WF_TASK
  4. Add the new class to your package (specify transport request if any)
  5. The new class is still inactive. Go to method GET_BOP_MAP_GET_UPDATE, and replace the entire existing code with the following code

method get_bop_map_get_update.

 
data  lo_wf_task_con_upd_map type ref to  /iwcnt/cl_boprr_wf_con_upd_map" for container update
 
data  lv_bop_id              type         /iwfnd/bec_bop_id.

 
create object lo_wf_task_con_upd_map.
        ro_bop_map_update
= lo_wf_task_con_upd_map.
        lv_bop_id        
= /iwcnt/if_wf_task_gw_constants=>bop_ids-wi_action.
* get the bop do instance
 
call method me->create_rfc_bop
   
exporting
      iv_bop_id  
= lv_bop_id
    receiving
      er_instance
= ro_bop_map_update->mo_bop.

  mv_upd_read_buf_for_create_upd
= abap_true.
endmethod.

vi.   Save and activate the method. Also activate the new BSO class.

vii.   Update the IMG configuration for IWF_WF_GEN_TASK GSDO. (Ignore if already done).

Make sure that your GSDO looks like in the screenshot. The CompName and GSDO Data Object Name must be blank. So if there is some value remove from these columns.

This is a mandatory step, dont miss it.

Also update the GSI implementation for IWF_WF_GEN_TASK GSDO as shown in be below screenshot. Replace the class/interface for the Adaptation BSO with the newly created BSO class.

  3.   Create Inbound Mapper for handling update scenario.

Inbound mapper can be created via IMG => Service Consumption Layer Development => Consumer Adaptation => Consumer Inbound Mapping Integration : BAdi

  • Click on Execute
  • A screen with existing implementations is shown. Click on new button at the bottom.
  • Names for Enhancement implementation and description. Add the enhancement implementation in your package.
  • Provide the name for BAdi and Implementation class.
  • BAdi Filter should look like this

    ·  Implement the Update method of the Implementation class. The code in the update method is as follows.

      Note : Make sure that you change the highlighted section depending upon the input of update method in the Web Service. (It should be of the same type as that of ls_input in the update method of provider class).

method /iwfnd/if_cal_badi_ib_mapping~map_update.
 
data: ls_ws_input type zwf_gen_pbaiwf_wf_gen_s,
      ls_key
type /iwfnd/s_cor_id,
      ls_root_key
type /iwcnt/cl_wf_gen_task_stc_gsdo=>workflow_task_key,
      ls_extn_key
type /iwcnt/cl_wf_gen_task_stc_gsdo=>extensible_elements_key,
      ls_extn_attr
type /iwcnt/cl_wf_gen_task_stc_gsdo=>extensible_elements_atts,
     
"ls_item_attr type zsales_order_stc=>sales_items_atts,
      lo_gsdo
type ref to /iwfnd/if_srd_gsdo,
      root_node
type ref to /iwfnd/if_srd_gsdo_node,
      lo_dec_option
type ref to /iwfnd/if_srd_gsdo_node,
      lo_extn
type ref to /iwfnd/if_srd_gsdo_node.
" Map the generic inbound message to WS REQUEST ...
      ls_ws_input
= is_inbound_message.
*convert string to key
 
try.
      /iwfnd/cl_id_util
=>convert_string_id_to_key( exporting iv_string = ls_ws_input-workflow_task_id
                                                  
importing es_key = ls_key ).
   
catch /iwfnd/cx_cod." into lx_ifl_cod.
     
" do some logging here ...
 
endtry.

      ls_root_key
-value = ls_key-value.
      ls_root_key
-scheme_agency_id = ls_key-scheme_agency_id.
      ls_root_key
-scheme_id = ls_key-scheme_id.

      lo_gsdo
= co_gsdo_list->get_first( ).
      root_node
= lo_gsdo->get_root_node( ).

      ls_extn_attr
-decision = ls_ws_input-act_dec.

     
if ls_extn_attr-decision is not initial.
        lo_extn
= root_node->get_relation( 'EXTENSIBLE_ELEMENTS' )->get_first( ).
        lo_extn
->set_attributes( ls_extn_attr ).

     
endif.
endmethod.

1.       4.   Test ABAP UWL Web Service.

     You can test the Web Service via transaction se80.  Navigate to package where web service is created. Click on the test icon on the top menu.

    Select the operation as FIND_IWCNT_OM_WF_GEN_TASKBY_EL , the request should be as described in the following screenshot. (remove all the input filter values)

   The output contain all the task assigned to the logged in user.

   Once the service is tested in SharePoint, the solution can be extended in SharePoint layer.

   Export the BDC model from the BDC browser and make the appropriate changes as mentioned below.

Modifications in Sharepoint side:

Ensure to remove all TypeDescriptors other than below mentioned TypeDescriptors from Finder/Specific Finder/Update methods:

<TypeDescriptor TypeName="System.String" ReadOnly="true" IdentifierName="WORKFLOW_TASK_ID" Name="WORKFLOW_TASK_ID" />

<TypeDescriptor TypeName="System.String" Name="STATUS_TXT" />

<TypeDescriptor TypeName="System.String" Name="TYPE" />

<TypeDescriptor TypeName="System.Decimal" Name="NOTE_COUNT" />

<TypeDescriptor TypeName="System.DateTime" Name="CREATED_AT">

        <Interpretation>

              <NormalizeDateTime LobDateTimeMode="UTC" />

        </Interpretation>

</TypeDescriptor>

<TypeDescriptor TypeName="System.String" Name="GUI_LINK" />

<TypeDescriptor TypeName="System.String" Name="PRIORITY" />

<TypeDescriptor TypeName="System.DateTime" Name="START_DL">

         <Interpretation>

               <NormalizeDateTime LobDateTimeMode="UTC" />

         </Interpretation>

</TypeDescriptor>

<TypeDescriptor TypeName="System.String" Name="ACT_DEC" />

<TypeDescriptor TypeName="System.String" Name="REASSIGN_BY" />

<TypeDescriptor TypeName="System.String" Name="ACTUAL_OWNER" />

<TypeDescriptor TypeName="System.String" Name="REASSIGN_TO" />

<TypeDescriptor TypeName="System.String" Name="LANGUAGE" />

<TypeDescriptor TypeName="System.String" Name="SUBJECT" />

<TypeDescriptor TypeName="System.String" Name="TASK_NAME" />

<TypeDescriptor TypeName="System.String" Name="ACT_DEC_AGENT" />

<TypeDescriptor TypeName="System.String" Name="CREATED_BY" />

<TypeDescriptor TypeName="System.String" Name="STATUS" />

<TypeDescriptor TypeName="System.DateTime" Name="END_DL">

         <Interpretation>

               <NormalizeDateTime LobDateTimeMode="UTC" />

         </Interpretation>

</TypeDescriptor>

<TypeDescriptor TypeName="System.String" Name="RESERVED_BY" />

<TypeDescriptor TypeName="System.String" Name="DESCRIPTIODESCRIPTION" />

Sample BDC model with only relevant TypeDescriptors: Workflow_Task_Model

Create External List

After importing the updated BDC model in the Central Admin, create an External List with the name: WorkList corresponding to the uploaded Task entity.

Ensure that the WorkList gets populated with list of Workflow tasks & Update method executes successfully.

ACT_DEC field will be considered for updating status of Workflow task to Approve/Reject.

Field value: 0001 = Approve, 0002 = Reject.

This list can be easily extended to HTML 5 UI and rendered in a much user friendly way.

There are documents and blogs available in MSDN on "Enabling Sharepoint 2010 external lists on Silverlight UI".

Link: Retrieve List Items from External List

Link: Consuming SAP data on Silverlight UI

With this, Business Workflow Inbox in SAP system can now be replicated in SharePoint list via UWL.

A business user can take actions (approve/reject) on task items from Sharepoint and subsequent task will be updated in SAP system.

6 Comments