Compress pdf (smart forms)
i am trying to get the output of a smart form as PDF
but cause of extra spaces in the smart form print out
the size of pdf is very big about 6-9 mb .
can you please help me out
thanks in advance
Naval
hi,
Maybe the function module CONVERT_OTFSPOOLJOB_2_PDF (or CONVERT_ABAPSPOOLJOB_2_PDF) is the right choice for you. It converts the OTF-File in the Spool to PDF-Format.
Mario
Similar Messages
-
Email PDF smart form Support Desk
Hi SDN,
I'm working on support desk - solution manager, and i need to send the solution of the support message by email to the final user.
There is an standard action (SLF1 -SMSD_SERVICE_ORDER_DNO_OUTPUT) that sends the solution in pdf format by email, but we couldn't set the receivers online.
So, I'm using an "z" action that executes an smart form, and i would like to send the smart form in pdf format by the internet.
I'd like to use fm SO_DYNP_OBJECT_SEND, because the user must fill the receivers on-line
So far i have de OTF, and i know that i can make a conversion to pdf format, but i've the following problem
- the pdf in attach is empty, it may be because of the format, or may be i'm not using correctly this function.
Thanks in advance,
Maria João Rocha
call function 'CONVERT_OTF'
exporting
format = 'PDF'
importing
bin_filesize = w_pdf_size
tables
otf = es_job_output_info-otfdata[]
lines = t_pdf[]
exceptions
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
err_bad_otf = 4
others = 5.
* header
wa_head-objnam = 'EMAIL'.
wa_head-objdes = ls_output_options-tdtitle.
wa_head-objnam = ls_output_options-tdtitle.
wa_head-objla = sy-langu.
wa_head-objsns = 'O'.
wa_head-file_ext = 'TXT'.
append wa_head to t_head.
wa_packing_list-transf_bin = 'X'.
wa_packing_list-head_start = 1.
wa_packing_list-head_num = 0.
wa_packing_list-body_start = 1.
wa_packing_list-objtp = 'RAW'.
* wa_packing_list-objtp = 'EXT'.
wa_packing_list-objdes = ls_output_options-tdtitle.
wa_packing_list-objla = sy-langu.
wa_packing_list-objlen = w_pdf_size.
wa_packing_list-file_ext = 'PDF'.
append wa_packing_list to t_packing_list.
*---------- enviar o mail
call function 'SO_DYNP_OBJECT_SEND'
exporting
* object_hd_change = ls_output_options-tdtitle
object_type = 'RAW'
* originator_type = 'B'
* originator = sy-uname
outbox_flag = 'S'
tables
* objcont = t_text
* receivers = t_receivers
packing_list = t_packing_list
att_cont = t_cont
att_head = t_head
exceptions
active_user_not_exist = 1
communication_failure = 2
component_not_available = 3
folder_not_exist = 4
folder_no_authorization = 5
forwarder_not_exist = 6
note_not_exist = 7
object_not_exist = 8
object_not_sent = 9
object_no_authorization = 10
object_type_not_exist = 11
operation_no_authorization = 12
owner_not_exist = 13
parameter_error = 14
substitute_not_active = 15
substitute_not_defined = 16
system_failure = 17
too_much_receivers = 18
user_not_exist = 19
x_error = 20
others = 21.
endif.Thanks for your reply.
I'm working on it, and Ive seen the SCOT documentation, so I've change my strategy.
Right now I'm using some of the methods of the BOR.
I think I've to code because I want a popup to introduce the list of the receivers and the mail body, and of course I want to attach a smart form on pdf format.
But I cant send the mail because of the error: Erro interno: SO_OBJECT_MIME_GET Exceção: 2
Can you help me on this? What Im doing wrong? What document class I need to use on the AttachmentType?
Thanks in advance.
Best regards,
Maria João Rocha
FUNCTION Z_MAIL_DIALOGO.
*"*"Interface local:
*" IMPORTING
*" REFERENCE(TITULO) TYPE SOOD1-OBJDES OPTIONAL
*" REFERENCE(FILE_SIZE) TYPE SOOD1-OBJLEN OPTIONAL
*" TABLES
*" OTF TYPE TSFOTF OPTIONAL
*" PDF STRUCTURE TLINE OPTIONAL
*" CONTEXT TYPE SOLI_TAB OPTIONAL
* Makros für Zugriff aufs BOR
include <cntn01>.
*parameters: dialog like sonv-flag.
data: dialog like sonv-flag.
* Datendeklaration
data: message type swc_object.
data: recipient type swc_object.
data: recip_tab type swc_object occurs 1 with header line.
data: objkey like swotobjid-objkey.
data: content like soli-line occurs 0 with header line.
data: title(80).
data: persnumber like adcp-persnumber.
data: sent_to_all like sonv-flag,
object_list like sosndinf occurs 1 with header line.
data: t_otf type standard table of ITCOO.
data: itab like soli occurs 0.
* Deklaration eines Containers
swc_container container.
* Message-Objekt anlegen
* * Neues Message-Objekt generieren
swc_create_object message 'Message' space.
swc_clear_container container.
if dialog = space.
* * Create w/o dialog
concatenate 'Mensagem Support Desk' sy-datum sy-uzeit into title
separated by '/'.
swc_set_element container 'DOCUMENTTITLE' title.
swc_set_element container 'DOCUMENTNAME' 'Support Desk'.
* swc_set_element container 'DOCUMENTTYPE' 'INT'.
* swc_set_element container 'DOCUMENTTYPE' 'SCR'.
swc_set_element container 'DOCUMENTTYPE' 'OTF'.
swc_set_element container 'NO_DIALOG' 'X'.
else.
* * Create with dialog
swc_set_element container 'NO_DIALOG' ' '.
endif.
swc_call_method message 'Create' container.
perform error_handling(rssobcitest11).
* Create attachment (RAW document from internal table)
SWC_CLEAR_CONTAINER CONTAINER.
*att_bor_obj-objtype = 'MESSAGE'.
*swc_set_element container 'ATTACHMENT' pdf.
*swc_set_element container 'ATTACHMENT' otf.
swc_set_element container 'ATTACHMENT' context.
swc_set_element container 'ATTACHMENTTITLE' 'Anexo'.
swc_set_element container 'AttachmentType' 'OTF'.
*swc_set_element container 'DocumentSize' 0.
swc_set_element container 'DocumentSize' file_size.
*swc_set_table container 'DocumentContent' itab.
SWC_CALL_METHOD MESSAGE 'Attach' CONTAINER.
PERFORM ERROR_HANDLING(RSSOBCITEST11).
*SWC_CLEAR_CONTAINER CONTAINER.
*SWC_SET_ELEMENT CONTAINER 'EditorSettings' 'D'.
*SWC_SET_ELEMENT CONTAINER 'STARTING_AT_X' '5'.
*SWC_SET_ELEMENT CONTAINER 'STARTING_AT_Y' '5'.
*SWC_SET_ELEMENT CONTAINER 'EnableApplObjAttachments' 'X'.
*SWC_CALL_METHOD MESSAGE 'EditRecipientList' CONTAINER.
*PERFORM ERROR_HANDLING(RSSOBCITEST11).
* Einen Empfänger (interner Benutzer) automatisch hinzufügen
* Recipient-Objekt anlegen
swc_clear_container container.
swc_create_object recipient 'Recipient' space.
swc_set_element container 'AddressString' sy-uname.
swc_set_element container 'TypeId' 'B'.
swc_call_method recipient 'CreateAddress' container.
perform error_handling(rssobcitest11).
* Kopie des Recipient-Objekts anfügen
swc_clear_container container.
swc_set_element container 'NewRecipient' recipient.
swc_call_method message 'AddCopyOfRecipient' container.
perform error_handling(rssobcitest11).
* Outbox-Flag setzen
swc_clear_container container.
swc_set_element container 'OutboxFlag' 'X'.
swc_call_method message 'SetOutboxFlag' container.
perform error_handling(rssobcitest11).
* Empfängerliste editieren
swc_clear_container container.
swc_call_method message 'EditRecipientList' container.
perform error_handling(rssobcitest11).
swc_get_table container 'RecipientsInfo' object_list.
if sy-subrc = 8.
* Kopiertes Message-Objekt versenden
swc_clear_container container.
swc_call_method message 'Submit' container.
perform error_handling(rssobcitest11).
swc_get_table container 'RecipientsInfo' object_list.
endif.
swc_get_element container 'SentToAll' sent_to_all.
* Kopiertes Message-Objekt sichern
swc_clear_container container.
swc_call_method message 'Save' container.
perform error_handling(rssobcitest11).
* Protokollausgabe:
* Key des Message-Objekts ermitteln
*SWC_GET_OBJECT_KEY MESSAGE OBJKEY.
*WRITE: / 'Key des Messageobjekts', OBJKEY.
* Protokollausgabe:
perform write_recipient_info(rssobcitest11) tables object_list
using sent_to_all.
* Freigeben der Referenzen
* MESSAGE-Objekt
swc_free_object message.
* RECIPIENT-Objekt
swc_free_object recipient.
commit work.
ENDFUNCTION. -
How to publish Smart form of PDF in r/3 through WD
Hi,
We have a PDF smart form in the r/3.we want to call the PDF from WD View without using PDF interactive form.
Could any one give me soln for this??
ThanksHi ,
Insert IFrame UI Element and bind the Resource property to the value attribute PdfUrl of type String .
Define a Output parameter of type Binary in RFC .
Insert the following code to dispaly the smart form.
byte[] pdfContent = wdContext.currentOutput<node>().get<Binary>();
IWDCachedWebResource pdfResource = WDWebResource.getWebResource(pdfContent,WDWebResourceType.PDF);
try
wdContext.currentContextElement().setPdfUrl(pdfResource.getURL());
catch(Exception e)
wdComponentAPI.getMessageManager().reportException(e.getMessage(),true);
Regards,
Sunitha Hari -
Smart Form as PDF within iframe
Hi all,
the problem i'm facing today is that i can't display a SMART FORM as a PDF in an <iframe> Tag.
If i call a simple PDF (which is stored on my PC as a local file) everything works fine and the PDF is
shown within the iframe Tag.
<html>
<head>
</head>
<body>
Test<p>
<iframe src="C:Test.pdf" width="90%" height="400" name="test"></iframe>
</body>
</html>
If i try to do the same with my test BSP the PDF is not shown within iframe Tag. Instead the iframe Tag
stays empty and the PDF is called directly by the Adobe Reader and not by my Browser (IE7).
<html>
<head>
</head>
<body>
Test<p>
<iframe src="https://vsapex2ci.daksap.de:44320/sap/bc/bsp/sap/zpdf_test/test.htm"
width="90%" height="400" name="test"></iframe>
</body>
</html>
On my test.htm only OnInitialization is implemented. Here's the Code:
DATA: lv_pdf TYPE xstring,
ls_output_data TYPE ssfcrescl,
ls_ctrl_param TYPE ssfctrlop,
lv_fm_name TYPE rs38l_fnam,
lt_lines TYPE TABLE OF tline,
lv_pdf_len TYPE i.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZTESTPDF'
IMPORTING
fm_name = lv_fm_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
ls_ctrl_param-no_dialog = 'X'.
ls_ctrl_param-getotf = 'X'.
CALL FUNCTION lv_fm_name
EXPORTING
CONTROL_PARAMETERS = ls_ctrl_param
USER_SETTINGS = space
IMPORTING
JOB_OUTPUT_INFO = ls_output_data
* Conversion of output format OTF into PDF format
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
IMPORTING
bin_filesize = lv_pdf_len
bin_file = lv_pdf
TABLES
otf = ls_output_data-otfdata
lines = lt_lines.
response->set_header_field( name = 'content-type'
value = 'application/pdf' ).
response->set_header_field( name = 'cache-control'
value = 'max-age=0' ).
response->set_header_field( name = 'content-disposition'
value = 'attachment; filename=test.pdf' ).
lv_pdf_len = XSTRLEN( lv_pdf ).
response->set_data( data = lv_pdf
length = lv_pdf_len ).
navigation->response_complete( ).
How can i display my generated PDF (SMART FORM) within an iframe Tag?
Regards
Mark-Andréhere is the code
data: cached_response type ref to if_http_response.
create object cached_response type cl_http_response exporting add_c_msg = 1.
cached_response->set_data( file_content ).
cached_response->set_header_field( name = if_http_header_fields=>content_type
value = file_mime_type ).
cached_response->set_status( code = 200 reason = 'OK' ).
cached_response->server_cache_expire_rel( expires_rel = 180 ).
call function 'GUID_CREATE'
importing
ev_guid_32 = guid.
concatenate runtime->application_url '/' guid into display_url.
cl_http_server=>server_cache_upload( url = display_url
response = cached_response ).
return.
now in the layout use display_url as the src for iframe
Raja -
Smart form out put into PDF ????
How to download into PDF file after the execute Smart form out put ????
hi,
pls try this code.
*& Report : ZPDF_FORMAT
*& Description : Conversion of Purchase Order into PDF format
*& used in the workflow (Do Not Change or Delete).
REPORT zpdf .
*& Tables used
TABLES: nast, tsp01, t024, spop, lfa1, tnapr.
*& Data declaration
DATA: spoolno LIKE tsp01-rqident.
DATA: rcode LIKE sy-subrc.
*data: doc_auth like zoutput-ztag.
DATA: cancel.
DATA: pdf LIKE tline OCCURS 0 WITH HEADER LINE.
DATA: numbytes TYPE i,
pdfspoolid LIKE tsp01-rqident,
jobname LIKE tbtcjob-jobname,
jobcount LIKE tbtcjob-jobcount,
is_otf.
DATA: client LIKE tst01-dclient,
name LIKE tst01-dname,
objtype LIKE rststype-type,
type LIKE rststype-type.
DATA: dir_loc(3).
DATA: t_docno LIKE vbak-vbeln..
DATA: spoolreq1 LIKE tsp01sys.
DATA: spoolreq LIKE rsporq OCCURS 0 WITH HEADER LINE.
DATA: t_frgke LIKE ekko-frgke.
DATA: okcode(10),
flag,
t_ekgrp LIKE ekko-ekgrp,
t_lifnr LIKE ekko-lifnr,
s_mail.
Data Declartion for mailing system - Start.
DATA: objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE.
DATA: objhead LIKE solisti1 OCCURS 0 WITH HEADER LINE.
DATA: objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE.
DATA: objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE.
DATA: reclist1 LIKE somlreci1 OCCURS 500 WITH HEADER LINE.
DATA: reclist LIKE somlreci1 OCCURS 500 WITH HEADER LINE.
DATA: itab LIKE somlreci1 OCCURS 50 WITH HEADER LINE."RKU 220802
DATA: doc_chng LIKE sodocchgi1.
DATA: BEGIN OF bdcdata OCCURS 0.
INCLUDE STRUCTURE bdcdata.
DATA: END OF bdcdata.
DATA: tab_lines LIKE sy-tabix.
DATA: verkf LIKE ekko-verkf.
DATA: bemail(250), vemail(250).
Data acceptance
SELECTION-SCREEN BEGIN OF BLOCK blk0_input WITH FRAME .
PARAMETERS: docno LIKE ekko-ebeln OBLIGATORY LOWER CASE.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN END OF BLOCK blk0_input.
Initialisation
*initialization.
Screen Parameters Validation
*at selection-screen.
AT SELECTION-SCREEN.
SELECT SINGLE frgke INTO t_frgke FROM ekko
WHERE ebeln = docno
AND frgke = 'R'.
IF sy-subrc <> 0.
MESSAGE 'DOCUMENT NOT RELEASED' TYPE 'E'.
ENDIF.
Execution Part
START-OF-SELECTION.
For PO related operation
Dislay Buyer Group, Name and Email id
SELECT SINGLE
ekgrp
lifnr
verkf
INTO (t_ekgrp, t_lifnr, verkf)
FROM ekko
WHERE ekko~mandt = sy-mandt
AND ebeln = docno.
IF sy-subrc = 0.
SELECT SINGLE * FROM lfa1
WHERE lfa1~mandt = sy-mandt
AND lifnr = t_lifnr.
ENDIF.
Get message status from NAST or assign msg status NAST stru
Pass the message status and get spool data
PERFORM check_output_create_spool.
IF rcode NE 0.
IF rcode = 9.
message s185 with text-e04.
ELSE.
message s185 with text-e01.
ENDIF.
EXIT.
ENDIF.
find the spool
PERFORM find_spool_request_id.
IF sy-subrc <> 0.
message s185 with text-003.
EXIT.
ENDIF.
READ TABLE spoolreq
WITH KEY rq0name = nast-dsnam
rq1name = 'LP01'
rqclient = '800'
rq2name = sy-uname
rqowner = sy-uname.
IF sy-subrc <> 0.
CASE sy-subrc.
WHEN 1.
message s185 with text-e03.
WHEN OTHERS.
message s185 with text-e02.
ENDCASE.
EXIT.
ENDIF.
spoolno = spoolreq-rqident.
Convert SPOOL job to PDF
PERFORM convert_spool_to_pdf.
Send through mail
PERFORM assign_data_4_mail.
PERFORM send_mail_with_attachment.
Delete created spool request
spoolreq1-rqident = spoolno.
PERFORM delete_spool_job.
*& Form check_output_create_spool
text
--> p1 text
<-- p2 text
FORM check_output_create_spool.
SELECT SINGLE * FROM nast WHERE objky = docno
AND kappl = 'EF'
AND kschl = 'NEU'
AND aktiv = space
AND nacha = '1'.
IF sy-subrc EQ 0.
COUNT = COUNT + 1.
PERFORM mssage_status_field_value.
nast-vsztp = '4'.
PERFORM einzelnachricht_dialog(rsnast00) USING rcode.
ELSE.
CLEAR nast-uhrvr.
CLEAR nast-cmfpnr.
CLEAR nast-datvr.
PERFORM mssage_status_field_value.
nast-vsztp = '4'.
PERFORM einzelnachricht_dialog(rsnast00) USING rcode.
else.
rcode = 9.
ENDIF.
ENDFORM. " check_output_create_spool
*& Form mssage_status_field_value
text
--> p1 text
<-- p2 text
FORM mssage_status_field_value .
nast-mandt = '800'.
nast-kappl = 'EF'.
nast-kschl = 'NEU'.
nast-objky = docno.
nast-ldest = 'LP01'.
nast-anzal = 1.
nast-dimme = 'X'.
nast-delet = 'X'.
nast-nacha = '1'.
nast-vsztp = '2'.
nast-spras = 'E'.
nast-vstat = '0'.
nast-manue = 'X'.
nast-erdat = sy-datum.
nast-eruhr = sy-uzeit.
nast-usnam = sy-uname.
nast-tdreceiver = sy-uname.
concatenate sy-uzeit+2(4) 'PDF' into nast-dsnam.
ENDFORM. " mssage_status_field_value
*& Form find_spool_request_id
text
--> p1 text
<-- p2 text
FORM find_spool_request_id.
CALL FUNCTION 'RSPO_FIND_SPOOL_REQUESTS'
EXPORTING
allclients = '800'
authority = ' '
datatype = '*'
has_output_requests = '*'
rq0name = nast-dsnam "'*'
rq1name = '*'
rq2name = '*'
rqdest = 'LP01'
rqident = 0
rqowner = sy-uname
TABLES
spoolrequests = spoolreq
EXCEPTIONS
no_permission = 1
OTHERS = 2.
ENDFORM. " find_spool_request_id
*& Form convert_spool_to_pdf
text
--> p1 text
<-- p2 text
FORM convert_spool_to_pdf.
SELECT SINGLE * FROM tsp01 WHERE rqident = spoolno.
IF sy-subrc <> 0.
WRITE: / 'Spool order does not exist'
COLOR COL_NEGATIVE.
EXIT.
ENDIF.
client = tsp01-rqclient.
name = tsp01-rqo1name.
CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
EXPORTING
authority = 'SP01'
client = client
name = name
part = 1
IMPORTING
type = type
objtype = objtype
EXCEPTIONS
fb_error = 1
fb_rsts_other = 2
no_object = 3
no_permission = 4.
IF objtype(3) = 'OTF'.
is_otf = 'X'.
ELSE.
is_otf = space.
ENDIF.
IF is_otf = 'X'.
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = spoolno
no_dialog = ' '
IMPORTING
pdf_bytecount = numbytes
pdf_spoolid = pdfspoolid
btc_jobname = jobname
btc_jobcount = jobcount
TABLES
pdf = pdf
EXCEPTIONS
err_no_otf_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_dstdevice = 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.
if sy-subrc <> 0.
case sy-subrc.
when 1.
write: / text-001 color col_positive.
when 2.
write: / text-002 color col_negative.
exit.
when 3.
write: / text-003 color col_negative.
exit.
when 4.
write: / text-004 color col_negative.
exit.
when others.
write: / text-005 color col_negative.
exit.
endcase.
endif.
ELSE.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = spoolno
no_dialog = ' '
DST_DEVICE =
PDF_DESTINATION =
IMPORTING
pdf_bytecount = numbytes
pdf_spoolid = pdfspoolid
LIST_PAGECOUNT =
btc_jobname = jobname
btc_jobcount = jobcount
TABLES
pdf = pdf
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.
case sy-subrc.
when 0.
*write: / 'Funktion CONVERT_ABAPSPOOLJOB_2_PDF erfolgreich
*(successful)'.
color col_positive.
when 1.
write: / text-001 color col_positive.
when 2.
write: / text-002 color col_negative.
exit.
when 3.
write: / text-003 color col_negative.
exit.
when 4.
write: / text-004 color col_negative.
exit.
when others.
write: / text-005 color col_negative.
exit.
endcase.
ENDIF.
ENDFORM. " convert_spool_to_pdf
*& Form delete_spool_job
text
--> p1 text
<-- p2 text
FORM delete_spool_job .
CALL FUNCTION 'RSPO_IDELETE_SPOOLREQ'
EXPORTING
spoolreq = spoolreq1
IMPORTING
RC =
STATUS =
EXCEPTIONS
error = 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.
ENDFORM. " delete_spool_job
*& Form ASSIGN_DATA_4_MAIL
text
--> p1 text
<-- p2 text
FORM assign_data_4_mail .
Text content of the mail
move 'Purchase order: ' to objtxt.
append objtxt.
move verkf to objtxt.
append objtxt.
move lfa1-name1 to objtxt.
append objtxt.
concatenate lfa1-ort01 lfa1-pstlz
into objtxt separated by space.
append objtxt.
clear: objtxt.
append objtxt.
append objtxt.
CLEAR objtxt.
CONCATENATE 'Purchase Order - ' docno
' has been released.'
INTO objtxt SEPARATED BY space.
APPEND objtxt.
clear: objtxt.
append objtxt.
append objtxt.
MOVE ' ' TO objtxt.
APPEND objtxt.
clear: objtxt.
append objtxt.
append objtxt.
concatenate 'Note:- This is an automatic mail sender.'
' Please do not reply to this mail ID.'
into objtxt.
append objtxt.
concatenate
' Any query, please send the mail to the respective buyer'''
's mail id.' into objtxt.
append objtxt.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = docno
IMPORTING
output = docno.
TLINE format will be coverted as 255 char foramt
CALL FUNCTION 'QCE1_CONVERT'
TABLES
t_source_tab = pdf
t_target_tab = objbin
EXCEPTIONS
convert_not_possible = 1
OTHERS = 2.
DESCRIBE TABLE objtxt LINES tab_lines.
creation of the entry for the compressed document
CLEAR objpack.
objpack-transf_bin = ''.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'RAW'.
objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
APPEND objpack.
creation of the entry for the Attachemnt
DESCRIBE TABLE objbin LINES tab_lines.
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 1.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'PDF'.
CONCATENATE docno '.PDF' INTO objpack-obj_name.
objpack-obj_descr = objpack-obj_name.
objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).
APPEND objpack.
For Object Header
CONCATENATE docno '.PDF' INTO objhead.
APPEND objhead.
doc_chng-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).
CONCATENATE 'Purchase Order - ' docno ' has been released'
INTO doc_chng-obj_descr.
doc_chng-obj_prio = 1.
recipient Details
CLEAR reclist1.
CLEAR reclist.
REFRESH reclist1.
REFRESH reclist.
SELECT SINGLE * FROM t024
WHERE t024~mandt = sy-mandt
AND ekgrp = t_ekgrp.
reclist1-receiver = t024-smtp_addr.
reclist1-rec_type = 'U'.
reclist1-com_type = 'INT'.
reclist1-receiver = '[email protected]'.
modify table reclist transporting rec_type receiver COM_TYPE .
where rec_type is initial.
APPEND reclist1 TO reclist.
ENDFORM. " ASSIGN_DATA_4_MAIL
*& Form send_mail_with_attachment
text
--> p1 text
<-- p2 text
FORM send_mail_with_attachment.
sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = doc_chng
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
receivers = reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
OTHERS = 99.
CASE sy-subrc.
WHEN 0.
PERFORM flush_mail.
message 'Mail sent successfully' type 'I'.
when 1.
message 'No authorization for sending to the specified number'
*type 'E'.
when 2.
message 'Document could not be sent to any recipient' type 'E'.
when 4.
message 'No send authorization' type 'E'.
when others.
message 'Error occurred while sending' type 'E'.
ENDCASE.
ENDFORM. " send_mail_with_attachment
Start new screen *
FORM bdc_dynpro USING program dynpro.
CLEAR bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
APPEND bdcdata.
ENDFORM. "bdc_dynpro
Insert field *
FORM bdc_field USING fnam fval.
CLEAR bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
APPEND bdcdata.
ENDFORM. "bdc_field
*& Form AUTOMATE
text
--> p1 text
<-- p2 text
FORM flush_mail .
PERFORM bdc_dynpro USING 'SAPMSSY0' '0120'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=PDIA'.
PERFORM bdc_dynpro USING 'SAPLSPO4' '0300'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=FURT'.
PERFORM bdc_field USING 'BDC_CURSOR'
'SVALD-VALUE(01)'.
PERFORM bdc_field USING 'SVALD-VALUE(01)'
'int'.
PERFORM bdc_dynpro USING 'SAPMSSY0' '0120'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BACK'.
PERFORM bdc_dynpro USING 'SAPMSSY0' '0120'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BACK'.
CALL TRANSACTION 'SCOT' USING bdcdata
MODE 'N'
UPDATE 'S'.
ENDFORM. " AUTOMATE
regards,
Latheesh -
To convert Smart Form output to PDF format and send it via email.
Hi Friends,
Could any one please tell me, how to convert the Smart Forms output to PDF format and send it via email to customer. If any one have the code, kindly mail me to [email protected]
Thanks & Regards,
JohnRefer the links -
how to convert smartform into pdf and send through mail
Smartform as PDF attachment to a mail.
smartform pdf and mail
smartform to pdf to mail
Regrads,
Amit
Reward all helpful replies. -
Error in opening the PDF file created from the smart form output.
Hi All,
i have a simple smart form which takes 3 values like customer no, name and no of times customer called and gives an out like
Customer 0001000000 with name Ravi called 5 times today.
I have to send this output to mail as an attachment.
for this i am coding as below.
******Call the SSF Function module
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = Form name
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
fm_name = lv_fmname
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3
lv_partner_number = '0001000000'.
lv_name_org1 = 'Ravi'.
lv_z_no_calls_day = '5'.
lw_ctrlop-getotf = 'X'.
lw_ctrlop-no_dialog = 'X'.
lw_compop-tdnoprev = 'X'.
lw_compop-tddest = 'LP01'.
*******Call the Form Function module and get the OTF of form output
CALL FUNCTION lv_fmname
EXPORTING
name_org1 = lv_name_org1
partner_number = lv_partner_number
z_no_calls_day = lv_z_no_calls_day
control_parameters = lw_ctrlop
output_options = lw_compop
user_settings = ' '
IMPORTING
job_output_info = w_return
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
i_otf] = w_return-otfdata[.
*********Now here if i look in to the OTF data i got in debug it has the data i aniticipated along with some other data.
the output is in the format
TDPRINTCOM(2) TDPRINTPAR(70)
ST XXXX.. customer 0001000000 with
name.....
i have my data in the above format spread in three lines of the output otf table where XXXX... is some number.
***********To convert to PDF Format
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = lv_len_in
BIN_FILE =
TABLES
otf = i_otf
lines = i_tline
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
err_bad_otf = 4
OTHERS = 5
*********For testing purpose i created a file on the desktop with the the data in i_tline. it created PDF file but when i tried to open it it's giving an error.
i_objtxt = 'test with pdf-Attachment!'.
APPEND i_objtxt.
DESCRIBE TABLE i_objtxt LINES v_lines_txt.
READ TABLE i_objtxt INDEX v_lines_txt.
wa_doc_chng-obj_name = 'Smart Form'.
wa_doc_chng-obj_descr = 'Frequent Caller Alert_Day'.
wa_doc_chng-doc_size = ( v_lines_txt - 1 ) * 255 + STRLEN( i_objtxt ).
*********Creating the Entry for the document
CLEAR i_objpack-transf_bin.
i_objpack-head_start = 1.
i_objpack-head_num = 0.
i_objpack-body_start = 1.
i_objpack-body_num = v_lines_txt.
i_objpack-doc_type = 'RAW'.
APPEND i_objpack.
i_objbin] = i_tline[.
DESCRIBE TABLE i_objbin LINES v_lines_bin.
READ TABLE i_objbin INDEX v_lines_bin.
i_objhead = 'Frequentcaller list_Day.pdf'.
APPEND i_objhead.
************Creating the entry for the attachment.
CLEAR : i_objpack.
i_objpack-transf_bin = 'X'.
i_objpack-head_start = 1.
i_objpack-head_num = 1.
i_objpack-body_start = 1.
i_objpack-body_num = v_lines_bin.
i_objpack-doc_type = 'PDF'.
i_objpack-obj_name = 'ATTACHMENT'.
i_objpack-obj_descr = 'FCA'.
i_objpack-doc_size = v_lines_bin * 255 .
APPEND i_objpack.
CLEAR i_reclist.
i_reclist-receiver = 'mail id'.
i_reclist-rec_type = 'U'.
APPEND i_reclist.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = wa_doc_chng
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = i_objpack
object_header = i_objhead
contents_bin = i_objbin
contents_txt = i_objtxt
receivers = i_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
OTHERS = 99.
This is all i am doing.
It is sending a mail with the attachment but we are not able to open the attachment. it's giving an error like file is damaged and couldn't be repaired.
I serched in the forum but i couldn't get the answer.
I suspect there is a problem in getting the OTF data..
Please help me in resolving this issue....
Thanks in advance.
RKCheck the sample , and see where you made the mistake.
REPORT ZPDF_MAIl.
DATA:
w_fm_name TYPE rs38l_fnam,
w_bin_filesize TYPE i,
w_filesize TYPE i,
w_lines_txt TYPE i,
w_lines_bin TYPE i.
DATA:
wa_ctrlop TYPE ssfctrlop,
wa_outopt TYPE ssfcompop,
wa_objhead TYPE soli_tab,
wa_buffer TYPE string,
wa_doc_chng TYPE sodocchgi1.
DATA:
BEGIN OF t_mail_ids OCCURS 0,
mailid TYPE ad_smtpadr,
END OF t_mail_ids,
t_otfdata TYPE ssfcrescl,
t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
t_pdf_tab TYPE tline OCCURS 0 WITH HEADER LINE,
t_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
t_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'Z195_TEST'
IMPORTING
fm_name = w_fm_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
IF sy-subrc EQ 0.
ENDIF. " IF sy-subrc EQ 0.
wa_ctrlop-getotf = 'X'.
wa_ctrlop-no_dialog = 'X'.
wa_outopt-tdnoprev = 'X'.
CALL FUNCTION w_fm_name
EXPORTING
control_parameters = wa_ctrlop
output_options = wa_outopt
user_settings = 'X'
IMPORTING
job_output_info = t_otfdata
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc EQ 0.
ENDIF. " IF sy-subrc EQ 0.
t_otf[] = t_otfdata-otfdata[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = w_bin_filesize
TABLES
otf = t_otf
lines = t_pdf_tab
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
err_bad_otf = 4
OTHERS = 5.
IF sy-subrc EQ 0.
ENDIF. " IF sy-subrc EQ 0.
LOOP AT t_pdf_tab.
TRANSLATE t_pdf_tab USING '~'.
CONCATENATE wa_buffer t_pdf_tab INTO wa_buffer.
ENDLOOP.
TRANSLATE wa_buffer USING '~'.
DO.
t_record = wa_buffer.
APPEND t_record.
SHIFT wa_buffer LEFT BY 255 PLACES.
IF wa_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
t_objtxt = ' To Change the COR, Use the Transaction ZCOR_CHANGE'.
APPEND t_objtxt.
t_objtxt = ' Check the Attached PDF file for COR'.
APPEND t_objtxt.
DESCRIBE TABLE t_objtxt LINES w_lines_txt.
READ TABLE t_objtxt INDEX w_lines_txt.
READ TABLE t_objtxt INDEX w_lines_txt.
wa_doc_chng-obj_name = 'COR Display'.
wa_doc_chng-expiry_dat = sy-datum + 10.
CONCATENATE 'COR' "w_cornr
'-' "w_stat_descr w_action_desc
INTO wa_doc_chng-obj_descr SEPARATED BY space.
wa_doc_chng-sensitivty = 'F'.
wa_doc_chng-doc_size = w_lines_txt * 255.
CLEAR t_objpack-transf_bin.
t_objpack-head_start = 1.
t_objpack-head_num = 0.
t_objpack-body_start = 1.
t_objpack-body_num = w_lines_txt.
t_objpack-doc_type = 'RAW'.
APPEND t_objpack.
t_objpack-transf_bin = 'X'.
t_objpack-head_start = 1.
t_objpack-head_start = 1.
t_objpack-head_num = 0.
t_objpack-body_start = 1.
DESCRIBE TABLE t_objbin LINES w_lines_bin.
READ TABLE t_objbin INDEX w_lines_bin.
t_objpack-doc_size = w_lines_bin * 255 .
t_objpack-body_num = w_lines_bin.
t_objpack-doc_type = 'PDF'.
t_objpack-obj_name = 'COR'.
t_objpack-obj_descr = 'COR Test'.
* concatenate 'COR' w_cornr into t_objpack-obj_descr
* separated by space.
APPEND t_objpack.
*LOOP AT t_mail_ids.
CLEAR t_reclist.
t_reclist-receiver = 'INTENATEMAIL'.
t_reclist-rec_type = 'U'.
APPEND t_reclist.
*ENDLOOP.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = wa_doc_chng
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = t_objpack
object_header = wa_objhead
contents_bin = t_objbin
contents_txt = t_objtxt
receivers = t_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.
IF sy-subrc EQ 0.
ENDIF. -
Hello All ,
I have created one smart form and provided option to download the same in PDF. My Problem is that is downloaded in PDF but at the same time my end user want to see the print preview and take the print from there itself also.
I am using the following code can some one suggest me the what need to do the change after both option will work at the same time.
Please Note I have also made the use of property
SSFCOMPOP-TDNOPREV
But after this also issue not resolve. Some one Please suggest me the how to resolve the issue.
DATA :
WA_FMNM TYPE TDSFNAME, " Smart Forms: Form Name
WA_CNTL TYPE SSFCTRLOP, " FOR PDF PRINT
WA_POP TYPE SSFCOMPOP, " printer name
T_OTF_FROM_FM TYPE SSFCRESCL,
T_PDF_TAB LIKE TLINE OCCURS 0 WITH HEADER LINE,
T_OTF TYPE SSFCRESCL-OTFDATA,
W_BIN_FILESIZE TYPE I, " BINARY FILE SIZE
W_FILE_NAME TYPE STRING,
WA_FNMD TYPE RS38L_FNAM. " Name of Function Module
DATA:
W_FORM_NAME TYPE TDSFNAME,
W_FMODULE TYPE RS38L_FNAM,
W_CPARAM TYPE SSFCTRLOP,
W_OUTOPTIONS TYPE SSFCOMPOP,
W_FILE_PATH TYPE STRING,
W_FULL_PATH TYPE STRING.
SMART FORM FUNCTION MODULE
WA_FMNM = TEXT-113.
W_FORM_NAME = TEXT-113.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = WA_FMNM
IMPORTING
FM_NAME = WA_FNMD
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.
END FORM
WA_CNTL-GETOTF = 'X'.
WA_CNTL-NO_DIALOG = 'X'.
WA_CNTL-PREVIEW = SPACE .
WA_POP-TDDEST = 'LP01'.
CALL FUNCTION WA_FNMD
EXPORTING
CONTROL_PARAMETERS = WA_CNTL
OUTPUT_OPTIONS = WA_POP
V_APPLN_OB = V_APPLN_OB
V_KUNNR_OB = V_KUNNR_OB
V_EBELN = V_EBELN
V_CAT_NAME = V_CAT_NAME
V_VAR_NAME = V_VAR_NAME
IMPORTING
JOB_OUTPUT_INFO = T_OTF_FROM_FM
TABLES
T_ZCNC18 = T_ZCNC18
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.
T_OTF[] = T_OTF_FROM_FM-OTFDATA[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
MAX_LINEWIDTH = 132
IMPORTING
BIN_FILESIZE = W_BIN_FILESIZE
TABLES
OTF = T_OTF
LINES = T_PDF_TAB
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
ERR_BAD_OTF = 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.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
EXPORTING
PROMPT_ON_OVERWRITE = 'X'
CHANGING
FILENAME = W_FILE_NAME
PATH = W_FILE_PATH
FULLPATH = W_FULL_PATH
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
OTHERS = 4 .
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 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = W_BIN_FILESIZE
FILENAME = W_FULL_PATH
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'
TABLES
DATA_TAB = T_PDF_TAB
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.
Regards
Swati NamdevHi Swati,
Pls refer the below code:
TABLES: ekko.
DATA: int_itab TYPE TABLE OF ekko WITH HEADER LINE.
DATA: wf_name TYPE rs38l_fnam.
DATA: wf_so1.
*For PDf Conversions
DATA: int_tab_otf_data TYPE ssfcrescl,
int_pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE,
int_tab_otf_final TYPE itcoo OCCURS 0 WITH HEADER LINE,
file_size TYPE i,
bin_filesize TYPE i,
file_name TYPE string,
file_path TYPE string,
full_path TYPE string,
cparam TYPE ssfctrlop,
outop TYPE ssfcompop.
**Preview not allowed.
outop-tddest = 'LP01'.
cparam-no_dialog = 'X'.
cparam-preview = ' '.
cparam-getotf = 'X'.
GET PARAMETER ID 'EBLEN' FIELD wf_so1.
SELECT mandt ebeln bukrs bsart ernam ekorg bedat FROM ekko INTO TABLE
int_itab WHERE ebeln = wf_so1.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'Z_SMARTFORM_FINAL2'
IMPORTING
fm_name = wf_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 wf_name
EXPORTING
control_parameters = cparam
output_options = outop
user_settings = space
IMPORTING
job_output_info = int_tab_otf_data
TABLES
int_itab = int_itab.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
int_tab_otf_final[] = int_tab_otf_data-otfdata[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = bin_filesize
TABLES
otf = int_tab_otf_final
lines = int_pdf_tab.
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 METHOD cl_gui_frontend_services=>file_save_dialog
CHANGING
filename = file_name
path = file_path
fullpath = full_path.
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 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = bin_filesize
filename = full_path
filetype = 'BIN'
IMPORTING
filelength = file_size
TABLES
data_tab = int_pdf_tab.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Regards,
Ramneet Ahuja -
Error in calling/converting smart form from ECC to pdf in portal.
Hi,
We have a requirement in our project where we have to show IT form in portal exactly in the way payslip are shown in ESS
Screen, that is in the pdf form in ess portal screen.
For this my HR abap consultant has made one customize smart form which is being called from a RFC FM.
After the FM lf_fm_name gets executed , the OTF data is being captured and then converted in to PDF.
After that the PDF is then converted into XSTRING format which is then supplied to the portal side through export parameter
of the RFC.
Now when we debugged the RFC, the conversion is taking place perfectly fine in to XSTRING.This is wat we assume.
Portal Side: I have used Iframe ui ELEMENT in my webdynpro java and its property source I have binded with a value attribute
of type string and I am executing above customize RFC given to me by my HR abap consultant and after executing that RFC with
userID and payroll year as its import parameter I am taking export parameter of that RFC with name pdf_string of type XSTRING
of that RFC into my webdynpro java value attribute which i binded to source property of Iframe.
Now when we see the output in portal , first of all pdf is not getting generated and its showing the error message:
file does not begin with '%pdf-' and secondly errored Adobe form getting opened outside Iframe window its not coming within
Iframe window like what payslip comes inside Iframe UI element.
I want to know what mistake we are doing in our ABAP coding or portal coding.
Please help.Hi Satyam,
You can use the existing SAP GRT framework for developing the app.
Its easy and provides more features.
See this wiki:
http://wiki.sdn.sap.com/wiki/display/WDJava/HowtodevelopcustomWebDynproESSapplicationsusingGenericReportingTool%28GRT%29
Regards
Yugandhar Reddy -
Creation of Smart Forms for PDF
Hi All,
I am new to SFP. So, please tell me how to create Smart Forms for PDF.
I already have an SAP standard form of Customer Invoice in this format (SFP) and I need to change the layout and add some additional fields in it as well.
Please guide me through the process. Earliest reponse will be highly appreciated.
Regards,
ShabbarHi,
I take that you meant PDF Forms in SAP.
Refer the following help links.
http://help.sap.com/saphelp_nw04s/helpdata/en/dc/f1783fe3263042e10000000a114084/content.htm
This PDF link (Has got many Pdf files)
https://www.sdn.sap.com/irj/sdn/interactiveforms?rid=/webcontent/uuid/d1088b7e-0c01-0010-c78e-984c0537e3ec [original link is broken]
Also check this Tech-ed 06 session at Amsterdam.
http://www.sapteched.com/emea/edu_sessions/session.htm?sid=317
Check this download from SDN.
https://www.sdn.sap.com/irj/sdn/downloaditem?rid=/library/uuid/2dd3dbcd-0401-0010-55b8-b10808ff688e
Is this you are looking for?
Feel free to revert back.
--Ragu -
Display SMART form as PDF in WD ABAP
Hi ,
To display smart form as PDF , I am following the SDN article :
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0de1eb8-0b98-2910-7996-8a3c2fcf6785?quicklink=index&overridelayout=true
In my component , I have created the view VIEW_PDF, for this . I have created Adobe interactive UI element, and bind the property source to the attribute (XSTRING) where I will get PDF (after OTF conversion).
First of all I am using the FM SSF_FUNCTION_MODULE_NAME and usingf the import parameter fm_name .
Then using this FM
CALL FUNCTION lv_fm_name
EXPORTING
OUTPUT_OPTIONS = lwa_output_options
GW_VENREQDAT = lwa_venreqdat
GW_REQHEADER = lwa_venreqhdr
IMPORTING
JOB_OUTPUT_INFO = lv_ssf_output.
from smart form ZVM_SFM_SUMMARY,I want to get the data in OTF format using the importing parameter JOB_OUTPUT_INFO of the above FM.
But I am not able to retrieve the data .Please direct me , where am I missing?
For converting it to PDF , I am using the FM CONVERT_OTF .
regards,
amitYou may continue like this there after...
call function w_fmodule
exporting
control_parameters = w_cparam
output_options = w_outoptions ":lv_output_options
user_settings = ' '
importing
job_output_info = t_otf_from_fm
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.
t_otf[] = t_otf_from_fm-otfdata[].
call function 'SSFCOMP_PDF_PREVIEW'
exporting
i_otf = t_otf
exceptions
convert_otf_to_pdf_error = 1
cntl_error = 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.
data: l_dummy type standard table of tline,
pdf_data type xstring,
pdf_size type i.
clear: pdf_data, pdf_size.
call function 'CONVERT_OTF'
exporting
format = 'PDF'
* max_linewidth = 132
importing
bin_filesize = pdf_size
bin_file = pdf_data
tables
otf = t_otf[]
lines = l_dummy
exceptions
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
err_bad_otf = 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.
data lv_source like ls_pdf-source.
* navigate from <CONTEXT> to <PDF> via lead selection
lo_nd_pdf = wd_context->get_child_node( name = wd_this->wdctx_pdf ).
* get element via lead selection
lo_el_pdf = lo_nd_pdf->get_element( ).
* get single attribute
lo_el_pdf->set_attribute(
exporting
name = `SOURCE`
value = pdf_data ).
Regards
Gopi -
Problem in converting smart form into PDF
HI Experts,
I am using a Function Module CONVERT_OTF for converting smart form into pdf file for send it to with attachment.
But i got a error when i am using that FM.
Runtime Errors CONVT_NO_NUMBER
unable to interpret *292 as a no.
Is that because my file size too large about 13 pages of PDF?
and when i run it for other smart forms which have 2 or 3 pages of PDF, its working perfectly.
can anyone tell what is problem with that FM?
Thanks
ShakunHi,
I had the similar issue and after analysis I have that this is the issue by not passing the IMPORTING parameter of the Function Module "BIN_FILESIZE". Please try to pass some variable to this paramter and then this will be completely rectified.
DATA ; v_filesize TYPE i.
*--Convert OTF data to PDF data
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = v_filesize
TABLES
otf = it_otfdata
lines = it_pdfdata
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
err_bad_otf = 4
OTHERS = 5.
Please verify whether this reolves the problem for you.
Regards,
SRinivas -
Convertion of Smart form to pdf and sending mail to vendor for PO
Hello all,
I have modified a standard PO Smartform and running it through ME23N.
In this i have to convert it to a pdf file and then send it through mail to the vendor.
I have found out FMs'CONVERT_OTF'and
'SO_NEW_DOCUMENT_ATT_SEND_API1'
to convert it and send mail. But can u tell me how to go about using it.
As i am using a standard program do i have to copy this prog to zprog and then call the fm out there. I am not sure.
Thanks
SalilHi,
Here is the sample code.If you find this as useful,kindly reward points by clicking the star on the left of reply.
Internal Table declarations
DATA: i_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
i_tline TYPE TABLE OF tline WITH HEADER LINE,
i_receivers TYPE TABLE OF somlreci1 WITH HEADER LINE,
i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,
Objects to send mail.
i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
i_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
Work Area declarations
w_objhead TYPE soli_tab,
w_ctrlop TYPE ssfctrlop,
w_compop TYPE ssfcompop,
w_return TYPE ssfcrescl,
w_doc_chng typE sodocchgi1,
w_data TYPE sodocchgi1,
w_buffer TYPE string,"To convert from 132 to 255
Variables declarations
v_form_name TYPE rs38l_fnam,
v_len_in LIKE sood-objlen,
v_len_out LIKE sood-objlen,
v_len_outn TYPE i,
v_lines_txt TYPE i,
v_lines_bin TYPE i.
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = 'ZZZ_TEST2'
importing
fm_name = v_form_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.
w_ctrlop-getotf = 'X'.
w_ctrlop-no_dialog = 'X'.
w_compop-tdnoprev = 'X'.
CALL FUNCTION v_form_name
EXPORTING
control_parameters = w_ctrlop
output_options = w_compop
user_settings = 'X'
IMPORTING
job_output_info = w_return
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.
i_otf[] = w_return-otfdata[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = v_len_in
TABLES
otf = i_otf
lines = i_tline
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Convert PDF from 132 to 255.
LOOP AT i_tline.
Replacing space by ~
TRANSLATE i_tline USING ' ~'.
CONCATENATE w_buffer i_tline INTO w_buffer.
ENDLOOP.
Replacing ~ by space
TRANSLATE w_buffer USING '~ '.
DO.
i_record = w_buffer.
Appending 255 characters as a record
APPEND i_record.
SHIFT w_buffer LEFT BY 255 PLACES.
IF w_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
Refresh: i_reclist,
i_objtxt,
i_objbin,
i_objpack.
clear w_objhead.
Object with PDF.
i_objbin[] = i_record[].
DESCRIBE TABLE i_objbin LINES v_lines_bin.
Object with main text of the mail.
i_objtxt = 'Find attached the output of the smart form.'.
APPEND i_objtxt.
i_objtxt = 'Regards,'.
APPEND i_objtxt.
i_objtxt = 'J.Jayanthi'.
APPEND i_objtxt.
DESCRIBE TABLE i_objtxt LINES v_lines_txt.
Document information.
w_doc_chng-obj_name = 'Smartform'.
w_doc_chng-expiry_dat = sy-datum + 10.
w_doc_chng-obj_descr = 'Smart form output'.
w_doc_chng-sensitivty = 'F'. "Functional object
w_doc_chng-doc_size = v_lines_txt * 255.
Pack to main body as RAW.
Obj. to be transported not in binary form
CLEAR i_objpack-transf_bin.
Start line of object header in transport packet
i_objpack-head_start = 1.
Number of lines of an object header in object packet
i_objpack-head_num = 0.
Start line of object contents in an object packet
i_objpack-body_start = 1.
Number of lines of the object contents in an object packet
i_objpack-body_num = v_lines_txt.
Code for document class
i_objpack-doc_type = 'RAW'.
APPEND i_objpack.
Packing as PDF.
i_objpack-transf_bin = 'X'.
i_objpack-head_start = 1.
i_objpack-head_num = 1.
i_objpack-body_start = 1.
i_objpack-body_num = v_lines_bin.
i_objpack-doc_type = 'PDF'.
i_objpack-obj_name = 'Smartform'.
CONCATENATE 'Smartform_output' '.pdf'
INTO i_objpack-obj_descr.
i_objpack-doc_size = v_lines_bin * 255.
APPEND i_objpack.
Document information.
CLEAR i_reclist.
e-mail receivers.
i_reclist-receiver = '[email protected]'.
i_reclist-express = 'X'.
i_reclist-rec_type = 'U'. "Internet address
APPEND i_reclist.
Sending mail.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = w_doc_chng
put_in_outbox = 'X'
TABLES
packing_list = i_objpack
object_header = w_objhead
contents_hex = i_objbin
contents_txt = i_objtxt
receivers = i_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.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
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 -
How to print form into pdf format using smart forms in abap
please let me know how to print form into pdf format using smart forms in abap.
Moderator message: please search for available information/documentation.
Edited by: Thomas Zloch on Mar 25, 2011 2:04 PMHi ,
refer this link
<removed by moderator>
Regards,
Dhina..
Moderator message: please do not reply to questions that violate forum rules.
Edited by: Thomas Zloch on Mar 25, 2011 2:04 PM
Maybe you are looking for
-
My Verizon Frustration (to put it mildly). Read if you live in AK
Began when I ordered an iPhone 4 on August 13. I needed to upgrade because I had an old phone and moved to Alaska, where Verizon was not established (I was on roaming). Thought Verizon was a good enough company to stick with. Two and half years lat
-
Nokia software updater compatible with Vista
I have Vista, the software updater is not compatible with Vista. What can I do?
-
Teststand Vs Labview in using SQL
hi, I am new to using database in Labview. What I want to do is : Access the SQL database and get the data, send it to teststand, and send the result obtained from the teststand back to database. I want to know which one to use labview or teststand t
-
Sybase ODBC driver - numeric or decimal datatype problem
Hello! I have Sybase Adaptive Server Enterprise 15.0.2 and Oracle 10.2.0 ("show release" in SQL*plus prints 1002000100) on the same machine (OS = Windows XP, name = Workstation). I wanna load correct information from the table in Sybase via Oracle da
-
For no apparent reason, slideshows in iPhoto cannot be played.