`
evangxli
  • 浏览: 230711 次
  • 性别: Icon_minigender_1
  • 来自: 大连
社区版块
存档分类
最新评论

转 Modify the run-time value of workflow containers

 
阅读更多

Modify the run-time value of workflow containers

By Anirban Bhattacharjee, KPIT Cummins and Infosystems from Link

Purpose: The purpose of this document is to demonstrate how to modify the values of workflow containers from the workflow logs running instance. This means, you can actually modify and manipulate the workflow runtime values after the workflow has triggered and the work items are created. This will help you restore stuck workflow instances even when the SWPR transaction cannot restore

Business Scenario: This manipulation has a number of uses, but for our demo we will consider the following scenario. In the workflow to send e-mails to outlook we use the send-mail step in the workflow. The e-mail ID is generally retrieved via a background task prior to calling the send mail step. This e-mail ID is retrieved from SU01 (User Master) or Info-Type 105 (Communication Info Type) Subtype 10. Many times it happens that the business forgets to maintain the e-mail ID. The e-mail ID is not retrieved thus and the e-mail step in the workflow goes into error putting the whole workflow into ERROR status. Simply running SWPR (Restart Workflow after ERROR) T-Code after maintaining the e-mail ID will also not help since the e-mail retrieving step has already executed and workflow is stuck at the e-mail sending step. Restarting the complete workflow will not be acceptable to the business since it will start the approval process again from the start, thus wasting precious business time.

It is at this difficult scenario, this container manipulation technique will come to your rescue.

Process: To set up a demo for this we will have the following steps

·         Build a custom workflow with just a send e-mail step with the e-mail field as importing. (Simplified for demo purpose)

·         Test-run this demo workflow via SWUS T-Code but do not pass the e-mail ID. This will put the workflow in ERROR status.

·         We will simply use SWPR T-Code first to try and restart the workflow instance. This will fail.

·         We will then modify the workflow runtime container and pass the e-mail ID.

·         We will restart the workflow via SWPR again. It will work this time.

·         We can check in SOST to see that e-mail is sent via SAP-Connect.

Pre-requisites: To follow and set up this demo, following are the pre-requisites

·         You should know how to build a basic workflow with the send e-mail step.

·         SCOT and SAP Connect must be configured for e-mail sending.

·         All other workflow configurations via SWU3 are already done.

Building the Custom Workflow with the send e-mail step

The e-mail ID container created is as shown below. It is marked as importing, but not mandatory

The e-mail step will contain this container EMAILID as the e-mail ID variable

After building the custom workflow with the send e-mail step, it will look as shown below

Testing the demo workflow

Now run SWUS T-Code and enter this workflow template ID to test. Test run the workflow without passing the e-mail ID (simulates missing e-mail ID).

It will look as shown below

Now we will check the workflow log. We can see that the workflow is in error

The Step History of the work item will tell us that the method to send mail could not execute

The container shows that there is no e-mail ID in the Address Strings field

Now we will run SWPR to attempt to restart this workflow instance. The work item ID is 2733489 for the e-mail step.

The work item ID of the workflow (Parent ID) is 2733488. Enter that in SWPR

<iframe id="aswift_2" style="position: absolute; top: 0px; left: 0px;" name="aswift_2" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="728" height="90"></iframe>

Now select the above row and click on “Restart Workflow” push button on the application tool bar

The application confirms that the restart has been carried out. Press REFERSH button to see if the restart was a success

We can see the item is still there. Looking at the workflow log and step history, we see that the workflow went into ERROR even after the restart  

Note that the restart operation is shown, but still it went into error after that.

So simply running SWPR transaction will not work in this case.

Modify the container value at run time:

To modify the workflow container value, we need to run the function module

SWL_WI_CONTAINER_MANIPULATE

This powerful function module allows you to pass the work item ID of the step whose container you want to modify.

You can display and edit the containers. In our case, the work item ID of the e-mail step is 2733489

Pass this work item ID to the function module as shown. Do not pass anything to the DISPLAY parameter

Now on executing this function module, the complete container list of the work item step is shown in EDIT Mode!!

This is the Container Instance Editor

<iframe id="aswift_2" style="position: absolute; top: 0px; left: 0px;" name="aswift_2" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="728" height="90"></iframe>

Now select the container Recipient Name and pass a valid e-mail ID. In business scenario, you can get it from user master (SU01) or Info Type 105 Subtype 10.

Select the container and click on APPEND ROW

Enter the e-mail ID

Now press the ENTER key to accept the changes on the pop-up

Now go back to the workflow log and refresh to see if the e-mail ID shows up there.

BEFORE REFRESH: Address Strings is empty

AFTER REFRESH: Address Strings has the e-mail ID now (shows as “1 entry” and appears on the overview below)

The workflow is still in error. So we run SWPR again

We press the REFRESH to see if the restart was a success

The item has gone away, indicates a success. We will verify from the workflow log

<iframe id="aswift_2" style="position: absolute; top: 0px; left: 0px;" name="aswift_2" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="728" height="90"></iframe>

Note that the workflow has executed the step without errors. Note also that container value change operation is also captured in the logs.

Showing the graphical log to verify

The active-x log is also show

Running SOST T-Code, to see if the e-mail is out

Conclusion: Thus with this process, we were successfully able to modify and manipulate a workflow container value from the runtime instance and also successfully restart the workflow instance exactly from the point where it went into error.

Disclaimer: Use this function module with caution. Be very careful while changing the container values. Only workflow administrators should do it. Please remember, you activity is logged in the workflow logs, hence perform the activity only when the workflow is stuck in error and there is no option to restart from the very beginning.

分享到:
评论

相关推荐

    modify-http-headers Chrome插件-20190820

    "modify-http-headers"是一款针对Google Chrome浏览器的插件,主要功能是允许用户自定义和修改HTTP请求头,以满足特定的测试、调试或者隐私需求。这款插件在2019年8月20日的版本被提及,可能是该版本的一个更新或...

    前端开源库-less-modify-var-loader

    "less-modify-var-loader"就是一个专为前端开发者设计的开源库,它主要用于处理Less预处理器中的变量,特别是在使用Webpack构建项目时,能够方便地替换Less文件中的变量值。 Less是一种CSS预处理器,它允许我们使用...

    modify-header-value-http-0.1.3.crx

    Modify Header Value (HTTP Headers) 这个插件的主要作用是对Chrome的HTTP request headers进行添加、修改和过滤等操作。当我们访问网站的时候,某些网站服务器会对访问网站的浏览器Header信息进行判断,然后决定用...

    modify_headers-0.7.1.1-fx.xpi

    profile.setPreference("modifyheaders.headers.value1", forwarded_ip); profile.setPreference("modifyheaders.headers.enabled1", true); profile.setPreference("modifyheaders.config.active", true); profile...

    auto-modify-the-file-names.zip_names

    "auto-modify-the-file-names.zip_names" 提供的工具或脚本显然就是针对这一需求的解决方案。这个压缩包可能包含一个或多个VB(Visual Basic)脚本,用于在当前目录下批量替换文件的名称,以实现快速、高效地管理...

    Access_Modify-1.0.1-py3-none-any.whl.zip

    标题 "Access_Modify-1.0.1-py3-none-any.whl.zip" 提供了有关这个压缩包的核心信息。这表明它是一个Python软件包,名为 "Access_Modify",版本号为 "1.0.1",并且是为Python 3编译的。"py3-none-any" 是Python ...

    Modify-the-data-in-excel.rar_excel 修改

    标题"Modify-the-data-in-excel.rar_excel 修改"表明这个压缩包包含的是关于如何在Excel中修改数据的教程或代码示例。描述进一步强调了程序能够读取和修改Excel中的数据,这通常涉及到编程语言如Python、VBA(Visual...

    Access_Modify-1.0.0-py3-none-any.whl.zip

    标题 "Access_Modify-1.0.0-py3-none-any.whl.zip" 提供的信息表明,这是一个Python软件包的压缩文件,其中包含了名为 "Access_Modify-1.0.0-py3-none-any.whl" 的轮子(wheel)文件。在Python生态系统中,轮子文件...

    Access_Modify-1.0.8-py3-none-any.whl.zip

    标题中的"Access_Modify-1.0.8-py3-none-any.whl.zip"是一个Python软件包的压缩文件,它遵循Python的wheel格式。在Python的生态系统中,wheel是一种二进制分发格式,用于方便地安装Python包,避免了每次安装时都需要...

    Knowlton -- Python. Create-Modify-Reuse -- 2008 -- code.7z

    Knowlton -- Python. Create-Modify-Reuse -- 2008 -- code.7z

    Access_Modify-1.0.2-py3-none-any.whl.zip

    标题 "Access_Modify-1.0.2-py3-none-any.whl.zip" 提供了有关软件包的重要信息。这通常是一个Python软件包,通过`whl`(Wheel)格式分发,它是一个预编译的Python二进制包,用于简化安装过程。`Access_Modify`可能...

    Access_Modify-1.0.6-py3-none-any.whl.zip

    标题中的"Access_Modify-1.0.6-py3-none-any.whl.zip"是一个包含Python软件包的压缩文件,这种格式通常是用于Python环境的安装文件。`whl`是Python Wheel格式的缩写,它是Python包的二进制分发格式,用于简化安装...

    0001-modify-lockScreen-style.zip

    在这个场景中,"0001-modify-lockScreen-style.zip"是一个专门针对锁屏界面进行修改的项目,它包含了两个关键文件:0001-modify-lockScreen-style.patch和0001-modify-lockScreen-style补充.patch。这两个补丁文件是...

    Access_Modify-0.0.1-py3-none-any.whl.zip

    标题 "Access_Modify-0.0.1-py3-none-any.whl.zip" 提供了关于这个压缩包的关键信息,它包含了一个名为 "Access_Modify-0.0.1-py3-none-any.whl" 的文件,这通常是一个Python轮子(wheel)文件。在Python的生态系统...

    Access_Modify-1.0.5-py3-none-any.whl.zip

    标题 "Access_Modify-1.0.5-py3-none-any.whl.zip" 提供的信息表明,这是一个Python软件包的压缩文件,版本为1.0.5,它遵循了Python的 Wheel 格式。Wheel是Python社区为了方便分发和安装Python包而设计的一种二进制...

    Access_Modify-1.0.3-py3-none-any.whl.zip

    标题 "Access_Modify-1.0.3-py3-none-any.whl.zip" 提供了有关软件包的重要信息。这通常是一个Python软件包,通过`whl`(Wheel)格式分发,它是一个预编译的Python二进制包,便于用户安装。`Access_Modify`是这个...

Global site tag (gtag.js) - Google Analytics