In a step of a custom workflow the agent must complete a dialog screen with data to be used to create a smart form. The form is then printed and retrieved as OTC, converted and attached to the work item as a PDF using SAP_WAPI_ATTACHMENT_ADD. In subsequent steps the PDF can be opened and viewed. Later on in the workflow the smart form must be changed with approvers' data. The current attachment is then removed in a separate step using SAP_WAPI_ATTACHMENT_DELETE and a new form is created and attached using the same process.
Problem: Although the attachment is removed, it is still in "_Attach_object " container element and it is still displayed in the subsequent steps as an attachment to the work items. If I click on the link I am informed that the object does no longer exist. I tried using SWW_WI_OBJECTHANDLE_DELETE but this also does not work. The container element "_Attach_object " is a multiline object type of type SOFM. How can I manipulate this container element and remove the link so that it is not displayed in the subsequent work items?
I did try using the parent Workflow ID and also the id's of the steps were the attachment is actually attached, without success. I cannot remove all attachments at once because some office notes and other objects must stay as attachments.
The objects are defined in "_Attach_object " as SOFM:FOL2800000000004EXT40000000002443. I have the attachment key and can instantiate such
SOFM object. If I use the method DELETE within a step/method will it delete the attachment?
I tried to use SAP_WAPI_ATTACHMENT_ADD without the commit to enable me to get the attachment id and then to create an SOFM object and assign this to a workflow element. I then assign and overwrite this object in the subsequent steps but even though I do not commit, the attachment link is again available in the subsequent steps and work items. I only need the current (last) document as an attachment.
Hope everything is clear. Please help as a matter of urgency. Thank you.