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

转 Display Dynamic Attachments in Work Item in Workflow

 
阅读更多

Display Dynamic Attachments in Work Item in Workflow

By Anirban Bhattacharjee, KPIT Cummins and Infosystems from Link

Purpose: The purpose of this article is to show you how to display dynamic attachments in work items in workflow

Business Scenario: This is useful in all workflows across all modules. The scenario I am taking for an example is the Travel and Expense Workflow, related to the PR05 and TRIP transactions. When an employee creates an expense report in the T&E Module, he needs to attach receipts to justify the expense. The application in R/3 (PR05 / TRIP) or the ESS MSS Application via portal processes this attachment to the GOS Attachments folder. After the attachment the employee submits the TRIP which triggers the workflow and routes the work item for approval. In the workflow just before the foreground work item creation, we can read the GOS Folder and attach the documents as a physical attachment.

But many times the employee forgets to do the attachment and completes it after TRIP submission and hence work-item creation. The approver now cannot see this new document attached after workflow trigger and TRIP Submission.

This article will show how to make this happen. You will be able to enable a feature such that approvers can view all attachments done after TRIP Submission and hence the workflow trigger.

Process: The process will involve the following steps

·         Create a custom business object that will read the GOS Attachment. This method will be called as the default method in the BOR.

·         Create a custom workflow for demo. In this workflow we will use the main SAP Business Object for TRIP; BUS2089 (Employee Trip).

·         We will instantiate the custom BOR in the workflow and attach it to the _ADHOC_OBJECT element to create the dynamic GOS attachment link.

·         We can test in Business Workplace (SBWP) or the UWL in Portal if you have portal in your project.

STEP 1: Create a Custom Business Object

(I am not going into the details of business object creation. That is not in this document scope)

We call this business object as ZTRIP_NEW (Display TRIP Attachments in Real Time).

We create a method GOS_ATTACH_DISPLAY as shown below

(Please overlook the other methods. They are not related to this topic)

This method has no parameters

This is an instance depended method, that is the BOR must be instantiated to call this method

In order to display the GOS Attachments, we will call the function module GOS_ATTACHMENT_LIST_POPUP.

Here we will pass the importing parameter IP_MODE as ‘D’ to ensure that the attachments can only be displayed.

The approver should not be able to add or remove any attachments.

The code you will write in this method is shown below

begin_method gos_attach_display changing container.

DATA: is_object TYPE sibflporb.

is_object-typeid = 
'BUS2089'.
is_object-catid  = 
'BO'.
is_object-instid = object-
key.
* GOS Attachments
CALL FUNCTION 'GOS_ATTACHMENT_LIST_POPUP'
  
EXPORTING
    is_object             = is_object
    ip_check_arl          = 
'X'
    ip_check_bds          = 
'X'
    ip_notes              = 
'X'
    ip_attachments        = 
'X'
    ip_urls               = 
'X'
    ip_mode               = 
'D'
*  IMPORTING
*    EP_SAVE_REQUEST       =
*  TABLES
*    IT_OBJECTS            =
          .
end_method.

Please note that we are building the TRIP key here along with Business Object (BUS2089 for TRIP) and Category ID (BO for Business Object).

This function module will read this unique key combination of the instance (TRIP and Employee Number) with the Business Object ID and Cat ID and display the attachment list.

Now once the method is created, we will mark this method as a default method. I will explain later why we are doing this.

In the BOR Screen, navigate to the Basic Data (CTRL+SHIFT+F1) of the BOR by clicking on the HAT Icon as shown

We navigate to this screen now. Click on the DEFAULTS Tab

Enter the Method GOS_ATTACH_DISPLAY and pass attribute as TRIP Number. This will display in the work item as a link

We save and activate the BOR and mark the method and the BOR as Implemented and Released.

(This is a standard process to be followed when creating a custom BOR).

The above process completes our first step of creating and activating or Custom BOR that will read the GOS attachment.

STEP 2: Create a Custom Workflow

We will create a custom workflow with simply two steps.

The first step will instantiate our custom BOR, second step will be the user decision that will be sent to the approver.

