Skip to Content

send a PDF as attachment in Decision Step

Dears ,

i was trying to send a pdf file with workitem and i found this post :

Creating attachment to workitem or user decisions

Former Member

i made all steps but there is a problem when i try to execute the workitem of the user decision step

Unable to instantiate object '_ATTACH_OBJECTS'

program :

method :

binding :

workitem in inbox ;

program.png (141.1 kB)
method.png (48.0 kB)
binding-task.png (45.6 kB)
workitem.png (8.6 kB)
error.png (4.3 kB)
Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    Jul 15, 2017 at 05:32 PM

    Couple of things:

    Firstly, please use the standard Workflow mechanisms or API (SAP_WAPI* functions). Starting the WF directly like this is usually a bad idea unless you have a very specific reason.

    Secondly, you are attaching it twice. Once in a step as binding, and inside the method using the SAP_WAPI_CREATE_ATTACHMENT. Choose one method and work on that. If the attachment comes from a WF step then it's best to use binding. If it's from external then use the API or events. But, just glancing through your code, I don't see you generating a SOFM object anywhere, so this will result in the error you are seeing.

    Add comment
    10|10000 characters needed characters exceeded

    • 1. Inside the method you're calling the API to attach it 'from the outside'. This is a bit roundabout, but produces the link that presumably works.

      2. In your binding you're sending a SOFM object back to WF. But instead of an instance you're just putting an ID where the object reference should be. SWC_SET_ELEMENT ... 'SOFM'... <-- here you should fill in an object reference, not an ID.

  • Jul 24, 2017 at 10:19 AM

    Hi Ismail,

    binding thing is one way, I created a program exit to do this and attached that program exit in the user decision step.

    On creation of workitem of UserDecision Step, program exit will use the FM's to send mail and the attachment.

    Hope it helps.

    Aditya V

    Add comment
    10|10000 characters needed characters exceeded