on 05-28-2007 5:10 PM
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.