on 11-23-2006 11:11 AM
Hi Experts,
1. How do i convert the script layout into the PDF format
Can any one please expleain me
2. I have to convert the invoice script to PDF format, For a customer there are more than one invoice raised in a day . All the invoices whih are converted into PDf format has to get attached to mail and it should be sent to the customer through mail , Everything has to be done by system only....
Can any one explain how is it possible.
Thanks in Aadvance
Raju
I have done script which will convert to pdf and will be sent as mail to outlook.
REPORT Z_SCRIPT .
DATA: itcpo LIKE itcpo,
tab_lines LIKE sy-tabix.
Variables for EMAIL functionality
DATA: maildata LIKE sodocchgi1.
DATA: mailpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
DATA: mailhead LIKE solisti1 OCCURS 1 WITH HEADER LINE.
DATA: mailbin LIKE solisti1 OCCURS 10 WITH HEADER LINE.
DATA: mailtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE.
DATA: mailrec LIKE somlrec90 OCCURS 0 WITH HEADER LINE.
DATA: solisti1 LIKE solisti1 OCCURS 0 WITH HEADER LINE.
PERFORM send_form_via_email.
************************************************************************
FORM SEND_FORM_VIA_EMAIL *
************************************************************************
FORM send_form_via_email.
CLEAR: maildata, mailtxt, mailbin, mailpack, mailhead, mailrec.
REFRESH: mailtxt, mailbin, mailpack, mailhead, mailrec.
Creation of the document to be sent File Name
maildata-obj_name = 'TEST'.
Mail Subject
maildata-obj_descr = 'Subject'.
Mail Contents
mailtxt-line = 'Here is your file'.
APPEND mailtxt.
Prepare Packing List
PERFORM prepare_packing_list.
Set recipient - email address here!!!
mailrec-receiver = 'RAVINDRANATH.K@IN.BOSCH.COM'.
mailrec-rec_type = 'U'.
APPEND mailrec.
Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = maildata
put_in_outbox = ' '
TABLES
packing_list = mailpack
object_header = mailhead
contents_bin = mailbin
contents_txt = mailtxt
receivers = mailrec
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
OTHERS = 99.
ENDFORM.
************************************************************************
Form PREPARE_PACKING_LIST
************************************************************************
FORM prepare_packing_list.
CLEAR: mailpack, mailbin, mailhead.
REFRESH: mailpack, mailbin, mailhead.
DESCRIBE TABLE mailtxt LINES tab_lines.
READ TABLE mailtxt INDEX tab_lines.
maildata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( mailtxt ).
Creation of the entry for the compressed document
CLEAR mailpack-transf_bin.
mailpack-head_start = 1.
mailpack-head_num = 0.
mailpack-body_start = 1.
mailpack-body_num = tab_lines.
mailpack-doc_type = 'RAW'.
APPEND mailpack.
Creation of the document attachment
This form gets the OTF code from the SAPscript form.
If you already have your OTF code, I believe that you may
be able to skip this form. just do the following code, looping thru
your SOLISTI1 and updating MAILBIN.
PERFORM get_otf_code.
LOOP AT solisti1.
MOVE-CORRESPONDING solisti1 TO mailbin.
APPEND mailbin.
ENDLOOP.
DESCRIBE TABLE mailbin LINES tab_lines.
mailhead = 'TEST.OTF'.
APPEND mailhead.
Creation of the entry for the compressed attachment
mailpack-transf_bin = 'X'.
mailpack-head_start = 1.
mailpack-head_num = 1.
mailpack-body_start = 1.
mailpack-body_num = tab_lines.
mailpack-doc_type = 'OTF'.
mailpack-obj_name = 'TEST'.
mailpack-obj_descr = 'Subject'.
mailpack-doc_size = tab_lines * 255.
APPEND mailpack.
ENDFORM.
************************************************************************
Form GET_OTF_CODE
************************************************************************
FORM get_otf_code.
DATA: BEGIN OF otf OCCURS 0.
INCLUDE STRUCTURE itcoo .
DATA: END OF otf.
DATA: itcpo LIKE itcpo.
DATA: itcpp LIKE itcpp.
CLEAR itcpo.
itcpo-tdgetotf = 'X'.
Start writing OTF code
CALL FUNCTION 'OPEN_FORM'
EXPORTING
form = 'Z08V3_COLLI'
language = sy-langu
options = itcpo
dialog = ' '
EXCEPTIONS
OTHERS = 1.
CALL FUNCTION 'START_FORM'
EXCEPTIONS
error_message = 01
OTHERS = 02.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
window = 'MAIN'
EXCEPTIONS
error_message = 01
OTHERS = 02.
Close up Form and get OTF code
CALL FUNCTION 'END_FORM'
EXCEPTIONS
error_message = 01
OTHERS = 02.
MOVE-CORRESPONDING itcpo TO itcpp.
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
result = itcpp
TABLES
otfdata = otf
EXCEPTIONS
OTHERS = 1.
Move OTF code to structure SOLI form email
CLEAR solisti1. REFRESH solisti1.
LOOP AT otf.
solisti1-line = otf.
APPEND solisti1.
ENDLOOP.
ENDFORM.
Check this it may help u.
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
Visit this link for SAMple code of SAPSCRIPT to PDF.:
http://www.sapgenie.com/abap/pdf_creation.htm
and check the following weblog for code samples.
/people/sap.user72/blog/2004/11/10/bsphowto-generate-pdf-output-from-a-bsp
chk this one
http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm
some function modules useful would be
CONVERT_OTF
SO_NEW_DOCUMENT_ATT_SEND_API1 to send mails with attachments
plzz refer to this link..it will solve ur problem
Regards,
Anver
<b><i>
if hlped pls mark points</i></b>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.