Sap script convert to pdf and then send to email
Hi,
good day sap guys
ive dev the sap scipt for customer statemnet one which is used the t.code is f.27.
i need to convert the sap script to pdf and then send to email.
plz let me know..
how to do it.
regards
chandu
Hi,
I script program use the following (go to the "call function 'CLOSE_FORM'")
data: binfilesize type i.
data: pdftab type table of tline with header line.
data: i_itcpp like itcpp.
data: g_t_otfdata type standard table of itcoo with header line.
call function 'CLOSE_FORM'
IMPORTING
RESULT = i_itcpp
tables
otfdata = g_t_otfdata[]
exceptions
others = 1.
if sy-subrc ne 0.
retcode = sy-subrc.
perform protocol_update.
endif.
call function 'CONVERT_OTF'
exporting
format = 'PDF'
importing
bin_filesize = binfilesize
BIN_FILE =
tables
otf = g_t_otfdata[]
lines = pdftab[].
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
concatenate file_path '.pdf' into filename.
call function 'GUI_DOWNLOAD'
exporting
bin_filesize = binfilesize
filename = filename
filetype = 'BIN'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
IMPORTING
FILELENGTH =
tables
data_tab = pdftab[]
FIELDNAMES =
exceptions
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
others = 22
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
Similar Messages
-
Cannot convert to PDF and then send for sigs
I can convert documents to PDF, but they are being converted at 41.5%. When I send for signatures, they expand out to 100% and the signatures and initials stay at 41.5%, so signing and initially are impossible.
I can convert documents to PDF, but they are being converted at 41.5%. When I send for signatures, they expand out to 100% and the signatures and initials stay at 41.5%, so signing and initially are impossible.
-
When I save a Pages document as a pdf and then try to email the document, it loads as an application octet-stream dat file instead of a pdf and recipients can't open it. Some load correctly, but about half don't load as a pdf. What's happening?
Hi mjmonck-
Which email provider are you using? There are different solutions possible for different providers. Yahoo is having trouble with attachments, outside of any Firefox issue. I've seen a Google user fix this by manually adding the mail URL to their ad block program- which mistakenly perceived the webmail page as an advertisement.
Hope this helps. -
ME23N Script convert to PDF and send thru mail to the user created by
Hi,
I have created a custom PO SAP scirpt for the tcode ME23N and configured the same in tcode NACE Application 'EF' , output type 'NEU'
But the client requirement is to send this SAP Scipt PO converted to pdf & then send thru email to the user who created PO (ME23N)?
How do u get this functionality please let me know?
Regards,
AnilHello,
that is easy, you only need to keep the steps to do in mind:
1) find a suitable point to place in your code to do all this for you
2) create a FM that will convert your form into PDF (search a little, this has been done like zillion times here)
3) create a FM that will send the PDF stream (hex data which is accepted by the BCS class as the attachment data)
4) check the email customizing in your system
5) run and enjoy
All the parts has been done here many times, shouldn´t be a problem.
Otto -
Script Converting into PDF and Sent by Mail -
Hi Experts,
I have faced one problem in Script Converting into PDF format and Sent it thro Mail.
I have used to SX_OBJECT_CONVERT_OTF_PDF FM to convert into PDF format.
and I have used SO_NEW_DOCUMENT_ATT_SEND_API1 FM for sending a Mail.
Now my Problem is, How is use these FM s Correctly. what are the parameters to be passed to send a mail.
Kindly give the Coding for sending a Mail using these above FMs .
With Thanks,
Neptune.Mhi use this...this is good for sending a smartform in pdf format to spool..
REPORT zspooltopdf.
PARAMETER: p_email1 LIKE somlreci1-receiver,
p_sender LIKE somlreci1-receiver,
p_delspl AS CHECKBOX.
*DATA DECLARATION
DATA: gd_recsize TYPE i.
Spool IDs
TYPES: BEGIN OF t_tbtcp.
INCLUDE STRUCTURE tbtcp.
TYPES: END OF t_tbtcp.
DATA: it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0,
wa_tbtcp TYPE t_tbtcp.
Job Runtime Parameters
DATA: gd_eventid LIKE tbtcm-eventid,
gd_eventparm LIKE tbtcm-eventparm,
gd_external_program_active LIKE tbtcm-xpgactive,
gd_jobcount LIKE tbtcm-jobcount,
gd_jobname LIKE tbtcm-jobname,
gd_stepcount LIKE tbtcm-stepcount,
gd_error TYPE sy-subrc,
gd_reciever TYPE sy-subrc.
DATA: w_recsize TYPE i.
DATA: gd_subject LIKE sodocchgi1-obj_descr,
it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
gd_sender_type LIKE soextreci1-adr_typ,
gd_attachment_desc TYPE so_obj_nam,
gd_attachment_name TYPE so_obj_des.
Spool to PDF conversions
DATA: gd_spool_nr LIKE tsp01-rqident,
gd_destination LIKE rlgrap-filename,
gd_bytecount LIKE tst01-dsize,
gd_buffer TYPE string.
Binary store for PDF
DATA: BEGIN OF it_pdf_output OCCURS 0.
INCLUDE STRUCTURE tline.
DATA: END OF it_pdf_output.
CONSTANTS: c_dev LIKE sy-sysid VALUE 'DEV',
c_no(1) TYPE c VALUE ' ',
c_device(4) TYPE c VALUE 'LOCL'.
*START-OF-SELECTION.
START-OF-SELECTION.
Write statement to represent report output. Spool request is created
if write statement is executed in background. This could also be an
ALV grid which would be converted to PDF without any extra effort
WRITE 'Hello World'.
new-page.
commit work.
new-page print off.
IF sy-batch EQ 'X'.
PERFORM get_job_details.
PERFORM obtain_spool_id.
Alternative way could be to submit another program and store spool
id into memory, will be stored in sy-spono.
*submit ZSPOOLTOPDF2
to sap-spool
spool parameters %_print
archive parameters %_print
without spool dynpro
and return.
Get spool id from program called above
IMPORT w_spool_nr FROM MEMORY ID 'SPOOLTOPDF'.
PERFORM convert_spool_to_pdf.
PERFORM process_email.
if p_delspl EQ 'X'.
PERFORM delete_spool.
endif.
IF sy-sysid = c_dev.
wait up to 5 seconds.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
AND RETURN.
ENDIF.
ELSE.
SKIP.
WRITE:/ 'Program must be executed in background in-order for spool',
'request to be created.'.
ENDIF.
FORM obtain_spool_id *
FORM obtain_spool_id.
CHECK NOT ( gd_jobname IS INITIAL ).
CHECK NOT ( gd_jobcount IS INITIAL ).
SELECT * FROM tbtcp
INTO TABLE it_tbtcp
WHERE jobname = gd_jobname
AND jobcount = gd_jobcount
AND stepcount = gd_stepcount
AND listident <> '0000000000'
ORDER BY jobname
jobcount
stepcount.
READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
IF sy-subrc = 0.
message s004(zdd) with gd_spool_nr.
gd_spool_nr = wa_tbtcp-listident.
MESSAGE s004(zdd) WITH gd_spool_nr.
ELSE.
MESSAGE s005(zdd).
ENDIF.
ENDFORM.
FORM get_job_details *
FORM get_job_details.
Get current job details
CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
IMPORTING
eventid = gd_eventid
eventparm = gd_eventparm
external_program_active = gd_external_program_active
jobcount = gd_jobcount
jobname = gd_jobname
stepcount = gd_stepcount
EXCEPTIONS
no_runtime_info = 1
OTHERS = 2.
ENDFORM.
FORM convert_spool_to_pdf *
FORM convert_spool_to_pdf.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = gd_spool_nr
no_dialog = c_no
dst_device = c_device
IMPORTING
pdf_bytecount = gd_bytecount
TABLES
pdf = it_pdf_output
EXCEPTIONS
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
OTHERS = 12.
CHECK sy-subrc = 0.
Transfer the 132-long strings to 255-long strings
LOOP AT it_pdf_output.
TRANSLATE it_pdf_output USING ' ~'.
CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
ENDLOOP.
TRANSLATE gd_buffer USING '~ '.
DO.
it_mess_att = gd_buffer.
APPEND it_mess_att.
SHIFT gd_buffer LEFT BY 255 PLACES.
IF gd_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
ENDFORM.
FORM process_email *
FORM process_email.
DESCRIBE TABLE it_mess_att LINES gd_recsize.
CHECK gd_recsize > 0.
PERFORM send_email USING p_email1.
perform send_email using p_email2.
ENDFORM.
FORM send_email *
--> p_email *
FORM send_email USING p_email.
CHECK NOT ( p_email IS INITIAL ).
REFRESH it_mess_bod.
Default subject matter
gd_subject = 'Subject'.
gd_attachment_desc = 'Attachname'.
CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
it_mess_bod = 'Message Body text, line 1'.
APPEND it_mess_bod.
it_mess_bod = 'Message Body text, line 2...'.
APPEND it_mess_bod.
If no sender specified - default blank
IF p_sender EQ space.
gd_sender_type = space.
ELSE.
gd_sender_type = 'INT'.
ENDIF.
Send file by email as .xls speadsheet
PERFORM send_file_as_email_attachment
tables it_mess_bod
it_mess_att
using p_email
'Example .xls documnet attachment'
'PDF'
gd_attachment_name
gd_attachment_desc
p_sender
gd_sender_type
changing gd_error
gd_reciever.
ENDFORM.
FORM delete_spool *
FORM delete_spool.
DATA: ld_spool_nr TYPE tsp01_sp0r-rqid_char.
ld_spool_nr = gd_spool_nr.
CHECK p_delspl <> c_no.
CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
EXPORTING
spoolid = ld_spool_nr.
ENDFORM.
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
Send email
FORM send_file_as_email_attachment tables it_message
it_attach
using p_email
p_mtitle
p_format
p_filename
p_attdescription
p_sender_address
p_sender_addres_type
changing p_error
p_reciever.
DATA: ld_error TYPE sy-subrc,
ld_reciever TYPE sy-subrc,
ld_mtitle LIKE sodocchgi1-obj_descr,
ld_email LIKE somlreci1-receiver,
ld_format TYPE so_obj_tp ,
ld_attdescription TYPE so_obj_nam ,
ld_attfilename TYPE so_obj_des ,
ld_sender_address LIKE soextreci1-receiver,
ld_sender_address_type LIKE soextreci1-adr_typ,
ld_receiver LIKE sy-subrc.
data: t_packing_list like sopcklsti1 occurs 0 with header line,
t_contents like solisti1 occurs 0 with header line,
t_receivers like somlreci1 occurs 0 with header line,
t_attachment like solisti1 occurs 0 with header line,
t_object_header like solisti1 occurs 0 with header line,
w_cnt type i,
w_sent_all(1) type c,
w_doc_data like sodocchgi1.
ld_email = p_email.
ld_mtitle = p_mtitle.
ld_format = p_format.
ld_attdescription = p_attdescription.
ld_attfilename = p_filename.
ld_sender_address = p_sender_address.
ld_sender_address_type = p_sender_addres_type.
Fill the document data.
w_doc_data-doc_size = 1.
Populate the subject/generic message attributes
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle .
w_doc_data-sensitivty = 'F'.
Fill the document data and get size of attachment
CLEAR w_doc_data.
READ TABLE it_attach INDEX w_cnt.
w_doc_data-doc_size =
( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle.
w_doc_data-sensitivty = 'F'.
CLEAR t_attachment.
REFRESH t_attachment.
t_attachment[] = it_attach[].
Describe the body of the message
CLEAR t_packing_list.
REFRESH t_packing_list.
t_packing_list-transf_bin = space.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = 1.
DESCRIBE TABLE it_message LINES t_packing_list-body_num.
t_packing_list-doc_type = 'RAW'.
APPEND t_packing_list.
Create attachment notification
t_packing_list-transf_bin = 'X'.
t_packing_list-head_start = 1.
t_packing_list-head_num = 1.
t_packing_list-body_start = 1.
DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
t_packing_list-doc_type = ld_format.
t_packing_list-obj_descr = ld_attdescription.
t_packing_list-obj_name = ld_attfilename.
t_packing_list-doc_size = t_packing_list-body_num * 255.
APPEND t_packing_list.
Add the recipients email address
CLEAR t_receivers.
REFRESH t_receivers.
t_receivers-receiver = ld_email.
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
APPEND t_receivers.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_data
put_in_outbox = 'X'
sender_address = ld_sender_address
sender_address_type = ld_sender_address_type
commit_work = 'X'
IMPORTING
sent_to_all = w_sent_all
TABLES
packing_list = t_packing_list
contents_bin = t_attachment
contents_txt = it_message
receivers = t_receivers
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.
Populate zerror return code
ld_error = sy-subrc.
Populate zreceiver return code
LOOP AT t_receivers.
ld_receiver = t_receivers-retrn_code.
ENDLOOP.
ENDFORM.
regards,
venkat. -
Script- converting in PDF and sending by mail.
Hi.
I have a sap-script for account statement.Now the same needs to be sent to customers by mail.The file format i need is PDF.
Can anyone suggest the steps I need to takeHelloo!
You first need to get the OTF code from the sapscript.
Then you should pass this to the email-function module.
REPORT Zscript_mail.
Here is a sample program.
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 = '[email protected]'.
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 = 'ZTEST_FORM'
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.
Thanks,
Susmitha -
Fax the output type and convert to PDF and then to save in UNIX Directory
Hi,
I wan to Fax the my sales order acknowldement and at the same time I want to convert that output into PDF and save in the UNIX Directory .
I also need the code for faxing the sales order acknowledgement.
Thanks in Advance
Moderator message: please search for available information/documentation before asking, also see Brad's remarks below.
Edited by: Thomas Zloch on Dec 20, 2010 9:51 PMThese are standard processes which are covered in the help files and have been discussed many times here. This is NOT a training forum for newbies where experts just give you the solution for your requirement. Once you have proven that you've actually made an effort to solve the issue yourself and have a SPECIFIC technical question, you'll get some help...
-
Validate form and then send an email
Hi there,
I have pretty much built a form which I can validate how I
want to. How can I can now send the email. Generally I use php to
send my emails. Can somebody give me a pointer on how to tie the
two together?
regards, ChrisHi there,
I have pretty much built a form which I can validate how I
want to. How can I can now send the email. Generally I use php to
send my emails. Can somebody give me a pointer on how to tie the
two together?
regards, Chris -
Reg: HRforms converted to PDF and send email to individual employee
Hi Experts,
The requirement is convert the HR form output to pdf and send email to respective employee in standard transaction. I copied RPCEDTX0 to ZRPCEDTX0 and include RPCEDS09 to ZRPCEDS09, the changes need to be done for individual PERNR, I have modified the include as shown below.
CALL FUNCTION 'HRPY_PROCESS_SET_PERNR_STATUS' after this, i have written my code
* start of changes ARAFIQUE
DATA: formname TYPE tdsfname VALUE 'HR_ESS_PAYSLIP_TO_PDF',
fm_name TYPE rs38l_fnam,
pinfo LIKE pc407 OCCURS 0 WITH HEADER LINE,
pform type tt_pc408,
pform_l like pc408 OCCURS 0 WITH HEADER LINE.
IF xform[] IS NOT INITIAL.
pform_l = xform.
APPEND pform_1 TO pform.
pinfo-molga = '99'.
pinfo-forml = 'ZACC'.
APPEND pinfo.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = formname
* VARIANT = ' '
* DIRECT_CALL = ' '
IMPORTING
fm_name = fm_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION fm_name
EXPORTING
pinfo =
pform = xform[]
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
* end of changes ARAFIQUE
I found out in internet that the smartform 'HR_ESS_PAYSLIP_TO_PDF' will convert to PDF and then i can send email to PERNRS.Hi Experts,
I have written the below code, the payslip is getting converted to PDF and it is getting saved in presentation server. I need to pick this file and mail, I created a customized function module for sending mail. I'm not able to send email to external addresses.
Please find my code below. I will post the function module later.
* start of changes ARAFIQUE
DATA: "formname TYPE tdsfname VALUE 'HR_ESS_PAYSLIP_TO_PDF',
"fm_name TYPE rs38l_fnam,
p_info LIKE pc407 OCCURS 0 WITH HEADER LINE,
"pform type tt_pc408,
p_form LIKE pc408 OCCURS 0 WITH HEADER LINE,
pdf_content TYPE xstring,
pdf_fsize TYPE i,
lv_output_length TYPE i,
lt_binary_data TYPE STANDARD TABLE OF sdokcntbin,
it_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
it_message LIKE solisti1 OCCURS 0 WITH HEADER LINE.
IF xform[] IS NOT INITIAL.
p_form[] = xform[].
p_info-molga = '99'.
p_info-forml = 'ZACC'.
p_info-pcols = 1.
p_info-psize = 1.
APPEND p_info.
CALL FUNCTION 'CONVERT_PAYSLIP_TO_PDF'
EXPORTING
p_info = p_info
IMPORTING
pdf_content = pdf_content
pdf_fsize = pdf_fsize
TABLES
p_form = p_form[]
EXCEPTIONS
empty_form = 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.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = pdf_content
IMPORTING
output_length = lv_output_length
TABLES
binary_tab = lt_binary_data.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'C:\Test\Testing.pdf'
filetype = 'BIN'
TABLES
data_tab = lt_binary_data
* FIELDNAMES =
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22
it_receivers-receiver = 'gmailid'.
it_receivers-rec_type = 'U'.
it_receivers-com_type = 'INT'.
APPEND it_receivers .
it_message-line = 'Test for sending email'.
APPEND it_message.
CALL FUNCTION 'ZSEND_MAIL_ATTACHMENT'
EXPORTING
v_file_path = 'C:\Test\Testing.pdf'
v_subject = 'Test Mail'
TABLES
it_receivers = it_receivers[]
it_message = it_message[].
IF sy-subrc EQ 0.
COMMIT WORK.
* Push mail out from SAP outbox
SUBMIT rsconn01 WITH mode = 'INT' AND RETURN.
ENDIF. -
Smart Form convert to Pdf and send to email
hi,
ive dev the smart for me21n. its working fine. Standard programme is SAPLMEGUI.
now new requirement is , convert the smart form to pdf and then sending the pdf through email to customer.
Can any plz tell me is there any stadard programme or else need to custmise the print programme?
RegardsKirans belong to convert the smart form to pdf.
there is standard programme RSTXPDFT4
but after convert the form to pdf. i need to send it thorough mail.
iam checking other link one which is send by mr.naresh..
thank you
Regards -
Convert Script output into PDF and save into Unix Directory
Hi,
I had Sales Order Acknowledgement Output and wants to converted to PDFs and then these PDFs to be placed in Unix Directory
on their way to Docs Library.
I am using the following code
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT = itcpp
TABLES
otfdata = lt_otf " OTF Data
EXCEPTIONS
unopened = 1
OTHERS = 2.
After this form , table ltf_otf is empty, So i am not converting into PDF .
So i need the logic to convert to PDF , and most importantly logic to save into UNIX Directory.
ThanksHi,
If you are using the Function Module "OPEN_FORM" to open the form for printing then in this function module there is an IMPORTING parameter OPTIONS which is of type ITCPO to this parameter "OPTIONS-TDGETOTF" needs to be passed as 'X' which will give you the OTF output in the FM "CLOSE_FORM".
After this call the FM "CONVERT_OTF" and pass the FORMAT as "PDF" which will give you the PDF output in LINES table Parameter. Most important please pass some dummy variable to BIN_FILESIZE variable.
Now by using OPEN DATASET file name FOR OUTPUT IN BINARY MODE and the LOOP the PDF table and use the TRANSFER statement to place the data in the UNIX File and then Finally use the CLOSE DATASET file name.
Hope will help to address your issue.
Regards,
SRinivas -
To convert Sap Script output to PDF format and send it via email.
Hi Friends,
Could any one please tell me, how to convert the Sap Script output to PDF format and send it via email. If any one have the code, kindly mail me to [email protected]
Thanks & Regards,
JohnPlese check this sample code from other thread.
REPORT zzz_jaytest .
Types Declaration
TYPES : BEGIN OF ty_pa0001,
pernr TYPE pa0001-pernr,
bukrs TYPE pa0001-bukrs,
werks TYPE pa0001-werks,
END OF ty_pa0001.
Internal Table Declaration
DATA : i_pa0001 TYPE STANDARD TABLE OF ty_pa0001, "For pa0001 Details
i_otf TYPE STANDARD TABLE OF itcoo, "For OTF data
i_content_txt TYPE soli_tab, "Content
i_content_bin TYPE solix_tab, "Content
i_objhead TYPE soli_tab,
Work Area Declaration
w_pa0001 TYPE ty_pa0001, "For pa0001 Details
w_res TYPE itcpp, "SAPscript output
"parameters
w_otf TYPE itcoo, "For OTF
w_pdf TYPE solisti1, "For PDF
w_transfer_bin TYPE sx_boolean, "Content
w_options TYPE itcpo, "SAPscript output
"interface
Variable Declaration
v_len_in TYPE so_obj_len,
v_size TYPE i.
Constants Declaration
CONSTANTS : c_x TYPE c VALUE 'X', "X
c_locl(4) TYPE c VALUE 'LOCL', "Local Printer
c_otf TYPE sx_format VALUE 'OTF', "OTF
c_pdf TYPE sx_format VALUE 'PDF', "PDF
c_printer TYPE sx_devtype VALUE 'PRINTER', "PRINTER
c_bin TYPE char10 VALUE 'BIN', "BIN
c_name TYPE string VALUE 'C:\ZZZ_JAYTEST.PDF',"Downloading
"File Name
c_form(11) TYPE c VALUE 'ZZZ_JAYTEST'. "Form Name
START-OF-SELECTION.
Selecting the records from pa0001
SELECT pernr bukrs werks FROM pa0001
INTO TABLE i_pa0001 UP TO 10 ROWS.
Setting the options
w_options-tdcopies = 1 ."Number of copies
w_options-tdnoprev = c_x."No print preview
w_options-tdgetotf = c_x."Return of OTF table
w_options-tddest = c_locl."Spool: Output device
Opening the form
CALL FUNCTION 'OPEN_FORM'
EXPORTING
form = c_form
device = c_printer
language = sy-langu
OPTIONS = w_options
IMPORTING
RESULT = w_res.
LOOP AT i_pa0001 INTO w_pa0001.
Writting into the form
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'MAIN'
window = 'MAIN'.
ENDLOOP.
Closing the form
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT = w_res
TABLES
otfdata = i_otf
EXCEPTIONS
unopened = 1
bad_pageformat_for_print = 2
send_error = 3
spool_error = 4
codepage = 5
OTHERS = 6.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Converting OTF data to single line
LOOP AT i_otf INTO w_otf.
CONCATENATE w_otf-tdprintcom w_otf-tdprintpar
INTO w_pdf.
APPEND w_pdf TO i_content_txt.
ENDLOOP.
Converting to PDF Format
CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'
EXPORTING
format_src = c_otf
format_dst = c_pdf
devtype = c_printer
CHANGING
transfer_bin = w_transfer_bin
content_txt = i_content_txt
content_bin = i_content_bin
objhead = i_objhead
len = v_len_in
EXCEPTIONS
err_conv_failed = 1
OTHERS = 2.
v_size = v_len_in.
Downloading the PDF File
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = v_size
filename = c_name
filetype = c_bin
TABLES
data_tab = i_content_bin.
The extension is put the it_mailpack-obj_name parameter of 'SO_NEW_DOCUMENT_ATT_SEND_API1'. -
How do I convert a word document into a pdf and then upload it to a web site
How do I convert a word document into a pdf and then upload it to a web site so people can read it from my
site with Dreamweaver 4?. How can I do this? Can anyone please help? I'm only a newbie. Thanking you in anticipation.First you need to install a means of printing to pdf from word. I like cutepdf writer ( http://cutepdf.com/Products/CutePDF/writer.asp ). Once installed you will print the doc in word and under the printer selection you choose pdf.
Once you have the file you put it in your local site folders and upload it using Dreamweaver. Be sure to link to it from a page so users can get to it and I would recommend giving the link a target of _black so it will open in a new window (see the properties inspector in DW). -
Error while converting Image -to- PDF and then to PDF/A
Hi,
I'm trying to convert a Image format(JPEG,bmp,tiff) to PDF and then to PDF/A. I could able to convert Image to PDF successfully.
I'm getting the below error while converting the PDF(that was generated) to PDF/A.
Caused by: com.adobe.livecycle.output.exception.OutputException: Input Document is a already flat PDF Document
at com.adobe.printSubmitter.PrintServer.transformPDF(PrintServer.java:307)
at com.adobe.printSubmitter.service.OutputServiceImpl.transformPDFInTxn(OutputServiceImpl.ja va:518)
at com.adobe.printSubmitter.service.OutputServiceImpl$4.doInTransaction(OutputServiceImpl.ja va:481)
... 106 more
Error OCCURRED: ALC-DSC-000-000: com.adobe.idp.dsc.DSCException: Internal error.
Please give me the solution to convert PDF to PDF/A?I've just read a footnote in the API documentation which indicates that the transformPDF function cannot be used for this purpose:
"GS_Enterprise said on Nov 24, 2007 at 12:03 PM :
Please note that the parameter "inPdfDoc" for transformPDF assumes that the stream content is an XFA-based PDF, and that it's not an XFA-based PDF with a PDF background (also known as "XFA foreground"). In other words, this function does not convert any input PDF to PDF/A, but only those PDFs generated from an XFA template which does not include any static PDF content as a background." -
My hard drive died last week, and I needed to install a new one. Previously, I was able to save a .doc with text and inserted photo to .pdf and then to .jpg. Now I can get the .pdf but can't determine what to do to convert to .jpg. Does anyone know ?
Rather than do that, which means starting over from scratch, losing all your edits, organisation and so on, why not simply use iPhoto Library Manager to revert the Library to the older version? Easier, less destructive.
The instructions on that are here
If you really want to start over: you can access the Originals folder simply by going to your Pictures Folder and finding the iPhoto Library there. Right (or Control-) Click on the icon and select 'Show Package Contents'. A finder window will open with the Library exposed.
Maybe you are looking for
-
How to print a local file from jsp
Hi, I want to print a local file(eg. .doc,.pdf) from a jsp. Please help me with any answer or any example code Thanks in advance Regards, Sanjeev
-
I have the following problem: I want that the structure from the TRUE case of the bigger case structure to start only when I switch from the button and activate the TRUE position. I observed with the probe tool that the structure is still executed in
-
Move tables (some with LONG datatypes) across tablespaces in Oracle 9i
I have a 14GB tablespace which about 3,000 tables (and only tables) in. Only 2.6GB is used so I would like to resize the tablespace to about 3GB initially. I moved the tables with "alter table <owner>.<tablename> move tablespace <tablespace>" and thi
-
Employee termination workflow ECC5.0
Hi Everybody, We have a requirement to do a workflow for employee termination approval in HR. We are on ECC5.0. Manager will have to propose the termination, an approver will have to approve and then HR Admin will review the info and then the databas
-
Faster Full-Name Viewing in List View - does not always work
A little while ago I discovered the Tip (from the Apple Pro tips page) on how one can view the entire file name when in List View and the name is too long to view without widening the column. One can just roll the mouse over it and wait. But, one can