cancel
Showing results for 
Search instead for 
Did you mean: 

Attachments in Inbox

justin_santhanam
Active Contributor
0 Kudos
1,296

Dear all,

I'm using Program exit to attach adobe forms PDF file to Mail step in workflow. I can see the file generated, but can't able to open it. Seems like somewhere I'm missing the extension ".PDF". But not sure where exactly. Can some one guide me please?


if lv_qmnum is not initial.

"Get Adobe Form

     me->get_pdf_xstring(

       exporting

         iv_event     =   im_event_name  " Field length 18

         iv_qmnum     =   lv_qmnum " Notification No

       importing

         ev_pdf_solix =   it_solix_tab  " GBT: SOLIX as Table Type

     ).

* Identify the folder id

     call function 'SO_FOLDER_ROOT_ID_GET'

       EXPORTING

         owner     = sy-uname

         region    = 'B'

       IMPORTING

         folder_id = lv_folder_id_1.

* convert the field format acceptable by function module  SO_DOCUMENT_INSERT_API1

     lv_folder_id_2 = lv_folder_id_1.

* Prepare object header

     lv_soxobjcont-objtype = 'ZBUS2038'.

     lv_soxobjcont-objkey  = lv_qmnum.

     append lv_soxobjcont to lv_object_header.

*Prepare document data- contain description and sensitivity

     lv_document_data-OBJ_NAME = 'INITIAL'.

     lv_document_data-SENSITIVTY = 'P'.

     Concatenate 'Notification:' lv_qmnum into lv_document_data-obj_descr separated by space.

     CALL FUNCTION 'SO_DOCUMENT_INSERT_API1'

       EXPORTING

         FOLDER_ID                  = lv_folder_id_2

         DOCUMENT_DATA              = lv_document_data

         DOCUMENT_TYPE              = 'PDF'

       IMPORTING

         DOCUMENT_INFO              = lv_doc_info

       TABLES

         OBJECT_HEADER              = lv_object_header

         contents_hex             = it_solix_tab

       EXCEPTIONS

         FOLDER_NOT_EXIST           = 1

         DOCUMENT_TYPE_NOT_EXIST    = 2

         OPERATION_NO_AUTHORIZATION = 3

         PARAMETER_ERROR            = 4

         X_ERROR                    = 5

         ENQUEUE_ERROR              = 6

         OTHERS                     = 7.

     IF SY-SUBRC <> 0.

       MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

     ENDIF.

* Populate object type and object key for create an instance

     lv_objtype = 'SOFM'.

     lv_objkey = lv_doc_info-doc_id.

* Create an instance

     CALL FUNCTION 'SWO_CREATE'

       EXPORTING

         OBJTYPE           = lv_objtype

         OBJKEY            = lv_objkey

       IMPORTING

         OBJECT            = lv_sofm

         RETURN            = lv_SWOTRETURN

       EXCEPTIONS

         NO_REMOTE_OBJECTS = 1

         OTHERS            = 2.

     IF SY-SUBRC <> 0.

       MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

     ENDIF.

* Prepare for attaching the object to container

     lv_OBJ_RECORD-HEADER = 'OBJH'.

     lv_OBJ_RECORD-TYPE = 'SWO '.

     lv_OBJ_RECORD-HANDLE = lv_sofm.

     call method lv_taks_container->set

       EXPORTING

         Name  = '_ATTACH_OBJECTS'

         Value = lv_obj_record.

*Commit the changes

      CALL METHOD im_workitem_context->do_commit_work.

endif.

Attachment

Error

Accepted Solutions (1)

Accepted Solutions (1)

justin_santhanam
Active Contributor
0 Kudos

Just an update, I got the SOFM Object ID and executed it in SOFM BOR and got the below result.

If I execute the method just like that, I can able to see my PDF file.

If I have ENJOY parameter as 'X' and execute it, then I'm getting the below error. This is the same error which I get when I try to see it from SBWP. Why it's happening like this?

Thank you,

Justin.    

I042439
Advisor
Advisor
0 Kudos

Hi

In Function 'SO_DOCUMENT_INSERT_API1'  , pass DOCUMENT_TYPE  = 'EXT' (that is a PC Document)

lv_document_data-OBJ_NAME = 'INITIAL' ... guess it is the name of the file! Try giving it as 'INITIAL.PDF'

Regards,

Modak

justin_santhanam
Active Contributor
0 Kudos

Hello Modak,

Thank you so much. I could able to open up the files from SBWP, the extension is not coming up, but I'll get on to that later. But the process itself is failing while sending the attachment from mail step.  Appreciate your time. Can you point me out, what mistake I'm doing here?

Error:

Thank you,

Justin

I042439
Advisor
Advisor
0 Kudos

Hi Justin

Instead of the last screen shot of the 'messages' Tab, please give the screen shot of the 'Step History Tab'.

Regards,

Modak

justin_santhanam
Active Contributor
0 Kudos

Hello Modak,

Please see the below screenshot.

Thank you,

Justin.     

I042439
Advisor
Advisor
0 Kudos

Hi Justin

Go to SWO1 and test BO SELFITEM and the method SENDTASKDESCRIPTION with the values which the workflow is passing. If you get the error; you will have to debug the method and see.

Regards,

Modak

I042439
Advisor
Advisor
0 Kudos

Also try binding _ATTACH_OBJECTS to ATTACHMENTS from the Wrokflow to the Task.

What do we have in Address String? Is it a valid email address? Can you send a test email to the same email address from SBWP (New Message from the top left)?

Regards,

Modak

justin_santhanam
Active Contributor
0 Kudos

Hello Modak,

Yes I did that. I get emails in SOST as well. The moment I try to maintain the Task (PFTC) for SELFITEM , SENDTASKDESCRIPTION binding Attachments, I get the WF error and no emails.

Thank you,

Justin.

I042439
Advisor
Advisor
0 Kudos

Hi Justin

maybe you will have to debug it and find the real cause of error.

regards,

Modak

I042439
Advisor
Advisor
0 Kudos

Try an open a new thread for this issue as it is the second one for this thread. First one is resolved; you can close this thread. Also provide full details and screen shot over there. Try to test with uploading a new attachment via the SBWP work item and remove the PDF attachment part for the test. See what happens.

Regards,

Modak

Answers (1)

Answers (1)

justin_santhanam
Active Contributor
0 Kudos

Hello Modak,

Thank you so much for all your help! I could able to get it work. I'll update the tickets with what I have done.

Thank you,

Justin.