Converting Smartforms output content into HTML File
Hi,
I have a requirement, Smartforms output contents needs be converted as HTML File and it should be sent as email.
I am able to get the Smartforms output in html format but the output is shown as binary format.
After the fm call the job_output_info parameter is holding the smartforms output content in
job_output_info-XMLOUTPUT[] (xsf content)
job_output_info-XMLOUTPUT-STSHEET[] (css content)
job_output_info-XMLOUTPUT-TRFRESULT[] (html content)
Help me out how to handle the job_output_info details to html format.
Code
DATA v_fm_name TYPE rs38l_fnam.
DATA v_tdsfname TYPE tdsfname VALUE 'ZVR39_SF'.
DATA output_options TYPE ssfcompop.
DATA job_output_info TYPE ssfcrescl.
DATA document_output_info TYPE ssfcrespd.
DATA job_output_options TYPE ssfcresop.
DATA w_control TYPE ssfctrlop.
*-Finding the Smartform Layout Name
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = v_tdsfname
IMPORTING
fm_name = v_fm_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
*-Defining the output to HTML Format
*-Activating XSF Output
output_options-xdfcmode = 'X'.
output_options-xdf = space.
output_options-xsfcmode = 'X'.
output_options-xsf = 'X'.
output_options-xsfoutmode = 'A'. "
output_options-xsfoutdev = 'P863'.
output_options-xsfformat = 'X'.
*-Calling the Smartform Layout
CALL FUNCTION v_fm_name
EXPORTING
output_options = output_options
user_settings = 'X'
IMPORTING
document_output_info = document_output_info
job_output_info = job_output_info
job_output_options = job_output_options
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
Giri
Hi,
Check this link.In that,I am converting the output of smartform to PDF and then attaching it through mail.
https://sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap code samples/smartforms/smartform in abap.pdf
Similar Messages
-
Converting smartform output to a text file
Hi ,
can anyone explain me in detail that whether a smartform output can be converted to an excel file via ABAP coding in driver program.
If yes pls tell me how to do it . Thanks...
Regards,
Rose.Hi,
I don't know whether its possible (or meaningful) to convert a smartform to excel. But you can find lots of thread to convert a smartform to PDF.
SEARCH SCN with "smartform to pdf".
Regards
Karthik D -
How to convert table content into html format?
Hi,
Experts,
How to convert internal data into HTML format is there any function module or piece of code to download content into HTML.
Thank u,
Shabeer Ahmed.Then use this code....
REPORT ytest_table_html1.
* D A T A D E C L A R A T I O N
*-HTML Table
DATA:
t_html TYPE STANDARD TABLE OF w3html WITH HEADER LINE,
" Html Table
*- Declare Internal table and Fieldcatalog
it_flight TYPE STANDARD TABLE OF sflight WITH HEADER LINE,
" Flights Details
it_fcat TYPE lvc_t_fcat WITH HEADER LINE.
" Fieldcatalog
*-Variables
DATA:
v_lines TYPE i,
v_field(40).
*-Fieldsymbols
FIELD-SYMBOLS: <fs> TYPE ANY.
* S T A R T - O F - S E L E C T I O N
START-OF-SELECTION.
SELECT *
FROM sflight
INTO TABLE it_flight
UP TO 20 ROWS.
* E N D - O F - S E L E C T I O N
END-OF-SELECTION.
*-Fill the Column headings and Properties
* Field catalog is used to populate the Headings and Values of
* The table cells dynamically
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'SFLIGHT'
CHANGING
ct_fieldcat = it_fcat[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2.
DELETE it_fcat WHERE fieldname = 'MANDT'.
t_html-line = '<html>'.
APPEND t_html.
CLEAR t_html.
t_html-line = '<thead>'.
APPEND t_html.
CLEAR t_html.
t_html-line = '<tr>'.
APPEND t_html.
CLEAR t_html.
t_html-line = '<td><h1>Flights Details</h1></td>'.
APPEND t_html.
CLEAR t_html.
t_html-line = '</tr>'.
APPEND t_html.
CLEAR t_html.
t_html-line = '</thead>'.
APPEND t_html.
CLEAR t_html.
t_html-line = '<table border = "1">'.
APPEND t_html.
CLEAR t_html.
t_html-line = '<tr>'.
APPEND t_html.
CLEAR t_html.
*-Populate HTML columns from Filedcatalog
LOOP AT it_fcat.
CONCATENATE '<th bgcolor = "green" fgcolor = "black">'
it_fcat-scrtext_l
'</th>' INTO t_html-line.
APPEND t_html.
CLEAR t_html.
ENDLOOP.
t_html-line = '</tr>'.
APPEND t_html.
CLEAR t_html.
DESCRIBE TABLE it_fcat LINES v_lines.
*-Populate HTML table from Internal table data
LOOP AT it_flight.
t_html-line = '<tr>'.
APPEND t_html.
CLEAR t_html.
*-Populate entire row of HTML table Dynamically
*-With the Help of Fieldcatalog.
DO v_lines TIMES.
READ TABLE it_fcat INDEX sy-index.
CONCATENATE 'IT_FLIGHT-' it_fcat-fieldname INTO v_field.
ASSIGN (v_field) TO <fs>.
t_html-line = '<td>'.
APPEND t_html.
CLEAR t_html.
t_html-line = <fs>.
APPEND t_html.
CLEAR t_html.
t_html-line = '</td>'.
APPEND t_html.
CLEAR t_html.
CLEAR v_field.
UNASSIGN <fs>.
ENDDO.
t_html-line = '</tr>'.
APPEND t_html.
CLEAR t_html.
ENDLOOP.
t_html-line = '</table>'.
APPEND t_html.
CLEAR t_html.
*-Download the HTML into frontend
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'C:\Flights.htm'
TABLES
data_tab = t_html
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.
*-Display the HTML file
CALL METHOD cl_gui_frontend_services=>execute
EXPORTING
document = 'C:\Flights.htm'
operation = 'OPEN'
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
bad_parameter = 3
file_not_found = 4
path_not_found = 5
file_extension_unknown = 6
error_execute_failed = 7
synchronous_failed = 8
not_supported_by_gui = 9
OTHERS = 10.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
none of the above function modules r obsolete... -
Convert smartform output in to PDF using CONVERT_OTF function how to do it
Hi Anil , and Hi All
I am trying to display smartforms output in java webdynpro
for that i have got the following code in sdn.
can anybody please clarify these doubts in the below code
1) What are the mandatory input and output parameters
I have to pass here in this code to my application
2) please check my previous post also in this regards please
. Please reply at the very earliest. Check the below code
Convert smartform output in to PDF using CONVERT_OTF function module and you can write pdf using parameter 'binfile' of this function in WebDynpro using the following code:
It is copied from my prg. I hope you understand it.
public void onActionGetQuote(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
//@@begin onActionGetQuote(ServerEvent)
wdThis.wdGetOppt_QwriterCustController().executeZquote_Writer_Input();
String fileName = wdContext.currentZquote_Writer_InputElement().getOrder().toString().trim() + System.currentTimeMillis() + ".pdf";
String pdfOutput = new String(wdContext.currentOutputElement().getBinfile());
if (pdfOutput != null)
try
String pdfResoucePath = WDURLGenerator.getResourcePath(wdComponentAPI.getDeployableObjectPart(), fileName);
FileOutputStream fileOutputStream = new FileOutputStream(new File(pdfResoucePath));
PrintStream ps = new PrintStream(fileOutputStream);
ps.print(pdfOutput);
ps.close();
//Display the PDF to the browser
String fileURL = WDURLGenerator.getAbsoluteWebResourceURL(wdComponentAPI.getDeployableObjectPart(), fileName);
IWDWindow window = wdComponentAPI.getWindowManager().createExternalWindow(fileURL, "Pdf Browser", false);
window.removeWindowFeature(WDWindowFeature.ADDRESS_BAR);
window.removeWindowFeature(WDWindowFeature.MENU_BAR);
window.removeWindowFeature(WDWindowFeature.STATUS_BAR);
window.removeWindowFeature(WDWindowFeature.TOOL_BAR);
window.open();
// To collect all the file created in the server by user
quoteFiles.add(quoteFiles.size(), pdfResoucePath);
} catch (Exception e)
throw new WDRuntimeException(e);
//@@endHi
ABAPers prepared a BAPI function module which calls Smart form , how can i execute it from java Webdynpro, so that I can display the smart form in Webdynpro. Pleas reply at the very earliest. Every answer will be rewarded.
regards
jalandhar -
What is the best way to merge a file content into log file
What is the best way to merge a file content into log file.
In worst case, I will read the file line by line as string, then use
logger.info(lineString)to output to log file.
However, is there better way to do this?
The eventual log file will be something like:
log message 1
log message 2
content from file line 1
content from file line 2
content from file line 3
log message 3
log message 4ThanksJohn618 wrote:
Thank you and let me explain:
1. What do you mean by better?
I would like to see better performance. read line by line and log each line as string can be slow. Did you measure this and determine that it is actually a problem for your application? Or are you guessing?
Regardless of what you do you are still going to need to read the file.
>
2.The only better way I can think of is not having to do it, but I assume you have a very good reason to want to do this.
Yes, I have to do it beacuse the requirement is to have that file content be part of logging.
Any idea?How is it supposed to be part of it? For example which of the following is better?
File AAA - contents
First Line
Second Line XXX
Log 1
2009-03-27 DEBUG: Random preceding line
2009-03-27 DEBUG: First Line
2009-03-27 DEBUG: Second Line XXX
2009-03-27 DEBUG: Random following line
Log 2
2009-03-27 DEBUG: Random preceding line
2009-03-27 DEBUG: ----- File: AAA -------------
First Line
Second Line XXX
2009-03-27 DEBUG: Random following lineBoth of the above have some advantages and disadvantages.
The first in a mult-threaded app can end up with intermittent log entries in between lines, so having log lines with thread ids becomes important.
The first can be created by reading one line at a time and posting one at a time.
The second can be created by reading the entire file as a single string and then posting using a single log statement. -
How to create a file and store its contents into another file?
Hi,
I'm having some trouble trying to create a code where I have to to create a file and store its contents into another file?
I read the API, but I'm not certain how this file thing works.
Here's my code so far:
public static void main(String[] args) throws Exception
File file = new File("tasks.txt");
if (file.exists())
System.out.println("File already exists");
System.exit(0);
Scanner scan = new Scanner(System.in);
Scanner scan2 = new Scanner(System.in);
//Scans the input line by line
scan.useDelimiter("\\n");
//Scans the input by tabs
scan2.useDelimiter("\\t");
PrintWriter outputs = new PrintWriter("newtasks.txt");
outputs.print("ok");
outputs.println(3);
outputs.close();
}I managed to change my text into uppercase, but how do I store the uppercase content into another file.
-So this is what I did so far, I took a text file and modified its strings to uppercase.
-Now I need to put those modified strings into another text file, is there a way where I can do that with my current code?
-I already tried printwriter, but it doesn't seem to work
public static void main(String[] args)throws IOException
//Task[] oneHundredTasks = new Task[100];
String uppercase;
String combine;
Scanner scan = null;
FileInputStream in = null;
FileOutputStream out = null;
PrintWriter output = null;
try
scan = new Scanner(new BufferedReader(new FileReader("tasks.txt")));
scan.useDelimiter("\\n");
scan.useDelimiter("\\t");
while (scan.hasNext())
if(!scan.hasNext())
scan.next();
combine = scan.next();
uppercase = combine.toUpperCase();
System.out.println(uppercase);
finally
if (scan != null)
scan.close();
//The program will try the input and output files
try
in = new FileInputStream("tasks.txt");
out = new FileOutputStream("newtasks.txt");
int c;
//The number "-1" is used to indicate that it has reached the end of the stream.
while ((c = in.read()) != -1)
out.write(c);
finally
if (in != null)
in.close();
if (out != null)
out.close();
} -
Execute command and save output in a HTML File
Hello Guys,
I have a requirement and for that i have to do following. a) read a file in an array and then execute a command for each value in that array. after that i want to store the output of command and value of array in another array.
i am doing something like below.
set objtextfile = objfso.opentextfile _
("c:\temp\aaaa.txt", forreading)
j=0
Do until objtextfile.atendofstream
redim preserve arr123(j)
arr123(j) = objtextfile.readline
j = j+1
Loop
for each server in arr123
chk_status = "command" &" "& server
set objexecobject = objshell.exec(chk_status)
'Here i am not sure how to proceed further to achieve what i described above.
Next
Can someone help me with this?
-KAKA-Thank you for your response.
So here is what i want to do.
Query a database using odbc from my management server (odbc is configured and connection is tested) and based on the query it will result out few list of servers. then from the same management server i want to execute a command against all the resulted server
(management server has a binary which can execute remote action). this remote action will get output back.
then i would like to store the name of server and resulte output in a html file which should look like below.
which i will later host on apache.
YOu do not need to move things in and out of arrays and files.
>>>> You are right but as i stated, i am not a core programmer and due to nature of my job i have to work on perl, shell and VB Script, apart from my actual technology so it becomes difficult to write it with perfection.
I hope you understand.
-KAKA-
-KAKA- -
Convert Multipage fireworks document to HTML file
Hi,
I am preparing a Fireworks multipage file containing visual style guide of a product. I would like to convert this to html file for maintainance by other designers and developers. How can I convert all pages to a html file? I tried to export to html file but it exports only 1 page. How can I convert all the pages? I am using CS4.
-ShivanandYou can export multiple pages in a single step by selecting all the pages you want to export at once.
-In the Pages panel, select the pages that you want to export.
-Right-click, and select Export Selected Page(s).
-In the Export dialog box, select one of the options from the Export menu:
Layers To Files Exports layers in the selected pages as individual files
States To Files Exports states in the selected pages as individual files.
Pages To Files Exports selected pages as individual files. -
Why is it when I convert a keynote show into HTML, PC users cannot see it properly on their computers?
JohnRobertBrown wrote:
It looks perfect using Google Chrome on my Mac. But doesn't work well on Explorer on a PC. It seems to be way off center.
There is never any guarantee that automatically generated html will look right on every browser, especially Explorer. For max compatibility with MS stuff it's best to use Office to start with instead of iWorks.
I don't know whether you could manually edit the Keynote html to make it work better with Explorer. It would be interesting to know whether it looks right in Windows Safari, Chrome, or FireFox so you could know whether only IE does it wrong. -
While converting smartform output toPDF: end command // missing in OTF data
Hi,
While Converting smartform output to PDF i am getiing the following error.
end command // missing OTF data . And also in the importing parameter of smartform function module also (job_output_info ) i did not findout the data. Where did i make a mistake. How can i correct this error. Thanks in advance.Implemented SAP Note 1123505 - OTF-PDF conversion.
-
Error while converting smartform output to pdf
hi
while converting smartform output to pdf error occured otf data not founr.
regarding code is as follows:
otfitab = i_job_output_info-otfdata.
CALL FUNCTION 'CONVERT_OTF_2_PDF'
EXPORTING
USE_OTF_MC_CMD = 'X'
ARCHIVE_INDEX =
IMPORTING
bin_filesize = l_pdf_len
TABLES
otf = otfitab
doctab_archive = t_docs_tab
lines = pdfitab
EXCEPTIONS
ERR_CONV_NOT_POSSIBLE = 1
ERR_OTF_MC_NOENDMARKER = 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.
rest all declarations are up to date.
thanks in advance..........Hi Mayank,
I am not sure if u know this already, we can convert the spool ouput to PDF
by using the program RSTXPDFT4.
Regards,
Vivek -
Converting smartforms output into PDF
Hi ALL,
How to convert the smartforms output into PDF based form. After executing the form, it should directly open in PDF. How to do this?
Points will be awarded.
Thanks and regards,
vinoth.Hi Vinoth Kumar,
Please go throuh the below procedure and sample Code, this might help you.
Procedure
When we activate the Smartform the system generates a Function Module. The function module name we can get from Smartfrom screen from menubar
Environment => Function Module_Name . In a report we can get this Function module name by calling a Function Module standard SSF_FUNCTION_MODULE_NAME. This function module at runtime calls the FM generated by smartform, which in turn is then used to pass data from the report to Smartform. In the report given below the FM generated is /1BCDWB/SF00000152 . In this FM we can see CONTROL_PARAMETERS in import tab. This is of type SSFCTRLOP. We need to set the GETOTF of this to be X. Setting this field will activate the OTF field in smartform.
In export tab of the FM generated by smartform we can see a parameter JOB_OUTPUT_INFO which is of type SSFCRESCL. The SSFCRESCL is a structure of having one of fields as OTFDATA. OTFDATA in turn is a table of type ITCOO. ITCOO has two fields TDPRINTCOM and TDPRINTPAR. TDPRINTCOM represents command line of OTF format data and TDPRINTPAR contains command parameters of OTF format data.
In every Smartform output in OTF format, TDPRINTCOM begins and ends with //. EP represents the end-of-page value for TDPRINTCOM field.
In addition we need to set few fields at the place where we call this FM(generated by smartform) in our program. While calling this FM we should set control_parameters, output_options, user_settings and job_putput_info fields as shown in program.
Once these settings are done we can call Function Module CONVERT_OTF to convert the OTF data of smartfrom output to PDF data format. Once these are done we can call method cl_gui_fronted_services=>file_save_dialog to specify the directory path where we want to save the output PDF file. After this we can call Function Module GUI_DOWNLOAD to download the PDF file on our local system.
Here is a sample code of program to perform the function.
SAMPLE CODE
*& Report ZAMIT_SMART_FORM_PDF *
REPORT ZAMIT_SMART_FORM_PDF .
data: carr_id type sbook-carrid,
cparam type ssfctrlop,
outop type ssfcompop,
fm_name type rs38l_fnam.
DATA: tab_otf_data TYPE ssfcrescl,
pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE,
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.
parameter: p_custid type scustom-id default 1.
select-options: s_carrid for carr_id default 'LH' to 'LH'.
parameter: p_form type tdsfname default 'ZAMIT_SMART_FORM'.
data: customer type scustom,
bookings type ty_bookings,
connections type ty_connections.
start-of-selection.
suppressing the dialog box for print preview****************************
outop-tddest = 'LP01'.
cparam-no_dialog = 'X'.
cparam-preview = SPACE.
cparam-getotf = 'X'.
select single * from scustom into customer where id = p_custid.
check sy-subrc = 0.
select * from sbook into table bookings
where customid = p_custid
and carrid in s_carrid
order by primary key.
select * from spfli into table connections
for all entries in bookings
where carrid = bookings-carrid
and connid = bookings-connid
order by primary key.
call function 'SSF_FUNCTION_MODULE_NAME'
exporting formname = p_form
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.
exit.
endif.
Hope this resolves your query.
Reward all the helpful answers.
Regards
calling the generated function module
call function fm_name
exporting
archive_index =
archive_parameters =
control_parameters = cparam
mail_appl_obj =
mail_recipient =
mail_sender =
output_options = outop
user_settings = SPACE
bookings = bookings
customer = customer
connections = connections
importing
document_output_info =
job_output_info = tab_otf_data
job_output_options =
exceptions formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
others = 5.
if sy-subrc <> 0.
error handling
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
tab_otf_final[] = tab_otf_data-otfdata[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
ARCHIVE_INDEX = ' '
COPYNUMBER = 0
ASCII_BIDI_VIS2LOG = ' '
IMPORTING
bin_filesize = bin_filesize
BIN_FILE =
TABLES
otf = tab_otf_final
lines = 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
WINDOW_TITLE =
DEFAULT_EXTENSION =
DEFAULT_FILE_NAME =
FILE_FILTER =
INITIAL_DIRECTORY =
WITH_ENCODING =
PROMPT_ON_OVERWRITE = 'X'
CHANGING
filename = FILE_NAME
path = FILE_PATH
fullpath = FULL_PATH
USER_ACTION =
FILE_ENCODING =
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.
************downloading the converted PDF data to your local PC*******
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = bin_filesize
filename = 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'
IMPORTING
filelength = file_size
TABLES
data_tab = pdf_tab
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.
ENDIF. -
Problem in converting smartforms output in pdf
Hi all..
I am trying to convert smartform's output in PDF file..
I am able to convert smartforms's output in PDF but after that i can't see Print Preview..
Code is following...
REPORT ZMM_R402_FORM_TEST11.
TABLES : VBRK,J_1IEXCHDR.
SELECTION-SCREEN : BEGIN OF BLOCK BLK WITH FRAME TITLE TEXT-000.
*PARAMETERS : EXNUM TYPE EXNUM OBLIGATORY.
SELECT-OPTIONS : EXNUM FOR J_1IEXCHDR-EXNUM NO-EXTENSION OBLIGATORY.
PARAMETERS : EXDAT LIKE J_1IEXCHDR-EXDAT OBLIGATORY.
PARAMETERS : KUNNR LIKE VBRK-KUNAG OBLIGATORY.
PARAMETERS : SR_NO(12) TYPE C.
PARAMETERS : DATE1 TYPE EXDAT.
SELECTION-SCREEN : END OF BLOCK BLK.
DATA : FM_NAME(30) TYPE C.
DATA : SR(12) TYPE C.
UNPACK EXNUM-LOW TO EXNUM-LOW.
UNPACK EXNUM-HIGH TO EXNUM-HIGH.
DATA:
it_otf TYPE STANDARD TABLE OF itcoo,
it_docs TYPE STANDARD TABLE OF docs,
it_lines TYPE STANDARD TABLE OF tline.
Declaration of local variables.
DATA:
st_job_output_info TYPE ssfcrescl,
st_document_output_info TYPE ssfcrespd,
st_job_output_options TYPE ssfcresop,
st_output_options TYPE ssfcompop,
st_control_parameters TYPE ssfctrlop,
v_len_in TYPE so_obj_len,
v_language TYPE sflangu VALUE 'E',
v_e_devtype TYPE rspoptype,
v_bin_filesize TYPE i,
v_name TYPE string,
v_path TYPE string,
v_fullpath TYPE string,
v_filter TYPE string,
v_uact TYPE i,
v_guiobj TYPE REF TO
cl_gui_frontend_services,
v_filename TYPE string,
v_fm_name TYPE rs38l_fnam.
CONSTANTS c_formname TYPE tdsfname VALUE 'ZTEST'.
*CALL FUNCTION 'SSF_GET_DEVICE_TYPE'
EXPORTING
i_language = v_language
i_application = 'SAPDEFAULT'
IMPORTING
e_devtype = v_e_devtype.
st_output_options-tdprinter = v_e_devtype.
st_control_parameters-no_dialog = ' '.
st_control_parameters-getotf = 'X'.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'ZMM_402_FORM'
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.
**WRITE:/ FM_NAME.
CALL FUNCTION FM_NAME
EXPORTING
control_parameters = st_control_parameters
output_options = st_output_options
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS =
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS =
USER_SETTINGS = 'X'
EXNUM = EXNUM-LOW
EXNUM1 = EXNUM-HIGH
DATE = EXDAT
KUNNR = KUNNR
SR = SR_NO
DATE1 = DATE1
IMPORTING
document_output_info = st_document_output_info
job_output_info = st_job_output_info
job_output_options = st_job_output_options
DOCUMENT_OUTPUT_INFO = W_RETURN
JOB_OUTPUT_INFO =
JOB_OUTPUT_OPTIONS =
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.
.........................CONVERT TO OTF TO PDF.......................
CALL FUNCTION 'CONVERT_OTF_2_PDF'
IMPORTING
bin_filesize = v_bin_filesize
TABLES
otf = st_job_output_info-otfdata
doctab_archive = it_docs
lines = it_lines
EXCEPTIONS
err_conv_not_possible = 1
err_otf_mc_noendmarker = 2
OTHERS = 3.
........................GET THE FILE NAME TO STORE....................
CONCATENATE 'smrt' '.pdf' INTO v_name.
CREATE OBJECT v_guiobj.
CALL METHOD v_guiobj->file_save_dialog
EXPORTING
default_extension = 'pdf'
default_file_name = v_name
file_filter = v_filter
CHANGING
filename = v_name
path = v_path
fullpath = v_fullpath
user_action = v_uact.
IF v_uact = v_guiobj->action_cancel.
EXIT.
ENDIF.
..................................DOWNLOAD AS FILE....................
MOVE v_fullpath TO v_filename.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = v_bin_filesize
filename = v_filename
filetype = 'BIN'
TABLES
data_tab = it_lines
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.
ENDIF.
Please Help me ..
How can i see print preview..use like this:
call function lf_fm_name
exporting
archive_index = toa_dara
archive_parameters = arc_params
control_parameters = ls_control_param "Smart Forms: Control structure
mail_recipient = ls_recipient
mail_sender = ls_sender "Structure for Object ID
output_options = ls_composer_param "SAP Smart Forms: Smart Composer (transfer) options
user_settings = ' '
is_dlv_delnote = ls_dlv_delnote "Delivery Note Data: Transfer-Structure for Smartform
is_nast = nast "Nast
exceptions formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
others = 5.
if sy-subrc <> 0.
error handling
cf_retcode = sy-subrc.
perform protocol_update.
get SmartForm protocoll and store it in the NAST protocoll
perform add_smfrm_prot. "INS_HP_335958
endif.
*To read the Spool Number generated
read table it_job_output_info-spoolids into v_rspoid index 1.
concatenate 'aBC.pdf' into v_file_name.
submit rstxpdft4 and return
with spoolno = v_rspoid
with p_file = v_file_name.
clear: v_rspoid. -
Smartform output to a PDF file, using it as an attachment to send the mail.
Hi,
I have a smartform output, which needs to be converted to PDF file and it should be mailed to a user as an attachment.
Could anyone please tell me how this can be done.
Thanks & Regards,
Goutham.Hi ,
Find the code below:
Reward if helpful
*& Form smart_form_process
Make calls to required functions exporting GT_INTERFACE
FORM smart_form_process CHANGING cf_retcode TYPE sy-subrc.
Smart form data
DATA:
w_ssfname TYPE tdsfname, "Smart form name
lf_fm_name TYPE rs38l_fnam. "Function module name
Local data:
DATA:
ls_control_param TYPE ssfctrlop, "Control paramters
ls_output_options TYPE ssfcompop. "Output options
Data for email smart form:
DATA:
lv_ip_mailaddr TYPE so_name, "Address of a Mail Recipient
lv_ip_type_id TYPE so_escape, "Recipient type
ls_recipient_id TYPE swotobjid, "Structure for recvr obj ID
ls_sender_id TYPE swotobjid. "Structure for sender obj id
Constants:
CONSTANTS:
lc_ip_type_id TYPE so_escape VALUE 'U', "For internet address.
lc_smartform TYPE tdsfname VALUE 'ZVSF_ASN_DELNOTE', "Smart form name
lc_mail TYPE tddevice VALUE 'MAIL'. "Mail device
Assign recipient
lv_ip_mailaddr = gv_smtp_addr. "CSAM email id
lv_ip_type_id = lc_ip_type_id. "External address
Create Mail title
CONCATENATE text-001
nast-objky
INTO ls_output_options-tdtitle.
Create recipient object
CALL FUNCTION 'CREATE_RECIPIENT_OBJ_PPF'
EXPORTING
ip_mailaddr = lv_ip_mailaddr
ip_type_id = lv_ip_type_id
IMPORTING
ep_recipient_id = ls_recipient_id
EXCEPTIONS
invalid_recipient = 1
OTHERS = 2.
IF sy-subrc <> 0.
error handling
cf_retcode = sy-subrc.
PERFORM protocol_update.
ENDIF.
Get sender object id.
CALL FUNCTION 'CREATE_SENDER_OBJECT_PPF'
EXPORTING
ip_sender = sy-uname
IMPORTING
ep_sender_id = ls_sender_id
EXCEPTIONS
invalid_sender = 1
OTHERS = 2.
IF sy-subrc <> 0.
error handling
cf_retcode = sy-subrc.
PERFORM protocol_update.
ENDIF.
Assign the smart form name
w_ssfname = lc_smartform.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = w_ssfname
IMPORTING
fm_name = lf_fm_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
IF sy-subrc <> 0.
error handling
cf_retcode = sy-subrc.
PERFORM protocol_update.
ENDIF.
For email output.
Output options
ls_output_options-BCS_COMMIT = 'X'.
ls_control_param-device = lc_mail.
ENDIF.
dynamically call Fm behind the Smart form
CALL FUNCTION lf_fm_name
EXPORTING
control_parameters = ls_control_param
mail_recipient = ls_recipient_id
mail_sender = ls_sender_id
output_options = ls_output_options
user_settings = ' '
TABLES
delivery = gt_delivery
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc <> 0.
Error handling
cf_retcode = sy-subrc.
PERFORM protocol_update.
ENDIF.
ENDFORM. " smart_form_process -
Save report output automatically into html
Hi Gurus!
I have few reports that give a simple list output as result.
Now I want to put an option in the output , an option that will be
a save buttom which when clicked will automatically save the output
into an html file and archive it to a particular folder.
I would like to know how to automatically archive the report output
when this save buttom is clicked to a folder.
DO we do it after we have printed the report in the output
and how do we go abot doing this .
Regards
SumitHi,
After running a report, call this function module WWW_LIST_TO_HTML
to convert the list output to HTML.
Best Regards,
Krishna
Maybe you are looking for
-
I installed Adobe Reader 9.20. Docs have lines with black blocks. Help?
I am not sure what to do. I upgraded to the 9.20 and have had problems ever since. I tried uninstalling all adobe products and reinstalling and am having the same problem. Large portions of text in the documents are "blocked out" with a black
-
I keep getting the File Error: The specified file is open and in use by this or another application. When I try to render. No matter what drive I am using I keep getting the same message. I did some research and put my render files folder in the spot
-
Can I get Apple's Backup to work without MobileMe?
I've moved to a "new" (well, to me) Early 2008 MacBook Pro with 10.6.8. With my old iMac G4, I used Apple's Backup program. I have their version for Leopard and installed it. It won't work, though. It gives an "exceeds trial limit" warning because it
-
What is the use of constraint option in Prompt
Hi all, what is the use of constraint option in prompt.If which scenario it is useful. pls give the clear explanation. Regards bharath
-
How to export interactive pdf?
hi, pls help me,how to export interactive pdf? thanks, vijay