Skip to Content
Author's profile photo Ronen Weisz

Adding links/Displaying forms/DMS documents in a workflow task using objects

Attached objects to a task will appear as links in the decision task workitem display. I find this way is easier and more flexible then using the SOFM attachments for adding data to workitems .and you can easily test the method by testing the object and do not have to use a task to create it.

let’s say we what to add a link to a url, doing so in the task description will be difficult the same as adding it as an attachment, however calling a url in a method is easy for example by using cl_gui_frontend_services=>execute. Calling an adobi form Example: Calling Forms in an Application Program (SAP Library – SAP Interactive Forms by Adobe) or a DMS document using CVAPI_DOC_VIEW and attaching a new object to the task is not difficult as well.

Here is an example for a DMS document, but this should work the same for all types of attachments.

Create a z-object (do not delegate this object to the original one if you created it as a sub-object) in the example it’s a sub-object of DRAW

In the new object create a method calling the DMS document. Pay attention that this method does not have an importing parameter


BEGIN_METHOD DISPLAYEASYDMS CHANGING CONTAINER.

CALL FUNCTION ‘CVAPI_DOC_VIEW

EXPORTING

pf_dokar = object-key-DOCUMENTTYPE

pf_doknr = object-key-DOCUMENTNUMBER

pf_dokvr = object-key-DOCUMENTVERSION

pf_doktl = obejct-key-DOCUMENTPART

EXCEPTIONS

ERROR = 1

NOT_FOUND = 2

NO_AUTH = 3

NO_ORIGINAL = 4

OTHERS = 5.

END_METHOD.

Define this new method as the default object method

object default method.png

Now you can create this object as an attribute of the main workflow object (by delegation)

GET_PROPERTY DMSDOCUMENT CHANGING CONTAINER.

DATA: lo_dms_doc TYPE swc_object,

lv_dms_key TYPE sww_wi2obj-instid.

lv_dms_key = <use the obejct key to get the doc key>

swc_create_object lo_dms_doc ‘ZEASYDMSD’ lv_dms_key.

swc_set_element container ‘DMSDocument’ lo_dms_doc.

END_PROPERTY.

And in the decision task add the new object and transfer if to the task from the original object attribute.

binding to step.png

The decision task will look like this:

Invoice with DMS attached.png

And the added object will be a link to displaying the url/link/DMS etc. 

Assigned tags

      4 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Hi Ronen,

      Thanks a lot for this document.It helped me to resolve the issue of getting DMS document as an attachment.

      Author's profile photo Mohit Chopra
      Mohit Chopra

      Hello Ronen,

      I want to show attachments in workitem Objects and Attachments. I am using ABAP OO  instead of BOR. can you please explain how can i use the above described approach to disply attachments from DMS?

      Author's profile photo Ronen Weisz
      Ronen Weisz
      Blog Post Author

      You can simply add it to the container of a task you created, even if the task is based on a class method instead of a BOR one. If you want to create the object referencing the DMS document as a class simply add the code to the default class method. see for example Using ABAP OO attributes in workflows and tasks  

      Author's profile photo Prince JOSHI
      Prince JOSHI

       

      Can you please explain where you to write the logic of GET_PROPERTY DMSDOCUMENT.

      It will be more helpful if you can post it with the steps.