I guess everyone working with SAP Business Workflow has had the question to make the Workflow inbox available as a Web-Based inbox?

Up until today, we had some choices (UWL, WebDynpro POWL, custom, …) but all of them has some drawbacks:

– UWL can only be used when you have an SAP Portal

– Custom development is time consuming and costly

– WebDynpro POWL’s such as “IBO_WDA_INBOX” (used on SRM but also available on ECC) and “SWF_WORKPLACE” (mostly used on ECC) require some configurations to make sure that all Tasks you want can be executed

My personal frustration – and I guess also a lot of yours too – while using the WD4A’s is that every task (TS) needs to be configured whereas by standard SAP all tasks run within the SBWP and the UWL regardless whether they are SAPGui based or WebBased.

Don’t get me wrong, the provided configurations in those WD4A workflow inboxes are really an added value, but if you want to use this inbox as an alternative to SBWP or the UWL, it doesn’t work just like that!

So my question to SAP, why are the existing WebDynpro based workflow inboxes not working right away out of the box?

Anyway, I did not wait for this answer and “enhanced” those 2 Web-based (WD4A) workflow inboxes myself so they could cope with ALL tasks (whether they are SAPGui based tasks, Webflow Tasks or even alternatives specified in SWFVISU or their respective configuration capabilities).

First of all, I created myself a Function module that is able to launch the Workitem, this FM will be used in both of the WebDynpro for ABAP Workflow inboxes…

Creating a function to Launch the Workitem

This function module will be able to launch the following types of workitem from within the mentioned WebDynpro for ABAP applications above:

– WebFlow Tasks

– SWFVISU configured alternative visualizations

– SAPGui Tasks by means of WebGui

Also, the function will call the Task execution differently depending on whether the call originates from NWBC, Portal or stand-alone WD4A

So, here is the code I used for this function module:

FUNCTION ZWDWF_LAUNCH_WORKITEM . *"---------------------------------------------------------------------- *"*"Local Interface: *"  IMPORTING *"     REFERENCE(IV_WIID) TYPE  SWW_WIID *"     REFERENCE(IV_LANGUAGE) TYPE  SYLANGU DEFAULT SY-LANGU *"  CHANGING *"     REFERENCE(WD_COMPONENT) TYPE REF TO  IF_WD_COMPONENT OPTIONAL *"----------------------------------------------------------------------   data: lr_window_mgr        type ref to if_wd_window_manager,         lo_window            type ref to if_wd_window,         lv_url               type swr_url,         lv_wi_execute_url    type string,         lv_unescaped_url     type string,         lv_escaped_url       type string,         lv_navigation_target type string,         lv_window_features   type string,         lv_window_name       type string,         lv_target_title      type string,         lv_portal_event      type ref to cl_wdr_portal_event,         lv_context_url       type string,         lv_length_url        type i,         lv_post_body         type string,         lv_nav_mode          type string,         lv_his_mode          type string,         lv_config_mode       type string,         lv_appkey            type swn_appkey,         lv_apptype           type swn_apptype,         lv_wi_detail         type SWR_WIDTL,         lv_return_code       type SY-SUBRC. * *----- STEP 1 - Get the URL to be started for the Workitem execution *--- 1A - Retrieve the URL for the WI execution from WEBFLOW   CALL FUNCTION 'SAP_WAPI_LAUNCH_URL_GET'     EXPORTING       WORKITEM_ID = iv_wiid       language    = iv_language     IMPORTING       URL         = lv_url.   if not lv_url is initial.     lv_wi_execute_url = lv_url.   else. *--- 1B - Retrieve the URL for WEBDynpro for ABAP execution     lv_appkey = iv_wiid.     CALL FUNCTION 'SAP_WAPI_GET_WORKITEM_DETAIL'       EXPORTING         WORKITEM_ID     = iv_wiid       IMPORTING         WORKITEM_DETAIL = lv_wi_detail         RETURN_CODE     = lv_return_code.     lv_apptype = lv_wi_detail-wi_rh_task.     CALL METHOD CL_SWN_URL_GENERATOR=>GET_WI_EXECUTE_URL_WDABAP       EXPORTING         I_APP_KEY                = lv_appkey         I_APP_TYPE               = lv_apptype       RECEIVING         R_URL                    = lv_wi_execute_url       EXCEPTIONS         CONFIGURATION_INCOMPLETE = 1         FAILED                   = 2         others                   = 3.     IF SY-SUBRC  0.       clear : lv_wi_execute_url.     ENDIF. *--- 1C - Retrieve the URL for WEBGui execution     if lv_wi_execute_url is initial.       lv_appkey = iv_wiid.       CALL METHOD CL_SWN_URL_GENERATOR=>GET_WI_EXECUTE_URL_WEBGUI         EXPORTING           I_APP_KEY                = lv_appkey           I_APP_TYPE               = lv_apptype         RECEIVING           R_URL                    = lv_wi_execute_url         EXCEPTIONS           CONFIGURATION_INCOMPLETE = 1           FAILED                   = 2           others                   = 3.       IF SY-SUBRC  0.         clear : lv_wi_execute_url.       ENDIF.     endif.   endif. * *----- STEP 2 - Start the URL in a new screen as task execution   if lv_wi_execute_url is not initial. *--- 2A - Now, call the retrieved URL as a WebDynpro window     if wd_component is bound.       lr_window_mgr = wd_component->get_window_manager( ).       CALL METHOD lr_window_mgr->CREATE_EXTERNAL_WINDOW         EXPORTING           title  = 'Execute workitem'           URL    = lv_wi_execute_url           MODAL  = ABAP_false         RECEIVING           WINDOW = lo_window.       lo_window->open( ). * *--- 2B - Now, call the retrieved URL as Portal navigation (eg: NWBC, Portal, ...)     else.       lv_nav_mode = 1. "navigation_mode.       lv_his_mode = 1.  "history_mode.       lv_unescaped_url = lv_wi_execute_url.       CALL METHOD cl_HTTP_UTILITY=>ESCAPE_URL         EXPORTING           UNESCAPED = lv_unescaped_url *         OPTIONS   =         RECEIVING           ESCAPED   = lv_escaped_url.       concatenate 'ROLES://portal_content/com.sap.pct/every_user/com.sap.pct.erp.common.bp_folder/com.sap.pct.erp.common.roles/com.sap.pct.erp.common.erp_common/com.sap.pct.erp.common.lpd_start_url?RequestMethod=GET&URLTemplate=' lv_escaped_url into     lv_navigation_target.       lv_window_features = 'toolbar=no,resizable=yes'.       lv_target_title = 'Execute workflow task'.       lv_portal_event =           cl_wdr_portal_event=>new_absolute_navigation_event( navigation_target = lv_navigation_target                                                               navigation_mode   = lv_nav_mode                                                               window_features   = lv_window_features                                                               window_name       = lv_window_name                                                               history_mode      = lv_his_mode                                                               target_title      = lv_target_title                                                               context_url       = lv_context_url                                                               post_body         = lv_post_body ).       wdr_task=>client_window->client->update_client_peer->send_event( lv_portal_event ).     endif.   endif. * ENDFUNCTION.

