cancel
Showing results for 
Search instead for 
Did you mean: 

send a PDF as attachment in Decision Step

0 Kudos

Dears ,

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

Creating attachment to workitem or user decisions

ramakanth.reddy

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 :
method.png

binding :

workitem in inbox ;

Accepted Solutions (1)

Accepted Solutions (1)

pokrakam
Active Contributor

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.

0 Kudos

someone changed the standard task of decision step by adding BUS2030 in its container so i tried the same solution in another server and it is work perfectly .

thanks for your help , but i want to know how i am attaching it twice ?? i just attached it in the method by fm SAP_WAPI_ATTACHMENT_ADD only and using binding to transfer the values !

pokrakam
Active Contributor
0 Kudos

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.

Answers (1)

Answers (1)

former_member184495
Active Contributor
0 Kudos

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