Send Smart Form to Spool only
Hi,
I need to send a smart form to spool only. It's not to be printed. I have set the following:
no_dialog = 'X'.
tdnoprev = 'X'.
tdnewid = 'X'
tdimmed = ''.
and it's sending the smart form to the spool and printing it at the same time.
Anybody can advised me which parameters should I set? Points will be rewarded for useful replies. Thanks.
hi,
use <b>ssf_function_module_name</b>
and
<b>ws_formname</b>
the below link contains all the declarations and function module information.
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/452ea204-0701-0010-cb88-8cc50fa287f0
regards,
Ashok Reddy
Similar Messages
-
Need to send Smart form via email through Driver program
Hi All,
We need to send smart form via email through a new driver program (z program). Can you please guide me on this.
I have used the following code to achieve this. We are getting message saying 'Mail request has created' when executed, but the mail is not sent.
lvs_comm_type = 'INT'.
lvs_comm_values-adsmtp-SMTP_ADDR = e_mail.
lvs_comm_values-adsmtp-R3_USER = 'X'.
lvs_comm_values-adsmtp-ENCODE = '0'.
call function 'CONVERT_COMM_TYPE_DATA'
exporting
pi_comm_type = lvs_comm_type
pi_comm_values = lvs_comm_values
pi_screen = ' '
pi_newid = 'X'
importing
pe_itcpo = lvs_itcpo
pe_device = lvf_device
pe_mail_recipient = p_mail_recipient
pe_mail_sender = p_mail_sender
exceptions
comm_type_not_supported = 1
recipient_creation_failed = 2
sender_creation_failed = 3
others = 4.
if sy-subrc ne 0.
raise COMMUNICATION_ERROR.
endif.
control_parameters-device = 'MAIL'.
output_options-TDIMMED = 'X'.
output_options-TDDELETE = 'X'.
CALL FUNCTION fm_name
exporting
CONTROL_PARAMETERS = control_parameters
MAIL_RECIPIENT = mail_recipient
MAIL_SENDER = mail_sender
OUTPUT_OPTIONS = output_options
USER_SETTINGS = space
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5.
Thank youHi,
For sending smartform output into mail you first have to generate spool request and convert it into PDF and then
only it can be sended into mail, please find the sample code in the mail below:
http://wiki.sdn.sap.com/wiki/display/sandbox/ConversionofSpoolRequestDataintoPDFandExcelFormatandSenditintoMail
Mansi
Edited by: Matt on Jan 29, 2010 8:25 AM - removed code, instead point to wiki that Mansi authored. -
Sending Smart form to Printer in SRM
Hi All,
I am trying to send a smartform to Printer in SRM ITS. I gave output options and control parameters . When i see the Print dialog box i dont see the Front end printers in that. Normally when we pass LOCL we should see default printer in Print dialog.
When i do print, spool is creating but its not printing at local printer .
I am doing this in SRM ITS ... could you kindly any one tell me what steps need to take to print a smart form at local printer when we call form ?
ThanksHi
Please elaborat, when you need this SMARTFORM to get triggered.
By the way, Have you tried implementaing the following BADIs ?
BBP_CHANGE_SF_BID Smartform for E-Mails to Bidder
BBP_CHANGE_SF_CTR Change Smart Form for Contract Output
BBP_CHANGE_SF_ERS Change Smart Form
BBP_CHANGE_SF_SC Smart Form Shopping Cart Print
BBP_CHANGE_SF_VERS Change Smart Form for Version Comparison
BBP_PROCESS_AUC Process Smart Form with Changed Interface
BBP_PROCESS_BID Process Smart Form with Changed Interface
BBP_PROCESS_CTR Process Smart Form with Changed Interface
BBP_PROCESS_PO Process Smart Form with Changed Interface
BBP_PROCESS_QUOT Process Smart Form with Changed Interface
Hope this will help.
Please rewards suitable points.
Regards
- Atul -
Issue in External send - smart forms
hi All,
i have written a new print program for smart form and have assigned it to zoutput type.
The print preview and spool are perfectly fine.
when i give the medium as external send, it is not sending any attachmnet to the external mail id i gave.
my code is as follows.
PERFORM set_print_param USING ls_addr_key
ls_dlv-land
CHANGING ls_control_param
ls_composer_param
ls_recipient
ls_sender
ret.
FORM SET_PRINT_PARAM USING IS_ADDR_KEY LIKE ADDR_KEY
IS_DLV-LAND LIKE VBRK-LAND1
CHANGING CS_CONTROL_PARAM TYPE SSFCTRLOP
CS_COMPOSER_PARAM TYPE SSFCOMPOP
CS_RECIPIENT TYPE SWOTOBJID
CS_SENDER TYPE SWOTOBJID
RET TYPE SY-SUBRC.
DATA: LS_ITCPO TYPE ITCPO.
DATA: LF_REPID TYPE SY-REPID.
DATA: LF_DEVICE TYPE TDDEVICE.
DATA: LS_RECIPIENT TYPE SWOTOBJID.
DATA: LS_SENDER TYPE SWOTOBJID.
LF_REPID = SY-REPID.
CALL FUNCTION 'WFMC_PREPARE_SMART_FORM'
EXPORTING
PI_NAST = NAST
PI_COUNTRY = IS_DLV-LAND
PI_ADDR_KEY = IS_ADDR_KEY
PI_REPID = LF_REPID
PI_SCREEN = XSCREEN
IMPORTING
PE_RETURNCODE = RET
PE_ITCPO = LS_ITCPO
PE_DEVICE = LF_DEVICE
PE_RECIPIENT = CS_RECIPIENT
PE_SENDER = CS_SENDER.
IF RET = 0.
MOVE-CORRESPONDING LS_ITCPO TO CS_COMPOSER_PARAM.
CS_CONTROL_PARAM-NO_OPEN
CS_CONTROL_PARAM-NO_CLOSE
CS_CONTROL_PARAM-DEVICE = LF_DEVICE.
CS_CONTROL_PARAM-NO_DIALOG = 'X'.
CS_CONTROL_PARAM-PREVIEW = XSCREEN.
CS_CONTROL_PARAM-GETOTF = LS_ITCPO-TDGETOTF.
CS_CONTROL_PARAM-LANGU = NAST-SPRAS.
CS_CONTROL_PARAM-REPLANGU1
CS_CONTROL_PARAM-REPLANGU2
CS_CONTROL_PARAM-REPLANGU3
CS_CONTROL_PARAM-STARTPAGE
ENDIF.
ENDFORM.
after this i am calling smart form with all the required parameters.
CALL FUNCTION gv_function
EXPORTING
control_parameters = ls_control_param
output_options = ls_composer_param
archive_index = toa_dara
archive_parameters = arc_params
mail_recipient = ls_recipient
mail_sender = ls_sender
user_settings = space
IMPORTING
JOB_OUTPUT_INFO = ls_job_info
TABLES
zmm_purord_at = zmm_purord_at
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
i am not getting any mail to the desired mail id.
Any pointers to this would be highly appreciated.
Regards,
Sreekanthhi All,
i have written a new print program for smart form and have assigned it to zoutput type.
The print preview and spool are perfectly fine.
when i give the medium as external send, it is not sending any attachmnet to the external mail id i gave.
my code is as follows.
PERFORM set_print_param USING ls_addr_key
ls_dlv-land
CHANGING ls_control_param
ls_composer_param
ls_recipient
ls_sender
ret.
FORM SET_PRINT_PARAM USING IS_ADDR_KEY LIKE ADDR_KEY
IS_DLV-LAND LIKE VBRK-LAND1
CHANGING CS_CONTROL_PARAM TYPE SSFCTRLOP
CS_COMPOSER_PARAM TYPE SSFCOMPOP
CS_RECIPIENT TYPE SWOTOBJID
CS_SENDER TYPE SWOTOBJID
RET TYPE SY-SUBRC.
DATA: LS_ITCPO TYPE ITCPO.
DATA: LF_REPID TYPE SY-REPID.
DATA: LF_DEVICE TYPE TDDEVICE.
DATA: LS_RECIPIENT TYPE SWOTOBJID.
DATA: LS_SENDER TYPE SWOTOBJID.
LF_REPID = SY-REPID.
CALL FUNCTION 'WFMC_PREPARE_SMART_FORM'
EXPORTING
PI_NAST = NAST
PI_COUNTRY = IS_DLV-LAND
PI_ADDR_KEY = IS_ADDR_KEY
PI_REPID = LF_REPID
PI_SCREEN = XSCREEN
IMPORTING
PE_RETURNCODE = RET
PE_ITCPO = LS_ITCPO
PE_DEVICE = LF_DEVICE
PE_RECIPIENT = CS_RECIPIENT
PE_SENDER = CS_SENDER.
IF RET = 0.
MOVE-CORRESPONDING LS_ITCPO TO CS_COMPOSER_PARAM.
* CS_CONTROL_PARAM-NO_OPEN
* CS_CONTROL_PARAM-NO_CLOSE
CS_CONTROL_PARAM-DEVICE = LF_DEVICE.
CS_CONTROL_PARAM-NO_DIALOG = 'X'.
CS_CONTROL_PARAM-PREVIEW = XSCREEN.
CS_CONTROL_PARAM-GETOTF = LS_ITCPO-TDGETOTF.
CS_CONTROL_PARAM-LANGU = NAST-SPRAS.
* CS_CONTROL_PARAM-REPLANGU1
* CS_CONTROL_PARAM-REPLANGU2
* CS_CONTROL_PARAM-REPLANGU3
* CS_CONTROL_PARAM-STARTPAGE
ENDIF.
ENDFORM.
after this i am calling smart form with all the required parameters.
CALL FUNCTION gv_function
EXPORTING
control_parameters = ls_control_param
output_options = ls_composer_param
archive_index = toa_dara
archive_parameters = arc_params
mail_recipient = ls_recipient
mail_sender = ls_sender
user_settings = space
IMPORTING
JOB_OUTPUT_INFO = ls_job_info
TABLES
zmm_purord_at = zmm_purord_at
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
i am not getting any mail to the desired mail id.
Any pointers to this would be highly appreciated.
Regards,
Sreekanth -
Send Smart Forms within emails (html) Problems with format
Dear all,
the ABAP report SF_XSF_DEMO1 is a demo report which converts a certain smart form into HTML and then sends it as an email in html format.
Sending the email is possible without any problems but I am wondering about the email format.
<a href="http://www.imgbox.de/show/img/e4QvgzsS4L.jpg" title="Bilder hochladen">This screenshot shows how the email looks like.</a>
I am not happy with the email layout as the Smart Form "SF_XSF_DEMO1" is designed in a different way.
What do I have to adapt within the report in order to send an email that really looks like the Smart Form? Or is it a customizing issue?
(I would like to avoid having to send the Smart Form as PDF attachment...)
Thanks for you help!
Kristian KindlerHi Kristian,
When ever you send a smartform output as an HTML email, the system generates automatic style sheets which are not supported in many email clients such as Outlook 2007, hence you will face a formatting issue. We faced the same issue and had do it it like this:
Build a BSP page similar to the output which you want to send as an email. Now you can use the BSP URL to send the html email using cl_bcs class.
I have documented this in my article below-
http://divulgesap.com/blog.php?p=NDA=
Hope it helps.
Regards,
Ravikiran -
Hi,
We are working on WebAS 6.20.
We are trying to send a smart form directly to a fax machine.
We have SAPConnect configured and are using the SMTP server to communicate to the fax machine.
I want to know what fax server needs to be installed and how to complete the process to send a fax through SAP.
If any one has any inputs in this regard, I would really appreciate it if you could share it in the group.
Regards
Maninder SawhneyHi Maninder,
You may get some help from here.
http://help.sap.com/saphelp_nw04/helpdata/en/af/73563c1e734f0fe10000000a114084/frameset.htm
Thanks
Vinod -
How to send smart form as mail?
Hello everybody,
I have used the following code to send a smartform in PDF format through email.
I m able to view the contents of the mail in SAP Bussiness Workplace but UNABLE TO TRANSFER THE MAIL to an INTERNET ID (like gmail id or yahoo id).
Can anybody suggest me about what might have gone wrong?
Helpful answers will surely be rewarded.
code
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
wa_objhead TYPE soli_tab,
w_ctrlop TYPE ssfctrlop,
w_compop TYPE ssfcompop,
w_return TYPE ssfcrescl,
wa_doc_chng TYPE sodocchgi1,
w_data TYPE sodocchgi1,
wa_buffer TYPE string,"To convert from 132 to 255
Variables declarations
*v_form_name TYPE rs38l_fnam, " L_FM_NAME
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.
DATA: l_fm_name TYPE rs38l_fnam.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = p_l_formname
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
fm_name = l_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.
IF g_it3 = 'M'.
g_it3 = 'Mr'.
ENDIF.
IF g_it3 = 'F'.
g_it3 = 'Ms'.
ENDIF.
CALL FUNCTION l_fm_name
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS =
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS =
USER_SETTINGS = 'X'
it = g_it
it1 = g_it1
it3 = g_it3
it4 = g_it4
it5 = g_it5
it6 = g_it6
it7 = g_it7
it8 = g_it8
it10 = g_it10
it14 = g_it14
it15 = g_it15
it36 = g_it36
it18 = g_it18
it37 = g_it37
it19 = g_it19
it9 = g_it9
it11 = g_it11
it13 = g_it13
it39 = g_it39
it40 = g_it40
it20 = g_it20
it21 = g_it21
it22 = g_it22
it23 = g_it23
it25 = g_it25
it26 = g_it26
it27 = g_it27
it28 = g_it28
it29 = g_it29
it30 = g_it30
it31 = g_it31
it32 = g_it32
it33 = g_it33
total = g_total
it34 = g_it34
it35 = g_it35
it2 = pa0006-begda
it12 = pa0001-begda
it16 = pa0015-begda
it17 = pa0001-endda
it24 = pa0002-endda
it38 = pa0002-begda
IMPORTING
DOCUMENT_OUTPUT_INFO =
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.
g_semail = 'X'.
IF g_semail = 'X'.
w_ctrlop-getotf = 'X'.
w_ctrlop-no_dialog = 'X'.
w_compop-tdnoprev = 'X'.
CALL FUNCTION l_fm_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
otf = i_otf
lines = i_tline
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 wa_buffer i_tline INTO wa_buffer.
ENDLOOP.
*Repalacing '~' by space.
TRANSLATE wa_buffer USING '~'.
DO.
i_record = wa_buffer.
*Appending 255 characters as a record.
APPEND i_record.
SHIFT wa_buffer LEFT BY 255 PLACES.
IF wa_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
Attachment
REFRESH:
i_reclist,
i_objtxt,
i_objbin,
i_objpack.
CLEAR wa_objhead.
*Object with PDF.
i_objbin[] = i_record[].
DESCRIBE TABLE i_objbin LINES v_lines_bin.
Create Message Body
Title and Description
*Object with main text of the mail.
i_objtxt = 'Find attached the output of the smartform'.
APPEND i_objtxt.
i_objtxt = 'Regards'.
APPEND i_objtxt.
i_objtxt = 'Lokesh'.
APPEND i_objtxt.
DESCRIBE TABLE i_objtxt LINES v_lines_txt.
READ TABLE i_objtxt INDEX v_lines_txt.
*Document information.
wa_doc_chng-obj_name = 'Offer Letter'.
wa_doc_chng-expiry_dat = sy-datum + 10.
wa_doc_chng-obj_descr = 'Offer Letter'.
wa_doc_chng-sensitivty = 'F'.
wa_doc_chng-doc_size = v_lines_txt * 255.
Main Text
*Pack to main body as RAW.
*Object to be transported not in binary form.
wa_doc_chng-doc_size = ( v_lines_txt - 1 ) * 255 + STRLEN( i_objtxt ).
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.
Attachment
(pdf-Attachment)
*Packing as PDF
i_objpack-transf_bin = 'X'.
i_objpack-head_start = 1.
i_objpack-head_num = 1.
i_objpack-body_start = 1.
Länge des Attachment ermitteln
DESCRIBE TABLE i_objbin LINES v_lines_bin.
READ TABLE i_objbin INDEX v_lines_bin.
i_objpack-doc_size = v_lines_bin * 255 .
i_objpack-body_num = v_lines_bin.
i_objpack-doc_type = 'PDF'.
i_objpack-obj_name = 'smart'.
i_objpack-obj_descr = 'test'.
APPEND i_objpack.
CLEAR i_reclist.
i_reclist-receiver = '[email protected]'.
i_reclist-express = 'X'.
i_reclist-rec_type = 'U'.
APPEND i_reclist.
*CALL FUNCTION 'LXE_SEND_MAIL_ATTMNT'
EXPORTING
description =
SENSITIVITY = 'O'
IN_OUTBOX = ' '
tables
receivers =
document_text =
DOCUMENT_ATTMNT =
DOCUMENT_ATTMNT_ATTR =
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
NO_AUTHORIZATION = 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 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = wa_doc_chng
put_in_outbox = 'X'
TABLES
packing_list = i_objpack
object_header = wa_objhead
contents_bin = 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.
ELSE.
MESSAGE 'success' TYPE 'I'.
ENDIF.
ENDIF.
ENDFORM. " GET_OFFER_LETTERHere is the code to send the Smartform to mail as PDF attachment.
*& Report ZTEST_PDF_MAIL
REPORT ZTEST_PDF_MAIL.
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
WA_OBJHEAD TYPE SOLI_TAB,
W_CTRLOP TYPE SSFCTRLOP,
W_COMPOP TYPE SSFCOMPOP,
W_RETURN TYPE SSFCRESCL,
WA_DOC_CHNG TYPE SODOCCHGI1,
W_DATA TYPE SODOCCHGI1,
WA_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 = 'ZTEST'
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.
ENDIF.
LOOP AT I_TLINE.
TRANSLATE I_TLINE USING '~'.
CONCATENATE WA_BUFFER I_TLINE INTO WA_BUFFER.
ENDLOOP.
TRANSLATE WA_BUFFER USING '~'.
DO.
I_RECORD = WA_BUFFER.
APPEND I_RECORD.
SHIFT WA_BUFFER LEFT BY 255 PLACES.
IF WA_BUFFER IS INITIAL.
EXIT.
ENDIF.
ENDDO.
Attachment
REFRESH: I_RECLIST,
I_OBJTXT,
I_OBJBIN,
I_OBJPACK.
CLEAR WA_OBJHEAD.
I_OBJBIN[] = I_RECORD[].
Create Message Body Title and Description
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 = 'smartform'.
WA_DOC_CHNG-EXPIRY_DAT = SY-DATUM + 10.
WA_DOC_CHNG-OBJ_DESCR = 'smartform'.
WA_DOC_CHNG-SENSITIVTY = 'F'.
WA_DOC_CHNG-DOC_SIZE = V_LINES_TXT * 255.
Main Text
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.
Attachment (pdf-Attachment)
I_OBJPACK-TRANSF_BIN = 'X'.
I_OBJPACK-HEAD_START = 1.
I_OBJPACK-HEAD_NUM = 0.
I_OBJPACK-BODY_START = 1.
DESCRIBE TABLE I_OBJBIN LINES V_LINES_BIN.
READ TABLE I_OBJBIN INDEX V_LINES_BIN.
I_OBJPACK-DOC_SIZE = V_LINES_BIN * 255 .
I_OBJPACK-BODY_NUM = V_LINES_BIN.
I_OBJPACK-DOC_TYPE = 'PDF'.
I_OBJPACK-OBJ_NAME = 'smart'.
I_OBJPACK-OBJ_DESCR = 'test'.
APPEND I_OBJPACK.
CLEAR I_RECLIST.
I_RECLIST-RECEIVER = '[email protected]'.
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 = WA_OBJHEAD
CONTENTS_BIN = 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.
WRITE:/ 'Error When Sending the File', SY-SUBRC.
ELSE.
WRITE:/ 'Mail sent'.
ENDIF.
If you want to send some text as Body of the Mail then follow this once
when u r callin the FM'SO_NEW_DOCUMENT_ATT_SEND_API1'.. points to remember
1.u have to pass the body of content in table CONTENTS_TXT(ia m using I_OBJBIN) (each line a record) then. suppose i have appended 11 records to the table CONTENTS_TXT .
2.PACKING_LIST(iam usign I_OBJPACK) table u ahve to append a redord as follows
I_OBJPACK-TRANSF_BIN = ' '.
I_OBJPACK-HEAD_START = 000000000000001.
I_OBJPACK-HEAD_NUM = 000000000000001.
I_OBJPACK-BODY_START = 000000000000002
I_OBJPACK-BODY_NUM = 000000000000010.
I_OBJPACK-DOC_TYPE = 'RAW'.
append I_OBJPACK-.
by the above code system treat the first line in table I_OBJBIN as header and the 2nd line to 10 lines tread as body.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = WA_DOC_CHNG
PUT_IN_OUTBOX = 'X'
TABLES
PACKING_LIST = I_OBJPACK
OBJECT_HEADER = WA_OBJHEAD
CONTENTS_BIN = 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.
regards,
srinivas -
Sending Smart forms O/P as an attachment thru e-mail...
Hi friends...
I have dveloped a new Smartform for PO reminder letter..
and I am trying to send it as an attachment thru mail...
the code I wrote for that is given...
but I am getting a runtime error like
In program "CL_TRACE_BCS==================CP ", the following syntax error
occurred
in the Include "CL_TRACE_BCS==================CU " in line 85:
"Implementation missing for method "END_FUNC". "END_FUNC"."
Plz help me....
*******CODE********
REPORT zmm_vendor_reminder_mail.
TABLES : ekko,ekpo,eket,makt,adrc,adr6,lfa1.
DATA: fm_name TYPE rs38l_fnam.
DATA: BEGIN OF itab1 OCCURS 0.
INCLUDE STRUCTURE lfa1.
DATA: END OF itab1.
DATA : BEGIN OF itab OCCURS 0.
INCLUDE STRUCTURE zmm_podetails.
DATA: END OF itab.
DATA : BEGIN OF it_pos OCCURS 0 ,
bukrs LIKE ekpo-bukrs,
werks LIKE ekpo-werks,
ebeln LIKE eket-ebeln,
ebelp LIKE eket-ebelp,
etenr LIKE eket-etenr,
bedat LIKE eket-bedat,
matnr LIKE ekpo-matnr,
meins LIKE ekpo-meins,
menge LIKE eket-menge,
wemng LIKE eket-wemng,
eindt LIKE eket-eindt,
lifnr LIKE ekko-lifnr,
END OF it_pos.
DATA : BEGIN OF it_vendor OCCURS 0 ,
lifnr LIKE lfa1-lifnr,
name1 LIKE adrc-name1,
street LIKE adrc-street,
str_suppl1 LIKE adrc-str_suppl1,
str_suppl2 LIKE adrc-str_suppl2,
city1 LIKE adrc-city1,
post_code1 LIKE adrc-post_code1,
smtp_addr LIKE adr6-smtp_addr,
adrnr LIKE lfa1-adrnr,
telf1 LIKE lfa1-telf1,
telf2 LIKE lfa1-telf2,
END OF it_vendor.
*RAMESH **********
tables: soud.
data: control_parameters TYPE ssfctrlop,
output_options TYPE ssfcompop,
EMail_Subject(50) TYPE c value 'abc'.
DATA: email_recipient TYPE SWOTOBJID,
email_sender TYPE SWOTOBJID,
g_mail_app_obj type SWOTOBJID.
*concatenate text-004 '400000124' into EMail_Subject.
control_parameters-device = 'MAIL'.
control_parameters-no_dialog = 'X'.
control_parameters-preview = space.
output_options-tdnewid = 'X'.
output_options-tdtitle = EMail_Subject.
SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_bukrs FOR ekpo-bukrs,
s_werks FOR ekpo-werks,
s_ekgrp FOR ekko-ekgrp,
s_lifnr FOR ekko-lifnr,
s_ebeln FOR ekko-ebeln,
s_eindt FOR eket-eindt,
s_mtart FOR ekpo-mtart,
s_matkl FOR ekpo-matkl,
s_matnr FOR ekpo-matnr.
SELECTION-SCREEN : END OF BLOCK b1.
PERFORM mail_recipient_object.
PERFORM mail_sender_object.
PERFORM mail_appl_object changing g_mail_app_obj.
*RAMESH **********
*******************************SELECTION-SCREEN************
AT SELECTION-SCREEN.
Validate test for Plant in selections
LOOP AT s_werks.
IF NOT s_werks-high IS INITIAL.
SELECT SINGLE * FROM ekpo
WHERE werks = s_werks-high.
IF sy-subrc NE 0.
MESSAGE e600(fr) WITH 'This Plant'
s_werks-high ' does not exist.'
ENDIF.
ENDIF.
IF NOT s_werks-low IS INITIAL.
SELECT SINGLE * FROM ekpo
WHERE werks = s_werks-low.
IF sy-subrc NE 0.
MESSAGE e600(fr) WITH 'This Plant'
s_werks-low ' does not exist.'
ENDIF.
ENDIF.
ENDLOOP.
START-OF-SELECTION.
PERFORM get_data.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZMM_VENDOR_REMINDER_MAIL'
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
fm_name = fm_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
IF sy-subrc <> 0.
WRITE: / 'ERROR 1'.
ENDIF.
CALL FUNCTION fm_name
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS = control_parameters
MAIL_APPL_OBJ = g_mail_app_obj
MAIL_RECIPIENT = email_recipient
MAIL_SENDER = email_sender
OUTPUT_OPTIONS = output_options
USER_SETTINGS = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO =
JOB_OUTPUT_OPTIONS =
TABLES
itab1 = itab1
itab = itab
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.
*& Form get_data
text
FORM get_data.
SELECT a~bukrs a~werks a~ebeln a~ebelp
b~bedat a~matnr a~meins b~menge
b~wemng b~eindt c~lifnr b~etenr
FROM ekpo AS a
INNER JOIN eket AS b
ON a~ebeln = b~ebeln AND
a~ebelp = b~ebelp
INNER JOIN ekko AS c
ON a~ebeln = c~ebeln AND
a~bukrs = c~bukrs
INTO CORRESPONDING FIELDS OF TABLE it_pos
WHERE a~bukrs IN s_bukrs
AND a~werks IN s_werks
AND b~eindt IN s_eindt
AND c~lifnr IN s_lifnr
AND c~ekgrp IN s_ekgrp
AND c~ebeln IN s_ebeln
AND a~mtart IN s_mtart
AND a~matkl IN s_matkl
AND a~matnr IN s_matnr
AND c~bstyp EQ 'F'
AND c~loekz EQ space
AND a~loekz EQ space
AND b~menge > b~wemng.
SELECT DISTINCT a~lifnr b~name1 b~street b~str_suppl1 b~str_suppl2
b~city1 b~post_code1 a~adrnr a~telf1 a~telf2
FROM lfa1 AS a
INNER JOIN adrc AS b
ON a~adrnr = b~addrnumber
INTO CORRESPONDING FIELDS OF TABLE it_vendor
FOR ALL ENTRIES IN it_pos
WHERE a~lifnr = it_pos-lifnr.
LOOP AT it_vendor.
SELECT SINGLE * FROM adr6
WHERE addrnumber = it_vendor-adrnr
AND persnumber EQ space.
IF sy-subrc = 0.
it_vendor-smtp_addr = adr6-smtp_addr.
ENDIF.
MODIFY it_vendor.
SELECT SINGLE * FROM lfa1
WHERE lifnr = it_vendor-lifnr.
IF sy-subrc EQ 0.
MOVE-CORRESPONDING lfa1 TO itab1.
APPEND itab1.
ENDIF.
ENDLOOP.
LOOP AT it_pos.
itab-bukrs = it_pos-bukrs.
itab-ebeln = it_pos-ebeln.
itab-ebelp = it_pos-ebelp.
itab-matnr = it_pos-matnr.
itab-bedat = it_pos-bedat.
itab-meins = it_pos-meins.
itab-eindt = it_pos-eindt.
itab-lifnr = it_pos-lifnr.
itab-etenr = it_pos-etenr.
APPEND itab.
CLEAR itab.
ENDLOOP.
ENDFORM. "get_data
*& Form mail_recipient_object
text
--> p1 text
<-- p2 text
form mail_recipient_object .
data: email_address TYPE SO_NAME.
email_address = '[email protected]'.
CALL FUNCTION 'CREATE_RECIPIENT_OBJ_PPF'
EXPORTING
IP_COUNTRY =
IP_FAXNO =
IP_MAILADDR = email_address
IP_TYPE_ID = 'U'
IMPORTING
EP_RECIPIENT_ID = email_recipient
EP_ADDRESS =
ET_RECIPIENT =
EXCEPTIONS
INVALID_RECIPIENT = 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. " mail_recipient_object
*& Form mail_sender_object
text
--> p1 text
<-- p2 text
form mail_sender_object .
CALL FUNCTION 'CREATE_SENDER_OBJECT_PPF'
EXPORTING
IP_SENDER = sy-uname
IMPORTING
EP_SENDER_ID = email_sender
EXCEPTIONS
INVALID_SENDER = 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. " mail_sender_object
*& Form mail_appl_object
text
<--P_G_MAIL_APP_OBJ text
form mail_appl_object changing p_g_mail_app_obj.
include <cntn01>.
DATA: FOLDER TYPE swc_object,
BEGIN OF SOFMFOL_KEY,
FOLDERTYPE LIKE SOFM-FOLTP,
FOLDERYEAR LIKE SOFM-FOLYR,
FOLDERNUMBER LIKE SOFM-FOLNO,
TYPE LIKE SOFM-DOCTP,
YEAR LIKE SOFM-DOCYR,
NUMBER LIKE SOFM-DOCNO,
FORWARDER LIKE SOUB-USRNAM,
END OF SOFMFOL_KEY,
BOR_KEY LIKE SWOTOBJID-OBJKEY.
SELECT single * FROM soud WHERE sapnam LIKE sy-uname AND deleted = ' '.
IF sy-subrc NE 0.
CALL FUNCTION 'SO_USER_AUTOMATIC_INSERT'
EXPORTING
SAPNAME = SY-UNAME
SO_KEY = ' '
SEND_MAIL_IF_NO_ADDRESS = 'X'
IMPORTING
USRADR =
EXCEPTIONS
NO_INSERT = 1
SAP_NAME_EXIST = 2
X_ERROR = 3
SAP_NAME_NOT_EXIST = 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.
clear sofmfol_key.
sofmfol_key-type = 'FOL'.
sofmfol_key-year = soud-inbyr.
sofmfol_key-number = soud-inbno.
bor_key = sofmfol_key.
IF not bor_key is initial.
swc_create_object folder 'SOFMFOL' bor_key.
IF sy-subrc = 0.
swc_object_to_persistent folder g_mail_app_obj.
IF sy-subrc ne 0.
clear g_mail_app_obj.
ENDIF.
ENDIF.
ELSE.
clear g_mail_app_obj.
ENDIF.
endform. " mail_appl_objectHi Ramesh
Just checkout the FORM interface whether you are passing the proper parameters or not. Also, check their datatypes....
I couldnot find any error in your code by seeing it....
Regards -
Dear all
When the document is Printed 2 Messages will be created:
- First, will send the document to the Printer
- Second, we need to convert the message to PDF and to send this message to a specified Folder that is located in a different server.
At this point my problem is who to configured the Scot transaction to send the message to the folder.
Best Regards.
Thanks in advancedHi
You should set two different output devices for those two message.
- First: a normal printer;
- Second: ZPDF device.
Infact it's possible to create a ZPDF device that convert automatically the spool in pdf format and save the file in a certain folder.
If you want I can send to you a little document to create that particula PDF device, but it's written in Italian.
Anayway that document is based on these notes:
161516, 576973, 17054, 437696, 317851, 6753.
Max -
Send report output to SPOOL only, but do not print
It looks like I'm almost there, just one more issue to solve We had a report with ALV output to the screen. The customer requested that we make this report available to run in batch, with its output sent to the spool.
What I've done now is create a wrapper program that calls GET_PRINT_PARAMETERS with parameters to suppress the dialog and retain the spool job (release parameter is empty) after completion.
When the 'valid' flag is x'ed, submits the original report like this:
SUBMIT zcheck_nsn_hers TO SAP-SPOOL
SPOOL PARAMETERS print_parameters
ARCHIVE PARAMETERS archi_parameters
WITHOUT SPOOL DYNPRO.
However when I execute the wrapper report, I still get a popup to print the job. Afterwards, the spool request remains and can be viewed (perfect!). Now all I want to do is make sure that SAP does not try to print it immediately.
Is that something that I can control from the program, or could this be in the settings for the spool (i.e. automatically print when a job arrives)?
Thanks in advance!Hi,
In FM GET_PRINT_PARAMETERS pass space to IMMEDIATELY
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
destination = 'Dest'
list_name = 'name'
immediately = ' '
no_dialog = 'X'
IMPORTING
out_parameters = print_parameters
valid = valid_flag.
Regards,
Srini. -
Default settings for sending smart forms via mail saving it in pdf
do we have to do any default settings in any trasaction code like scot for solving the above problem
hi thanku very much durga prasad
my mail id is [email protected] -
Smart Forms Shading on only Totals Part
Hi Friends,
I am working on smartforms. My requirement is after completing of the all line items, i ned to disply Totals. Now it is displaying. But i need Boxes and shading for the total part.
Can anybody pls help me how we get it.
Points will reward for solution.
Thanks,
Srinivas.Hi Srinivas,
Create an table contral and then select indivudual cells (Cell which you want to color) and give shading and boxes. And also totals should be in saparate window but not in main....Thats it
Enjoyee!! SAP
Sivaram -
Single Spool for multiple smart forms
Hi,
I am doing Cheque Printing My multiple smart form in single spool
I Created Single spool for multiple smartforms and i can able to see all the smart forms in single spool
While I am printing smart form from spool it is taking only first page.
Any inputs how to slove this.
Regards
Azeez
Edited by: Rasheed salman on Feb 3, 2010 7:41 AMHi,
You can call Open Spool and Close Spool function modules. Between these two fm you can call your smartforms. Just have a look the procedure below.
Call function OPEN_SPOOL.
Call function SM1
Call function SM2
Call function SM3
Call function CLOSE_SPOOL.
Hope this will resolve your issue.
Thanks,
Abhijit -
Smart Form + Disble POP UP ?? How
when we r using smartforms in our programs, in execution pop-up comes(to enter printer name(LP01/LOCL), etc) , how to disable that pop-up ??? i want direct print preview of report?
i am passing this parameters , but i am not able to achive,,
wa_control_parameters-no_dialog = 'X'.
wa_control_parameters-preview = ' '.
wa_control_parameters-no_open = 'X'.
wa_control_parameters-no_close = 'X'.
wa_control_parameters-device = 'PRINTER'.
wa_output_options-tdarmod = '3'.
wa_output_options-tdnoprev = 'X'.
wa_output_options-tddest = 'LOCL'.
wa_output_options-tdnoarch = ' '.
wa_output_options-bcs_langu = sy-langu.
CALL FUNCTION fname
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
control_parameters = wa_control_parameters
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
output_options = wa_output_options
pls help me!!!
Regards,
Ramesh.Try this code
Smart form to spool
REPORT zgspool .
TYPES : BEGIN OF ty_itab,
kunnr TYPE kna1-kunnr,
name1 TYPE kna1-name1,
land1 TYPE kna1-land1,
END OF ty_itab.
DATA : binfilesize TYPE i,
file_name TYPE string,
file_path TYPE string,
full_path TYPE string,
line(5).
DATA : struct TYPE itcpo.
DATA : gt_itab TYPE STANDARD TABLE OF ty_itab,
wa_itab LIKE LINE OF gt_itab.
*---Start Get Spool IDs
DATA : BEGIN OF ty_tab,
rqident TYPE tsp01-rqident,
rqdoctype TYPE tsp01-rqdoctype,
END OF ty_tab.
DATA : gt_tab LIKE STANDARD TABLE OF ty_tab,
wa_tab LIKE LINE OF gt_tab,
itab_pdf LIKE tline OCCURS 0 WITH HEADER LINE,
w_bytecount TYPE i.
*---end Get Spool IDs
*struct-TDPREVIEW = 'X'.
struct-tdnewid = 'X'.
struct-tddest = 'LP01'.
*calling layout script from abap/4
CALL FUNCTION 'OPEN_FORM'
EXPORTING
form = 'YFORM'
language = 'E'
device = 'PRINTER'
options = struct
dialog = 'X'
EXCEPTIONS
form = 5.
CALL FUNCTION 'START_FORM'
EXPORTING
form = 'YFORM'
language = 'E'
startpage = 'FIRST'.
SELECT kunnr name1 land1 FROM kna1 INTO TABLE gt_itab
UP TO 10 ROWS.
LOOP AT gt_itab INTO wa_itab.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
window = 'MAIN'
type = 'BODY'
element = 'ABAP'.
ENDLOOP.
CALL FUNCTION 'END_FORM'.
CALL FUNCTION 'CLOSE_FORM'.
COMMIT WORK.
IF sy-ucomm = 'PRNT'.
*----Get the Spool Number
*wait up to 3 seconds.
REFRESH gt_tab.
CLEAR wa_tab.
SELECT rqident rqdoctype INTO TABLE gt_tab
FROM tsp01
WHERE rqowner = sy-uname.
IF sy-subrc = 0.
SORT gt_tab BY rqident rqdoctype.
DESCRIBE TABLE gt_tab LINES line.
*----Read Recent Spool Number only.
READ TABLE gt_tab INTO wa_tab INDEX line.
IF wa_tab-rqdoctype = 'LIST'.
PERFORM get_abap_spool_in_pdf.
ELSEIF wa_tab-rqdoctype = 'OTF'.
PERFORM get_otf_spool_in_pdf.
ENDIF.
PERFORM write_pdf_spool_to_pc.
DATA : var(100).
DATA : var1(5).
MOVE wa_tab-rqident TO var1.
CONCATENATE 'SPOOL WITH NUMBER' var1 'GENERATED' INTO var SEPARATED BY
space.
MESSAGE i124(0) WITH var .
ENDIF.
ENDIF.
*& Form get_abap_spool_in_pdf
text
--> p1 text
<-- p2 text
FORM get_abap_spool_in_pdf .
REFRESH itab_pdf.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = wa_tab-rqident
IMPORTING
pdf_bytecount = w_bytecount
TABLES
pdf = itab_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
OTHERS = 12.
IF sy-subrc NE 0.
MESSAGE e398(00) WITH 'Cannot convert to PDF. Error =' sy-subrc.
ENDIF.
ENDFORM. " get_abap_spool_in_pdf
*& Form get_otf_spool_in_pdf
text
--> p1 text
<-- p2 text
FORM get_otf_spool_in_pdf .
REFRESH itab_pdf.
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = wa_tab-rqident
IMPORTING
pdf_bytecount = w_bytecount
TABLES
pdf = itab_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
OTHERS = 12.
IF sy-subrc <> 0.
MESSAGE e398(00) WITH 'Cannot convert to PDF. Error =' sy-subrc.
ENDIF.
ENDFORM. " get_otf_spool_in_pdf
*& Form write_pdf_spool_to_pc
text
--> p1 text
<-- p2 text
FORM write_pdf_spool_to_pc .
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 PDF DATA***
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = binfilesize
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'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
IMPORTING
FILELENGTH =
TABLES
data_tab = itab_pdf
FIELDNAMES =
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " write_pdf_spool_to_pc
reward if useful.... -
Issue in printing second page in smart form
in my smart form i have only FIRST page in tht i have pur order numberwindow, date window and all the item details in mainwindow. my problem is in my page 1 order number and date are getting printed at the exact position whre i want but when it is coming to the next page that is page 2 order number and date are going out of scope. I cant even change the position of those two windows as it is getting printed properly on 1st page.
Copy the first page and paste so as to create a second page, now give next page as this second page, and check, if there is any layout issue then make changes in this page, be careful as if you make any any changes, such as deleting some table or template or window in the copied [page it will get deleted in first page to, so only make changes to layout.
Maybe you are looking for
-
How do you change the keyboard so that it types the words for you
How do you change the keyboard to show the words that you might be typing? I had it when I first updated but somehow I changed it>
-
Virtual Cluster Does Not Show Up In Compressor
I have a clean install of Leopard and FCS2. All the updates completed and everything is running beautifully except that the Virtual Cluster I setup in Qmaster does not show up in Compressor as an option when submitting. The virtual cluster with 4 ins
-
From where do we see OSS notes and message errors...
hi, From where do we see OSS notes and message errors details if the error number is provided?? Thanks & Regards
-
Editing a slide DURING presentation
Hello, I am wondering whether editing a slide while presenting it on the second monitor is possible. This would be great for brainstorming ideas (eg. fill a table with ideas on several issues, according to the audience's feedback). I tired several ti
-
Hi, What is the significance of the maintaining the source system IDs? Thanks