The workflow will be modeled on the standard SAP business object BUS2089 as the main business object.

Run PFTC and create the workflow template, name it as shown and save it

Navigate to the container tab and create a container element called TRIP as shown

Mark this element as importing and mandatory

The element is created. Now navigate back to Basic Data to enter the work item text

Save the template and then click on Workflow Builder, to call the builder to design the workflow

STEP 3: Instantiate the Custom Business Object and continue the workflow creation.

Now we will create a background task / activity to instantiate our custom business object ZTRIP_NEW.

In this step we will use a standard task where we will call the method GENERICINSTANTIATE from BOR SYSTEM as shown

 

The container element created for this task from method GENERICINSTANTIATE are shown below

ObjectKey: Points to SWOTOBJID- OBJKEY. This will contain the TRIP Keys. Has no initial value.

ObjectType: Points to SWOTOBJID- OBJTYPE. It will contain the Business Object that needs to be instantiated.

In this case, it is ZTRIP_NEW; hence this will be the default value

 

ObjectInstance: This contains no reference to any BOR. This will get the instance of the BOR specified at runtime.

In this case the BOR passed via ObjectType is ZTRIP_NEW. Hence the element ObjectInstance will contain the instance of this custom BOR.

The binding in the method in task is shown

Now the task is created. Save it and come back to the workflow. The workflow prompts for the auto bindings

Accept and save the bindings

In the workflow, mark this container ObjectKey as importing. While testing pass the concatenated string of Employee Number and TRIP No.

(This is done to simplify the demo. In real time, this key can be built from the event call via event containers)

Now create an element container to store the above instance for ZTRIP_NEW as shown.

Save this element and the workflow

Now go back to the task created and bind this element created as shown

 

This will pass the run time instance of our custom business object ZTRIP_NEW to the container we created of the same name.

Now use container operation step to pass this instance to the Standard Workflow container element _Adhoc_Objects

Note that I have simply extended the table.

The container _Adhoc_Objects by default will also contain the default method of our Main Standard SAP Business Object BUS2089.

We are simply extending the table to call our GOS Dynamic BOR as well.

The effect will be in the work item we will get two links one for the standard BOR and one for our custom BOR.

Important: Whenever you pass the instance of any business object to this element _Adhoc_Objects, it creates a link in the work item.

On clicking this link, it executes the Default Method of the BOR. This is the reason why we marked our method GOS_ATTACH_DISPLAY as default.

You can pass the instance of the standard BOR BUS2089 also to this container as shown

Now create the USER Decision Step and send to Initiator (For DEMO Simplicity)

Final workflow looks as shown

Our DEMO is now ready to be tested.

First let us display a TRIP via PR05 and see what is there in the attachments

Display attachment via the menu path as shown

 

So this TRIP has only one attachment now.

We run T-Code SWUS to test the workflow.

Pass the TRIP Details and concatenated data of PERNR and TRIP

Work item in SBWP

Note under Objects and Attachments, we see both the attachments links.

The first link for the Standard Display Method in standard BOR and second link points to our Custom BOR for Dynamic Links.

Click the Display Attachments Link

We can see one attachment here. Now we go and attach one more attachment in the TRIP as shown

Now coming back to the same work item

Click on the Display Attachments link again. It should show the new attachment also

 

So we have successfully configured Dynamic Attachments in the workflow.

Clicking on the link Employee TRIP will display the TRIP since BUS2089 has Display Method as Default

The TRIP Gets Displayed

 

分享到:
评论