Enhancing WebDynpro “SWF_WORKPLACE”

Within the class ‘CL_SWF_POWL_LAUNCH_SERVICES’ and method ‘GET_DEFAULT_TASK_VISU’, you have to make an enhancement at the bottom of this method:

This will fire the WD Event we will capture in the next enhancement…

So, this second enhancement point needs to be created for class ‘CL_SWF_POWL_WORKPL_WD_ASSIST’ and at the end of the method ‘HANDLE_POWL_FOLLOW_UP’:

The full coding which needs to be inserted here can be found here:

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$SE:(1) Class CL_SWF_POWL_WORKPL_WD_ASSIST, Method HANDLE_POWL_FOLLOW_UP, End                                                                             A *$*$-Start: (1)---------------------------------------------------------------------------------$*$* ENHANCEMENT 1  ZCL_SWF_POWL_WRKPL_WD_A.    "active version * data: lr_window_mgr type ref to if_wd_window_manager,       lo_window     type ref to if_wd_window. data: ls_event_parameter type powl_namevalue_sty,       lv_url             type swr_url,       lv_wi_execute_url  type string,       lv_wi_id           type sww_wiid,       lv_action          type string. * *----- Retrieve the Parameters to get the WI info    loop at it_event_parameters into ls_event_parameter.      case ls_event_parameter-key.        when 'P_WI_ID'.          lv_wi_id = ls_event_parameter-value.        when 'P_ACTION'.          lv_action = ls_event_parameter-value.      endcase.     endloop.     if lv_wi_id is not initial and lv_action = 'EXECUTE'. *----- Call the Function which will finally execute the workitem *      Passing the WebDynpro component controller is necessary to start the task       CALL FUNCTION 'ZWDWF_LAUNCH_WORKITEM'         EXPORTING           iv_wiID       = lv_wi_id *         iv_LANGUAGE          = SY-LANGU         CHANGING           wd_component      = m_comp_cntlr.     endif. * ENDENHANCEMENT. *$*$-End:   (1)---------------------------------------------------------------------------------$*$* ENDMETHOD.

Finally calling our ‘Launch workitem’ function module.

When you execute this WebDynpro application now, ALL workflow tasks should be able to be executed without issues!

Enhancing WebDynpro “IBO_WDA_INBOX”

I also made a similar enhancement to the webdynpro which is mostly used in SRM…  unfortunately, I could not realize this one (at this moment ???? ) without doing some configuration…

The advantage here is that I don’t need to create an enhancement point as I used the configuration capabilities to call the ‘Launch Workitem’ function module

Goto transaction SM30 to maintain the view ‘IBO_V_WF_ACC’ in order to specify a new Action:

Now, we can register the properties for the Action ‘TASKEXECUTE’.

Goto transaction SM30 to maintain the view ‘IBO_V_WF_TAC’:

Finally, we can link all the Tasks that we want to be treated by our custom ‘Launch workitem’ mechanism.

Goto transaction SM30 to maintain view ‘IBO_V_WF_TAC’:

Register the relevant Tasks and link them to our Action ‘TASKEXECUTE’

Logon to the Web-based Workflow inbox now and you will be able to execute the tasks!

I guess I have covered the most common situations with this blog, still in case you find a situation for some specific case not working, please let me know!

Enjoy!!!!!!!!

New NetWeaver Information at SAP.com

Very Helpfull

User Rating: Be the first one !