02-06-2013 6:30 AM
Hi,
Is there any way to generate spool request without printing the smartform output, so that i can download that spool request into pdf and mail it as an attachment.
I just need to generate spool request without printing.
kindly suggest me.
Thanks in advance,
Madhumahesh.
02-06-2013 6:37 AM
You need to call smart forms [same as in driver program for outputs]. In print options, you can suppress dialog and it will give spool number.
FM: for Spool to PDF
CONVERT_ABAPSPOOLJOB_2_PDF
CONVERT_OTFSPOOLJOB_2_PDF
Just attach PDF hex internal table using class method in mail sending routine.
02-06-2013 6:37 AM
You need to call smart forms [same as in driver program for outputs]. In print options, you can suppress dialog and it will give spool number.
FM: for Spool to PDF
CONVERT_ABAPSPOOLJOB_2_PDF
CONVERT_OTFSPOOLJOB_2_PDF
Just attach PDF hex internal table using class method in mail sending routine.
02-06-2013 6:42 AM
Hi,
thanks for you info
given below is my code
I just need to generate spool request,
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = sf_formname
importing
fm_name = sf_fmname
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.
st_output_options-tdprinter = v_e_devtype.
st_output_options-tddest = 'WINE'.
st_control_parameters-no_dialog = 'X'.
st_control_parameters-getotf = 'X'.
st_control_parameters-no_dialog = 'X'.
st_control_parameters-preview = 'X'.
st_job_output_info-tdnewid = 'X'.
call function sf_fmname
exporting
control_parameters = st_control_parameters
output_options = st_output_options
user_settings = 'X'
date_char = date_char
importing
document_output_info = st_document_output_info
job_output_info = st_job_output_info
job_output_options = st_job_output_options
tables
it_form = it_form
exceptions
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
others = 5.
using the above code i am unable to generate the spool request.(without clicking on print button).
kindly suggest me.
thanks in advance.
madhumahesh.
02-06-2013 7:58 AM
Hi,
Probably as you are passing the USER_SETTINGS = 'X' so the the function module is picks the printer assigned to the user.
Pass the USER_SETTINGS = ' ' and try.
Hope this helps.
Thanks,
Tooshar Bendale
02-06-2013 8:48 AM
02-06-2013 9:28 AM
Hi,
Pass the Print: Archiving mode i.e. (TDARMOD). No_dialog = 'X' and PREVIEW shoulbe be space.
Below is the code.
st_control_parameters-no_dialog = 'X'.
st_control_parameters-tdarmod = 1.
st_control_parameters-tdcopies = 001.
st_control_parameters-tddest = 'LP01'.
st_control_parameters-tdprinter = 'SWIN'.
st_control_parameters-tdlifetime = 1.
st_control_parameters-tdnewid = 'X'.
st_control_parameters-preview = ' '.
Thanks,
Tooshar Bendale
02-06-2013 6:48 AM
Hello,
Data: LT_OPTIONS TYPE SSFCRESOP.
Pass tdnewid = 'X' to generate new spool request.
LT_OPTIONS-tddest = 'LOCL'. "Spool: Output device
LT_OPTIONS-tdimmed = ' '. "Print Immediately
LT_OPTIONS-tdnewid = 'X'. "New Spool Request
Thanks,
Abhijit
02-06-2013 8:48 AM
02-06-2013 6:52 AM
hi,
while you are calling your smartform in your table in import pass the following ..
DATA: w_fmodule TYPE rs38l_fnam,
w_cparam TYPE ssfctrlop,
w_outoptions TYPE ssfcompop,
W_bin_filesize TYPE i, " Binary File Size
w_FILE_NAME type string,
w_File_path type string,
w_FULL_PATH type string.
* Internal table to hold OTF data received from the SMARTFORM
DATA : t_otf_from_fm TYPE ssfcrescl,
DATA:
t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
T_pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE.,
IMPORTING
* DOCUMENT_OUTPUT_INFO =
job_output_info = t_otf_from_fm
then
t_otf[] = t_otf_from_fm-otfdata[].
Then
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
MAX_LINEWIDTH = 132
* ARCHIVE_INDEX = ' '
* COPYNUMBER = 0
* ASCII_BIDI_VIS2LOG = ' '
* PDF_DELETE_OTFTAB = ' '
IMPORTING
BIN_FILESIZE = W_bin_filesize
* BIN_FILE =
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.
then,,
try.
* -------- create persistent send request ------------------------
send_request = cl_bcs=>create_persistent( ).
* -------- create and set document -------------------------------
pdf_content = cl_document_bcs=>xstring_to_solix( pdf_xstring ).
*
* Set the mail body
document = cl_document_bcs=>create_document(
i_type = 'RAW'
* i_hex = pdf_content
* i_length = pdf_size
i_text = it_text
i_subject = head ). "#EC NOTEXT
*TRY.
* Create attachment
call method document->add_attachment
exporting
i_attachment_type = 'PDF'
i_attachment_subject = head1
i_attachment_size = pdf_size
* i_attachment_language = SPACE
* i_att_content_text =
i_att_content_hex = pdf_content
* i_attachment_header =
.
* CATCH cx_document_bcs .
*ENDTRY.
* add document object to send request
send_request->set_document( document ).
* --------- add recipient (e-mail address) -----------------------
* create recipient object
recipient = cl_cam_address_bcs=>create_internet_address( cmail ).
* add recipient object to send request
send_request->add_recipient( recipient ).
* recipient1 = cl_cam_address_bcs=>create_internet_address( 'xvy@xvy.com' ).
*
** add recipient object to send request
* send_request->add_recipient( recipient1 ).
* ---------- send document ---------------------------------------
sent_to_all = send_request->send( i_with_error_screen = 'X' ).
commit work.
if sent_to_all is initial.
message i500(sbcoms) with cmail."abc@abc.com'.
else.
message s022(so).
endif.
hope it helps,
Vinoth
02-06-2013 8:51 AM
Hi Madhumahesh,
Check this Sample Code for without printing get Spool Number , then Convert this Spool into as per your requirement .
**-- Setup the Print Parmaters
*
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
COPIES = '1'
EXPIRATION = '1'
NEW_LIST_ID = 'X'
NO_DIALOG = 'X'
USER = SY-UNAME
IMPORTING
OUT_PARAMETERS = MSTR_PRINT_PARMS
VALID = MC_VALID
EXCEPTIONS
ARCHIVE_INFO_NOT_FOUND = 1
INVALID_PRINT_PARAMS = 2
INVALID_ARCHIVE_PARAMS = 3
OTHERS = 4.
P_REPID = 'Enter your Smartform Driver Program Name ' .
SUBMIT (P_REPID) TO SAP-SPOOL WITHOUT SPOOL DYNPRO
SPOOL PARAMETERS MSTR_PRINT_PARMS
VIA SELECTION-SCREEN
AND RETURN.
*-- Find out the spool number
PERFORM GET_SPOOL_NUMBER USING P_REPID "SY-REPID
SY-UNAME
CHANGING MI_RQIDENT.
FORM GET_SPOOL_NUMBER USING F_REPID
F_UNAME
CHANGING F_RQIDENT.
DATA: LC_RQ2NAME LIKE TSP01-RQ2NAME.
CONCATENATE F_REPID+0(9)
F_UNAME+0(3)
INTO LC_RQ2NAME.
SELECT * FROM TSP01 WHERE RQ2NAME = LC_RQ2NAME
ORDER BY RQCRETIME DESCENDING.
F_RQIDENT = TSP01-RQIDENT.
EXIT.
ENDSELECT.
IF SY-SUBRC NE 0.
CLEAR F_RQIDENT.
ENDIF.
ENDFORM." get_spool_number
Regard's
Smruti
02-06-2013 9:15 AM
Hi Madhumahesh,
Just run your smartform and then in the command box, write PDF!
It will generate a pdf of your smartform. Save and send it.
Regards
Purnand Dhingra