06-07-2006 4:07 PM
Hi,
I am sending a Smartform data as a PDF attachment to an internet email ID.
Everything looks fine except the PDF file name.
Somehow it gets a name 'Filename.PDF', eventhough I have set the parameter <u>obj_name = 'TESTFILE'.</u>
For further clarification I am attaching the code snippet.
gt_objpack-head_start = 1.
*-Create Message Body
*- Title and Description
gw_docdata-obj_name = 'TESTOBJ'.
gw_docdata-obj_descr = 'Testing Object '.
* Email Body must represent the OTF Data
* Email body
gt_objtxt = 'SAP Document Attached'.
APPEND gt_objtxt. CLEAR gt_objtxt.
*-Write Packing List (Main Body)
DESCRIBE TABLE gt_objtxt LINES gw_tab_lines.
READ TABLE gt_objtxt INDEX gw_tab_lines.
gw_docdata-doc_size = ( gw_tab_lines - 1 ) * 255 +
STRLEN( gt_objtxt ).
CLEAR gt_objpack-transf_bin.
gt_objpack-head_start = 1.
gt_objpack-head_num = 0.
gt_objpack-body_start = 1.
gt_objpack-body_num = gw_tab_lines.
gt_objpack-doc_type = 'RAW'.
APPEND gt_objpack. CLEAR gt_objpack.
*Create Message Attachment
* Write Packing List (Attachment)
gw_att_type = 'OTF'.
gt_objbin[] = gw_job_output_info-otfdata[].
DESCRIBE TABLE gt_objbin LINES gw_tab_lines.
READ TABLE gt_objbin INDEX gw_tab_lines.
gt_objpack-doc_size = ( gw_tab_lines - 1 ) * 255 +
STRLEN( gt_objbin ).
gt_objpack-transf_bin = 'X'.
gt_objpack-head_start = 1.
gt_objpack-head_num = 0.
gt_objpack-body_start = 1.
gt_objpack-body_num = gw_tab_lines.
gt_objpack-doc_type = gw_att_type.
<u> gt_objpack-obj_name = 'TESTFILE'.</u>
gt_objpack-obj_descr = lw_ob_desc.
APPEND gt_objpack. CLEAR gt_objpack.
gt_reclist-receiver = p_email.
gt_reclist-rec_type = 'U'.
APPEND gt_reclist. CLEAR gt_reclist.
* Send Message
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = gw_docdata
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = gt_objpack
contents_bin = gt_objbin
contents_txt = gt_objtxt
receivers = gt_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
Have I missed something ?
Can you experts guide me on how to change my PDF filename.
Regards
RK
06-07-2006 4:10 PM
HI Rajiv,
Did you check what is the content of lw_ob_desc?
<b>gt_objpack-obj_descr = lw_ob_desc.</b>
I'm sure if you give the lw_obj_desc = 'TESTFILE' then it will work.
Regards,
Ravi
P.S: PLease award points for helpful posts
06-07-2006 4:10 PM
HI Rajiv,
Did you check what is the content of lw_ob_desc?
<b>gt_objpack-obj_descr = lw_ob_desc.</b>
I'm sure if you give the lw_obj_desc = 'TESTFILE' then it will work.
Regards,
Ravi
P.S: PLease award points for helpful posts
06-07-2006 4:14 PM
Hi Ravi,
In current case, it is without any value (space).
Regards
Rajiv
06-07-2006 5:46 PM
HI Ravi,
You were SPOT-ON.
Issue solved as I passed the file name to DESCRIPTION rather than the OBJECT NAME.
I guess abit weird but it solved my problem.
Thanks for showing the right path. Full points awarded.
Regards
Rajiv