相关推荐

    TMS Workflow Studio v1.9.0.0 Full Source

    New : TAttachmentViewMode allow displaying attachments and task info in a single pane instead of different tabs New : RAD Studio XE5 support Improved : Better performance for saving/loading workflow ...

    Outlook add-in to unlock blocked attachments in .NET

    标题中的“Outlook add-in to unlock blocked attachments in .NET”指的是一个使用.NET框架开发的Outlook插件,其主要功能是解锁在Outlook中被阻止的附件。在Outlook中,出于安全考虑,某些类型的附件(如.exe或...

    attachments

    【标题】"attachments"所代表的是一个与软件开发相关的压缩包文件,可能包含了各种开发工具或项目的源码、脚本和配置文件。这个压缩包可能是为了方便开发者在不同环境中快速搭建项目或者进行版本控制。 【描述】...

    Attachments_2015423.zip_Attachments

    【Attachments_2015423.zip_Attachments】这个压缩包文件包含了与创建参数化曲线相关的代码和图像资源,适用于对计算机图形学、数学建模或MATLAB编程感兴趣的用户。以下是根据提供的文件名解析出的相关知识点: 1. ...

    django-attachments

    `django-attachments` 是一个专门为 Django 框架设计的附件管理应用,它为用户提供了方便地上传、管理和检索附件的功能。这个应用在 Django 项目中扮演着重要角色,尤其对于那些需要处理大量文件上传和管理的场景,...

    Attachments

    this is very important file for software developers

    Attachments from VLC scripting in LabVIEW..._流媒体_网络摄像头_rtsp_labv

    在本主题中,“Attachments from VLC scripting in LabVIEW...”探讨了如何在LabVIEW(Laboratory Virtual Instrument Engineering Workbench)环境中,通过ActiveX接口调用VLC(VideoLAN Client)的DLL(动态链接库...

    Laravel开发-laravel-easy-attachments

    `laravel-easy-attachments`是一个专为Laravel设计的包,它简化了这一过程,提供了强大的功能和易用性。这个包的核心目标是帮助开发者更高效地管理应用程序中的附件,无论是单个文件还是多文件,以及图像处理。 ###...

    attachments_Attachments_ad_

    标题中的"attachments_Attachments_ad_"可能是指一系列与附件或数据传输相关的AD(Analog Devices)公司的产品应用,但没有具体说明是哪一种设备或技术。描述中提到的"Design of signal generator based on AD9912"则...

    Joomla 插件 attachments 1.3.4

    - `attachments_component.zip`、`attachments_plugin.zip`、`add_attachment_btn_plugin.zip`、`attachments_search.zip`:这些是实际的插件和组件文件,需要通过 Joomla 的后台管理界面进行安装和启用。...

    Attachments Viewer Component

    Power Platform Power Apps画布应用查看附件组件

    OutlookAttachView v2.73

    display the attachments list. (Options -> Select Another Font) * Version 2.46 o Fixed the flickering occurred while scrolling the attachments list. * Version 2.45 o You can now resize the scan ...

    attachments_Attachments_scientistyfp_doc_

    文档标题“attachments_Attachments_scientistyfp_doc_”暗示了这是一个关于附件处理或科学数据分析的文档,可能涉及性能评估和测试。描述中提到“doc explaining the performance and testing of”进一步证实了这...

    attachments.zip_lines

    The abstract is to be in fully-justified italicized text, &#8206 at the top of the left-hand column as it is here, below the &#8206 author information. Use the word “Abstract” as the &#8206 title, ...

    Attachments-freeworld_arqc_arpcgenerator_Attachments_ARQCgenerat

    Attachments-freeworld_arqc_arpcgenerator_Attachments_ARQCgenerat

    attachments(1)_Attachments_android_

    【标题】"attachments(1)_Attachments_android_" 暗示我们关注的是与Android操作系统相关的附件管理或使用场景,可能是关于如何在Android设备上处理不同类型的附件,如文档、图片或其他数据文件。Android系统是一个...

    FastReport.v4.15 for.Delphi.BCB.Full.Source企业版含ClientServer中文修正版支持D4-XE5

    + [enterprise] added dynamic file name generation of resulting formats (report_name_date_time) * [enterprise] SERVER_REPORTS_LIST and SERVER_REPORTS_HTML variables (list of available reports) depend ...

    POLYGON – Modular Fantasy Hero Characters v1.23

    – Capes rigged to work with Dynamic Bone – 120 Premade characters from the modular parts – Static versions for in game pick ups and use for UI etc Assets Modular Character Assets – Hair, Heads...

    Attachments_201429.zip_Attachments_cyclostationary_spectrum sens

    research papers of spectrum sensing in cognitive based on cyclostationary detction

Global site tag (gtag.js) - Google Analytics