on 07-06-2009 4:40 AM
Hi all,
Good day,
I created a print program to call a smartform and send the smartform to the spool (t-code: sp01).
WHen i go to SP01 and click the icon under the 'TYPE' title. the details of the smartform is display, but how can I make to it to display in PDF layout?
Here is the code in my print program.
DATA: L_SPOOLIDS TYPE TFPSPOOLID.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'ZSSDFRECOST'
* VARIANT = ' '
* DIRECT_CALL = ' '
IMPORTING
FM_NAME = FNAME
CALL FUNCTION FNAME
EXPORTING
USER_SETTINGS = ' '
IMPORTING
JOB_OUTPUT_INFO = GH_RETURN
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5.
IF SY-SUBRC = 0.
* GET SPOOL ID
L_SPOOLIDS = GH_RETURN-SPOOLIDS.
LOOP AT L_SPOOLIDS INTO G_SPONO.
ENDLOOP.
ENDIF.
THanks
Hi,
Check this function module which converts spool requests to pdf format..
data wa_spoolid TYPE rspoid.
data DATA: gt_pdf_tab type standard table of tline.
convert the spool to pdf
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = wa_spoolid
TABLES
PDF = gt_pdf_tab
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
OTHERS = 12.
Regards,
Kumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Prakesh,
You can write the following code after u get the spool no.
if u r not able to get the spool no. then try the following code, to retrieve the spool no.
data declarations
DATA: V_RQIDENT TYPE TSP01-RQIDENT. " Variable for spool id
DATA: V_RQ2NAME TYPE STRING. " User name
DATA: T_PDF LIKE TLINE OCCURS 0 WITH HEADER LINE.
DATA : v_filename type string,
v_filepath type string,
v_fullpath type string.
the following select query will give u spool no
CONCATENATE V_RQ2NAME SY-UNAME INTO V_RQ2NAME.
SELECT * FROM TSP01
WHERE RQ2NAME EQ V_RQ2NAME ORDER BY RQCRETIME DESCENDING.
V_RQIDENT = TSP01-RQIDENT.
EXIT.
ENDSELECT.
now u'll get the corresponding spool no.....Next
Use the following function module...to convert spool no. to PDF
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
SRC_SPOOLID = V_RQIDENT
TABLES
PDF = T_PDF.
if sy-subrc = 0, means ur spool has been converted to PDF
IF SY-SUBRC EQ 0.
To get The location where the File is to be saved In PDF Format use the following method
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
EXPORTING
WINDOW_TITLE = 'Select The Path Where The PDF Should Be Saved'
DEFAULT_FILE_NAME = 'FileName.PDF'
CHANGING
FILENAME = v_filename
PATH = v_filepath
FULLPATH = v_fullpath.
to download the pdf file at mentioned location, use following function module and give the v_fullpath to it
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = v_fullpath
FILETYPE = 'BIN'
TABLES
DATA_TAB = T_PDF.
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.
write the code as it is...after executing it u'll be able to convert spool to pdf and also save it at any required location.
hope this piece of code helps u...All The Best
Regards,
Radhika
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
U can use the Program: RSTXPDFT4 to convert the spool to a pdf doc on ur presentation server.
Regards,
Bhargava
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bhargava,
Thanks but I do not want to use external program RSTXPDFT4 to perform the conversion. User just want to see that output in pdf format when the click at the icon under the Type in SP01.
Is there any way that I can control in my print program so that when user click at the icon it will display as pdf?
Cheers!
User | Count |
---|---|
78 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.