Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Attachments in Inbox

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

Tags:
replied

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

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question