cancel
Showing results for 
Search instead for 
Did you mean: 

Sending mail to an external maild with PDF attachment.

Former Member
0 Kudos

Hi,

I would like to know if i can send a PDF doc as attachment to an external mail id from the R/3 cutom workflow.

I am able to send mails to external mail id's, but would like to know how we can attach a dynamically created PDF doc along with it.

Thanks and Regards,

Anto.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

may be thread helps...

Peter

--

Points always appreciated

Former Member
0 Kudos

I will like to make sure if i can send an <b> Interactive PDF </b> document as attachemnt to the external mail id from SAP.

former_member184112
Active Contributor
0 Kudos

Hi Antony,

If you want to create an attachment in a workflow task you need to create a sofm instance for your PDF file.

First, you need to create a method to get an SOFM instance for you PDF file.

Example code:

DATA: attach TYPE swc_object.

DATA:it_objhex TYPE solix_tab.

swc_container l_cont.

DATA folder_id TYPE sofdk.

DATA lt_objcont TYPE STANDARD TABLE OF soli.

DATA ls_objcont TYPE soli.

DATA l_obj_data TYPE sood1.

DATA l_obj_id TYPE soodk.

DATA document_id TYPE sofmk.

DATA lt_objhead TYPE STANDARD TABLE OF soli.

data wa_soli type soli.

data wa_solix type solix.

FIELD-SYMBOLS: <ptr_text> type soli,

<ptr_x> type any,

<ptr_hex> type solix.

define hex_to_cont.

  • &1 Table of structure SOLIX

  • &2 Table of structure SOLI

refresh &2.

loop at &1 into wa_solix.

clear wa_soli.

assign wa_soli to <ptr_hex> casting.

move wa_solix to <ptr_hex>.

append wa_soli to &2.

endloop.

end-of-definition.

CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'

EXPORTING

region = 'B'

IMPORTING

folder_id = folder_id

EXCEPTIONS

OTHERS = 1.

*get the PDF file into a table

(CALL FUNCTION 'ZAP_GET_PDF'

EXPORTING

File name: ‘xxx’

TABLES

objhex = it_objhex

EXCEPTIONS

error_image = 1

invalid_url = 2

OTHERS = 3.)

l_obj_data-objnam = 'SOFM'.

l_obj_data-objdes = 'test'.

l_obj_data-file_ext = 'PDF'.

hex_to_cont IT_OBJHEX LT_OBJCONT.

CALL FUNCTION 'SO_OBJECT_INSERT'

EXPORTING

folder_id = folder_id

object_type = 'EXT' "'RAW'

object_hd_change = l_obj_data

IMPORTING

object_id = l_obj_id

TABLES

objhead = lt_objhead

objcont = LT_OBJCONT

EXCEPTIONS

active_user_not_exist = 35

folder_not_exist = 6

object_type_not_exist = 17

owner_not_exist = 22

parameter_error = 23

OTHERS = 1000.

COMMIT WORK.

Data: tb_key(100).

IF sy-subrc = 0.

document_id-foltp = folder_id-foltp.

document_id-folyr = folder_id-folyr.

document_id-folno = folder_id-folno.

document_id-doctp = l_obj_id-objtp.

document_id-docyr = l_obj_id-objyr.

document_id-docno = l_obj_id-objno.

ELSE.

ENDIF.

Concatenate folder_id-foltp folder_id-folyr folder_id-folno

into tb_key.

swc_create_object attach 'SOFM' tb_key.

SWC_SET_ELEMENT CONTAINER 'ZSOFM' attach.

Second, call the method in the workflow in a background task (before sending the mail) and import the SOFM instance in to workflow then attach the SOFM object to the Attachment.

I trust that the above details are to help your Problem.

Thanks and Regards,

Prabhakar Dharmala

Former Member
0 Kudos

I have successfully acheived it as per Jeff Gebo's webinar in SDN.

Former Member
0 Kudos

Hi Antony,

Can you please tell me the steps how to attach an dynamically created PDF in an custom workflow. i searched for the webminar what you have specified but its not there. Kindly help me...................

Expecting your reply

Thanks in advance........

Thanks and Regards

Chandran Subramanian

Answers (0)