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
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.
The decision task will look like this:
And the added object will be a link to displaying the url/link/DMS etc.
Hi Ronen,
Thanks a lot for this document.It helped me to resolve the issue of getting DMS document as an attachment.
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?
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
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.
Hello Sir,
How to display Hyperlink to the work item in objects and attachment section with the above process. Please suggest. Thank you.l
Kind Regards
Dilip