Trigger print action in ICWC, then display Smartform in PDF
Hi All,
We have the 'Print' action configured in CRM 5.0.
Upon triggering the 'Print' action in ICWC, I'd like the smartform be displayed in a new window in PDF format allowing user to print/save the PDF.
Any idea how can this be done? Thanks
Hi,
Have a look at this <a href="/people/sap.user72/blog/2004/11/10/bsphowto-generate-pdf-output-from-a-bsp
Regards,
Patrick.
Similar Messages
-
In R/3 display smartform as pdf in a custom container
Hello,
I want to display smartform as pdf in a custom contianer . I was able to find all the right code from sdn.
but my problem is that when executed my sap gui is closed without any error.
I am unable to understand what is going wrong.
CALL METHOD G_HTML_CONTROL->SHOW_URL( URL = LV_URL
IN_PLACE = 'X' ). does not show the pdf.
Can any one help me to find out if we need to do some setting for MIME type application/pdf. Because I tried to display a bar chart in the custom container of MIME type text/html , and this is working fine.
Is any setting missing in our R/3 because of which the code is not getting executed.
below code is the exact copy from a post in sdn:
report ztest_pdf.
DATA: LT_PDF TYPE TABLE OF TLINE,
LS_PDF LIKE LINE OF LT_PDF,
LV_URL TYPE CHAR255,
PDF_FSIZE TYPE I,
LV_CONTENT TYPE XSTRING,
LT_DATA TYPE STANDARD TABLE OF X255.
DATA : L_JOB_OUTPUT_INFO TYPE SSFCRESCL.
DATA : LS_CONTROL_PARAM TYPE SSFCTRLOP.
DATA : G_HTML_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
G_HTML_CONTROL TYPE REF TO CL_GUI_HTML_VIEWER.
* pdf_control type ref to cl_gui_pdfviewer.
DATA : P_VBELN TYPE VBELN_VL.
DATA : i_html TYPE w3htmltabtype.
", g_url TYPE w3url
FIELD-SYMBOLS <FS_X> TYPE X.
INITIALIZATION.
LS_CONTROL_PARAM-GETOTF = 'X'.
LS_CONTROL_PARAM-NO_DIALOG = 'X'.
START-OF-SELECTION.
CALL FUNCTION '/1BCDWB/SF00000298'
EXPORTING
* ARCHIVE_INDEX =
* ARCHIVE_INDEX_TAB =
* ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS = LS_CONTROL_PARAM
* P_VBELN = P_VBELN
* MAIL_APPL_OBJ =
* MAIL_RECIPIENT =
* MAIL_SENDER =
* OUTPUT_OPTIONS =
* USER_SETTINGS = 'X'
IMPORTING
* DOCUMENT_OUTPUT_INFO = L_DOCUMENT_OUTPUT_INFO
JOB_OUTPUT_INFO = L_JOB_OUTPUT_INFO
* JOB_OUTPUT_OPTIONS = L_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.
data pdfxstring type xstring.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
IMPORTING
BIN_FILESIZE = PDF_FSIZE
bin_file = pdfxstring
TABLES
OTF = L_JOB_OUTPUT_INFO-OTFDATA
LINES = LT_PDF
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
OTHERS = 4.
CALL SCREEN 100.
module STATUS_0100 output.
* SET PF-STATUS 'xxxxxxxx'.
* SET TITLEBAR 'xxx'.
CREATE OBJECT G_HTML_CONTAINER
EXPORTING
CONTAINER_NAME = 'PDF'.
CREATE OBJECT G_HTML_CONTROL
EXPORTING
PARENT = G_HTML_CONTAINER.
* Convert xstring to binary table to pass to the LOAD_DATA method
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
BUFFER = pdfxstring"LV_CONTENT
TABLES
BINARY_TAB = LT_DATA.
* PERFORM bar_chart .
* Load the HTML
CALL METHOD G_HTML_CONTROL->LOAD_DATA(
EXPORTING
TYPE = 'application' "'text' " 'application'
SUBTYPE = 'pdf' "'html' "'pdf'
IMPORTING
ASSIGNED_URL = lv_URL
CHANGING
DATA_TABLE = LT_DATA "i_html "LT_DATA
EXCEPTIONS
DP_INVALID_PARAMETER = 1
DP_ERROR_GENERAL = 2
CNTL_ERROR = 3
OTHERS = 4 ).
* Show it
CALL METHOD G_HTML_CONTROL->SHOW_URL( URL = LV_URL
IN_PLACE = 'X' ).
Thanks,
Jaya.
Edited by: kishan P on Jun 9, 2011 1:40 PMHello Sandra,
Thanks for your reply, but eventhen it fails to load the pdf. Is ADS required to be installed for this?
Can I just pass the pdf_fsize imported from CONVERT_OTF which is of type i.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
IMPORTING
BIN_FILESIZE = PDF_FSIZE
bin_file = pdfxstring
TABLES
OTF = L_JOB_OUTPUT_INFO-OTFDATA
LINES = LT_PDF
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
OTHERS = 4.
CALL METHOD G_HTML_CONTROL->LOAD_DATA(
EXPORTING
TYPE = 'application' "'text' " 'application'
SUBTYPE = 'pdf' "'html' "'pdf'
size = PDF_FSIZE
IMPORTING
ASSIGNED_URL = lv_URL
CHANGING
DATA_TABLE = LT_DATA "i_html "LT_DATA
EXCEPTIONS
DP_INVALID_PARAMETER = 1
DP_ERROR_GENERAL = 2
CNTL_ERROR = 3
OTHERS = 4 ).
Thanks,
Jaya. -
Problem in displaying smartform as pdf in portal
Hi all,
We created a smartform and we are displaying as a pdf in portal.Everything is fine and pdf is coming.But there is arabic data in the form .
Some of the arabic data is coming perfectly.
But some data is coming in Japanese or chinese and some data is coming like
F,D'! 9(/'D1-EF (F 5'D- 'D3JA 叉â
Department 'D%/'1) 'D9'E) DDEH'1/ 'D(41J).
Please let me know what could be the problem.
Thanks and Regards,
Rajeshhi Rajesh.....
Could you explain me how 2 display SMARTFORM as PDF in portal..... please.....
I have the requirement as follows.....
By pressing a button the smartform must be generated.....
SO what must be the RFC o/p from ABAP.... I am ABAPER basically
and what the portal guys must do.....
pleaseeee -
How to display smartform as PDF in web dynpro java
Hi,
Where can I find sample program to display smartform as PDF in web dynpro java.
Thanks.
Regards,
Henry1. Create a smart form in the R/3 side
2. Now create a function module with the corresponding export parameter:
3. Make sure that the function module is marked remote enabled.
4. In NWDS create an Adaptive RFC model which points to the FM created in R/3 under the webdynpro application
5. Now create an application and view inside it to display the PDF and Insert a frame inside the view
6. Create a value node and an attribute say url of type string inside that node and bind it to the source
7. In the doInit() method place the following code
> ZTest_Pdf_1_Input input = new ZTest_Pdf_Input();
> wdContext.nodeZTest_Pdf_Input().bind(input);
> try {
> wdContext.currentZTest_Pdf_InputElement().modelObject().execute();
> }
> catch (Exception e) {
> e.printStackTrace();
> }
> wdContext.currentInternalElement().setUrl(convert(wdContext.currentOutputElement().getBin_File()));
Inside that view create a method to convert the string to url so that it can be passed as a string to the setUrl method of the currentContextElement() , say convet(byte[] doc_content) which return a string.
Inside that methos write the following code,
> String url = "";
> WDWebResourceType webResType = WDWebResourceType.PDF;
> IWDWebResource webResource = WDWebResource.getWebResource(doc_content, webResType);
> try {
> url = webResource.getURL();
> }
> catch (Exception e) {
> e.printStackTrace();
> }
> return url;
Hope It will be helpful
Regards,
Sam Charles J. -
Action - Display smartform in PDF format
Hi All,
I have a requirement whereby on triggering of a print form action in crmd_order, the smartform should be displayed in PDF format and from there, user should be able to choose whether to save or to print the form. How can this be done?
Thanks!
CadyHi,
Here's the solutions.
1 .Show the PDF as pop-up upon trigger, very much the same how PDF attachment always pops up in the internet explorer. But this pops up in GUI.
Call the smartform FM with the GETOTF checked,
control_parameters-GETOTF = 'X'.
control_parameter-no_dialog = 'X'.
control_parameter-langu = <ur language>.
output_options-tddest = 'LOCL'.
output_option-tdimmed = 'X'.
output_option-tddelete = 'X'.
i_otf = job_output_info-OTFDATA.
CALL FUNCTION 'SSFCOMP_PDF_PREVIEW'
EXPORTING
i_otf = i_otf
EXCEPTIONS
CONVERT_OTF_TO_PDF_ERROR
CNTL_ERROR
OTHERS
2. Triggering action in ICWC and PDF pops up in new window.
Call function 'SSF_GET_DEVICE_TYPE'
EXPORTING
i_language = sy-langu
IMPORTING
e_devtype = devtype
EXCEPTIONS
no_language
language_not_installed
no_devtype_found
system_error
others
control_parameters-langu = sy-langu.
control_parameters-no_dialog = 'X'.
control_parameters-getotf = 'X'.
CALL FUNCTION '<your_form_FM>'
EXPORTING
CONTROL_PARAMETERS = control_parameters
OUTPUT_OPTIONS = output_options
IMPORTING
JOB_OUTPUT_INFO = output_data
TABLES
orderadm_h = <your tables>
EXCEPTIONS
FORMATTING_ERROR
INTERNAL_ERROR
SEND_ERROR
USER_CANCELED
OTHERS
call function 'CONVERT_OTF'
EXPORTING
format = 'PDF'
IMPORTING
bin_filesize = l_pdf_len
bin_file = l_pdf_xstring
TABLES
OTF = OUTPUT_DATA-OTFDATA
LINES = LT_LINES
EXCEPTIONS
err_max_linewidth
err_format
err_conv_not_possible
err_bad_otf
others
CREATE OBJECT cached_response TYPE CL_HTTP_RESPONSE EXPORTING add_c_msg = 1.
l_pdf_len = xstrlen( l_pdf_xstring ).
cached_response->set_data( data = l_pdf_xstring
length = l_pdf_len ).
cached_response->set_header_field( name = if_http_header_fields=>content_type
value = 'application/pdf' ).
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 '.pdf' INTO display_url.
cl_http_server=>server_cache_upload( url = display_url
response = cached_response ).
url = display_url.
RETURN.
Declare display_url as an attribute in the implementation class as well as page attribute.
Push the display_url value to page attribute using the SET_MODELS method in the implementation class.
Clear display_url in DO_INIT_CONTEXT so that PDF only pops up when action is triggered.
Put this piece of code in the page htm.
I can't seem to be able to put the code here. It's a java script.
IF display_url IS NOT INITIAL.
* I can't show the script here for i kept getting error when i tried putting the java script here.
ENDIF.
3. To trigger a print action and send PDF attachment in background, a spool will still be created.
Call the smartform FM as usual.
lt_spoolid[] = es_job_output_info-spoolids[].
READ TABLE lt_spoolid INTO lw_spoolid INDEX 1.
CHECK lw_spoolid IS NOT INITIAL.
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = lw_spoolid
no_dialog = 'X'
IMPORTING
pdf_bytecount = lw_bytecount
TABLES
pdf = lt_lines
EXCEPTIONS
err_no_otf_spooljob
err_no_spooljob
err_no_permission
err_conv_not_possible
err_bad_dstdevice
user_cancelled
err_spoolerror
err_temseerror
err_btcjob_open_failed
err_btcjob_submit_failed
err_btcjob_close_failed
OTHERS
IF sy-subrc NE 0.
*/ Set to incorrectly processed.
CALL METHOD cl_log_ppf=>add_message
EXPORTING
ip_problemclass = '2'
ip_handle = ip_application_log.
ENDIF.
CHECK sy-subrc = 0.
* Convert PDF from 132 to 255, combine everything into a single string.
LOOP AT lt_lines INTO lw_lines.
* Individually replace the space with a '~'.
TRANSLATE lw_lines USING ' ~'.
CONCATENATE lw_buffer lw_lines INTO lw_buffer.
ENDLOOP.
* Replace '~' by space.
TRANSLATE lw_buffer USING '~ '.
DO.
* Putting in the first 255 chars into the variable.
lw_record = lw_buffer.
* Append 255 chars as a record.
APPEND lw_record TO lt_record.
SHIFT lw_buffer LEFT BY 255 PLACES.
IF lw_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
* Object with PDF.
lt_objbin = lt_record.
DESCRIBE TABLE lt_objbin LINES lw_lines_bin.
* Object with main text for the mail.
lw_objtxt = <your text>
append lw_objtxt to lt_objtxt.
DESCRIBE TABLE lt_objtxt LINES lw_lines_txt.
* Document information.
lw_doc_chng-obj_name = 'Smartform'.
lw_doc_chng-expiry_dat = sy-datum + 20.
lw_doc_chng-obj_descr = <your text>.
lw_doc_chng-sensitivty = 'F'
lw_doc_chng-doc_size = lw_lines_txt * 255.
* Pack to main body as RAW
* Obj to be transported not in binary form
CLEAR lw_objpack-transf_bin.
* Start line of object header in transport packet.
lw_objpack-head_start = 1.
* Number of lines and object header in object packet.
lw_objpack-head_num = 0.
* Start line of object contents in an object packet.
lw_objpack-body_start = 1.
* Number of lines of the object contents in an object packet.
lw_objpack-body_num = lw_lines_txt.
* Code for document class.
lw_objpack-doc_type = 'RAW'.
APPEND lw_objpack TO lt_objpack.
* Packing as PDF.
lw_objpack-transf_bin = lc_x.
lw_objpack-head_start = 1.
lw_objpack-head_num = 0.
lw_objpack-body_start = 1.
lw_objpack-body_num = lw_lines_bin.
lw_objpack-doc_type = 'PDF'.
lw_objpack-obj_name = <your text>.
CONCATENATE '<your text>' '.pdf' INTO lw_objpack-obj_descr.
lw_objpack-doc_size = lw_lines_bin * 255.
APPEND lw_objpack TO lt_objpack.
* Document information.
CLEAR lw_reclist.
* Email receivers.
lw_reclist-receiver = <email address>
lw_reclist-express = 'X'.
lw_reclist-rec_type = 'U'. "Internet address.
lw_reclist-com_type ='INT'.
APPEND lw_reclist TO lt_reclist.
* Send mail.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = lw_doc_chng
TABLES
packing_list = lt_objpack
object_header = lw_objhead
contents_txt = lt_objtxt
contents_bin = lt_objbin
receivers = lt_reclist
EXCEPTIONS
too_many_receivers
document_not_sent
document_type_not_exist
operation_no_authorization
parameter_error
x_error
enqueue_error
OTHERS
IF sy-subrc = 0.
COMMIT WORK.
ELSE.
*/ Set to incorrectly processed.
CALL METHOD cl_log_ppf=>add_message
EXPORTING
ip_problemclass = lc_2
ip_handle = ip_application_log.
ENDIF.
4. Trigger action and send PDF attacment as mail. No Spool.
control_parameters-GETOTF = 'X'.
control_parameter-no_dialog = 'X'.
control_parameter-langu = <ur language>.
output_options-tddest = 'LOCL'.
output_option-tdimmed = 'X'.
output_option-tddelete = 'X'.
CALL FUNCTION 'your smartform FM
EXPORTING
control_parameters = lw_ctrl_params
output_options = lw_output_options
user_settings = space "Has to be set to SPACE so it will get parameters from lw_output_options.
et_orderadm_h
et_orderadm_i
et_cancel
et_appointment
et_partner
es_but000
IMPORTING
job_output_info = lw_output "OTF format
EXCEPTIONS
formatting_error
internal_error
send_error
user_canceled
OTHERS
* Get the OTF data.
lt_otf = lw_output-otfdata[].
* Convert OTF format to PDF.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = lw_bin_filesize
TABLES
otf = lt_otf
lines = lt_lines
EXCEPTIONS
err_max_linewidth
err_format
err_conv_not_possible
err_bad_otf
OTHERS
The rest will the similiar to no.3, * Convert PDF from 132 to 255, combine everything into a single string. onwards.
Cheers,
ck. -
Display Smartform in PDF.
Hi All,
I have gone through the forum threads to convert a smartform into a pdf document. All of them say to use function module CONVERT_OTF. This function module converts the output of the smartform which is in OTF into the PDF format and we can download the information which opens up with Adobe Reader.
The question is whether we can display the output of the smartform in Adobe at runtime within the SAP GUI because if it is in the portal then we can set the attribute in SAP Connect, to display the output of SAP Script and Smartforms in PDF.
I tried this code
REPORT ZACOSTA_FETCH_DATA_COPY.
DATA : IT_ZACOSTA TYPE ZACOSTA_TAB_DET.
DATA : V_FORM_NAME TYPE TDSFNAME VALUE 'ZACOSTA_FORMS_COPY1',
V_FUNC_NAME TYPE RS38L_FNAM.
DATA: LS_CONTROL_PARAMETERS TYPE SSFCTRLOP,
LS_OUTPUT_OPTIONS TYPE SSFCOMPOP,
LS_JOB_OUTPUT_INFO TYPE SSFCRESCL,
LT_LINES TYPE TABLE OF TLINE,
L_DEVTYPE TYPE RSPOPTYPE,
L_SAM_HAWKINS TYPE INT4,
L_DOC TYPE DOCS OCCURS 0 WITH HEADER LINE.
START-OF-SELECTION.
SELECT VBAKVBELN VBAKVKORG VBAK~VTWEG
VBAKSPART VBAKKUNNR VBAP~POSNR
VBAPMATNR VBAPARKTX VBAP~NETWR
VEDAVBEGDAT VEDAVENDDAT
INTO CORRESPONDING FIELDS OF TABLE IT_ZACOSTA
FROM VBAK INNER JOIN VBAP
ON VBAKVBELN = VBAPVBELN
INNER JOIN VEDA
ON VEDAVBELN = VBAPVBELN
WHERE VBAK~VBELN = '0040000264'. "Where Clause to be removed
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = V_FORM_NAME
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
FM_NAME = V_FUNC_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.
Set language
LS_CONTROL_PARAMETERS-LANGU = SY-LANGU.
Set control parameters to get the output format (OTF) from Smart Forms
LS_CONTROL_PARAMETERS-NO_DIALOG = 'X'.
LS_CONTROL_PARAMETERS-GETOTF = 'X'.
LS_OUTPUT_OPTIONS-TDNOPREV = 'X'.
CALL FUNCTION V_FUNC_NAME
EXPORTING
OUTPUT_OPTIONS = LS_OUTPUT_OPTIONS
CONTROL_PARAMETERS = LS_CONTROL_PARAMETERS
USER_SETTINGS = SPACE
IT_ZACOSTA = IT_ZACOSTA
IMPORTING
JOB_OUTPUT_INFO = LS_JOB_OUTPUT_INFO.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
MAX_LINEWIDTH = 132
ARCHIVE_INDEX = ' '
COPYNUMBER = 0
IMPORTING
BIN_FILESIZE = L_SAM_HAWKINS
bin_file = p_data " binary file
TABLES
OTF = LS_JOB_OUTPUT_INFO-OTFDATA
LINES = LT_LINES
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
ERR_BAD_OTF = 4
OTHERS = 5
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = 'C:\Test.pdf'
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 =
TABLES
DATA_TAB = LT_LINES
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.
The reson why I had to download is because this does not show the PDF at runtime. Am I missing some parameter here or is there some kind of configuration required to display the smartform in PDF at runtime within the SAP GUI.
Any hints on this would be greatly appreciated.
Best Regards,
SudhiHi,
Here is the sample code.This code will download the smartforms as PDF.Kindly reward points by clicking the star on the left of reply,if it helps.
REPORT zswar.
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME.
PARAMETER: p_date LIKE sy-datum.
PARAMETER: p_rea TYPE char255.
SELECTION-SCREEN: END OF BLOCK b1.
DATA: ws_ucomm LIKE sy-ucomm.
INITIALIZATION.
SET PF-STATUS 'STANDARD' OF PROGRAM 'ZSWAR'.
AT SELECTION-SCREEN.
ws_ucomm = sy-ucomm.
CASE ws_ucomm.
WHEN '&PDF'.
PERFORM f1000_download_form.
EXIT.
WHEN '&BACK'.
SET SCREEN 0.
EXIT.
WHEN '&EXIT'.
SET SCREEN 0.
EXIT.
WHEN '&canc'.
SET SCREEN 0.
LEAVE TO SCREEN 0.
ENDCASE.
*& Form F1000_DOWNLOAD_FORM
text
--> p1 text
<-- p2 text
FORM f1000_download_form.
DATA: form_name TYPE rs38l_fnam.
DATA: wa_ctrlop TYPE ssfctrlop,
wa_outopt TYPE ssfcompop.
DATA: t_otfdata TYPE ssfcrescl,
t_pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE.
Tutorial on SMART FORMS
© 2005 SAP AG 7
DATA: t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE.
DATA: w_filesize TYPE i.
DATA: w_bin_filesize TYPE i.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZSMARTFORM_SWAR'
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
fm_name = 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.
wa_ctrlop-getotf = 'X'.
wa_ctrlop-no_dialog = 'X'.
wa_outopt-tdnoprev = 'X'.
CALL FUNCTION form_name
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
control_parameters = wa_ctrlop
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
output_options = wa_outopt
user_settings = 'X'
mydate = p_date
reason = p_rea
IMPORTING
DOCUMENT_OUTPUT_INFO =
job_output_info = t_otfdata
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.
t_otf[] = t_otfdata-otfdata[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
Tutorial on SMART FORMS
© 2005 SAP AG 8
max_linewidth = 132
ARCHIVE_INDEX = ' '
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
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 'WS_DOWNLOAD'
EXPORTING
bin_filesize = w_bin_filesize
CODEPAGE = ' '
filename = 'd: est.PDF'
filetype = 'BIN'
MODE = ' '
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
COL_SELECT = ' '
COL_SELECTMASK = ' '
NO_AUTH_CHECK = ' '
IMPORTING
filelength = w_filesize
TABLES
data_tab = t_pdf_tab
FIELDNAMES =
EXCEPTIONS
file_open_error = 1
file_write_error = 2
invalid_filesize = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
OTHERS = 10
IF sy-subrc <> 0.
MESSAGE i003(z00) WITH 'File not downloaded succesfully'.
ELSE.
MESSAGE i003(z00) WITH 'File Test.pdf downloaded succesfully '
'under D drive'.
ENDIF.
ENDFORM. " F1000_DOWNLOAD_FORM -
Problem in displaying smartform as pdf in mail attachment
Hi Gurus,
I have generated a Smartform, converted to PDF and sent as attachment to email, upto this everything working fine.
Now the email is generated with the PDF attachment but Adobe Reader encounters an error when opening.
Error display as below mentioned
Adobe Reader could not open 'abc_X.PDF' because it is either not a supported file type or because the file has been damaged(for example, it was sent as an email attachment and wasn't correctly decoded).
The program cods as below mentioned
TYPES:BEGIN OF ty_viqmel,
qmnum TYPE viqmel-qmnum,
qmart TYPE viqmel-qmart,
objnr TYPE viqmel-objnr,
qmtxt TYPE viqmel-qmtxt,
erdat TYPE viqmel-erdat,
erzeit TYPE viqmel-erzeit,
aenam TYPE viqmel-aenam,
aufnr TYPE viqmel-aufnr,
qmdab TYPE viqmel-qmdab,
swerk TYPE viqmel-swerk,
END OF ty_viqmel.
TYPES: BEGIN OF ty_t001w,
werks TYPE werks,
name1 TYPE name1,
END OF ty_t001w.
DATA:IT_VIQMEL TYPE TABLE OF TY_VIQMEL,
WA_VIQMEL TYPE TY_VIQMEL,
IT_T001W TYPE TABLE OF TY_T001W,
WA_T001W TYPE TY_T001W,
IT_FINAL TYPE TABLE OF ZPM_T_MAINTENACE,
WA_FINAL TYPE ZPM_T_MAINTENACE.
data: it_diff like it_viqmel,
wa_diff like line of it_diff.
Smartforms data declarations
DATA: lv_fmname TYPE rs38l_fnam, "value 'ZPM_F_MAINTENANCE_REQUEST'.
w_cparam TYPE ssfctrlop ," To display smart form in arabic.
w_compop 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,
WA_BUFFER TYPE STRING. "To convert from 132 to 255
Internal table to hold the OTF data
DATA:
t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
Internal table to hold OTF data recd from the SMARTFORM
t_otf_from_fm TYPE ssfcrescl,
Internal table to hold the data from the FM CONVERT_OTF
T_pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE.
Objects to send mail.
data: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,
I_RECORD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
WA_OBJHEAD TYPE SOLI_TAB,
WA_DOC_CHNG TYPE SODOCCHGI1.
DATA: V_LEN_IN LIKE SOOD-OBJLEN,
I_TLINE TYPE TABLE OF TLINE WITH HEADER LINE,
V_LEN_OUT LIKE SOOD-OBJLEN,
V_LEN_OUTN TYPE I,
V_LINES_TXT TYPE I,
V_LINES_BIN TYPE I.
START-OF-SELECTION.
SELECT QMNUM
QMART
QMTXT
ERDAT
ERZEIT
AENAM
AUFNR
QMDAB
SWERK
OBJNR
FROM VIQMEL
INTO CORRESPONDING FIELDS OF TABLE IT_VIQMEL
WHERE aufnr = SPACE
and qmdab = '00000000'
AND ( QMART EQ 'M1' OR QMART EQ 'M2' OR QMART EQ 'M3' ).
IF SY-SUBRC = 0.
sort it_viqmel by qmnum.
ENDIF.
loop at it_viqmel into wa_viqmel.
perform 72hours.
endloop.
SELECT WERKS
NAME1 FROM T001W INTO TABLE IT_T001W
FOR ALL ENTRIES IN IT_diff
WHERE WERKS = IT_diff-SWERK.
IF SY-SUBRC = 0.
LOOP AT IT_diff INTO WA_diff.
READ TABLE IT_T001W INTO WA_T001W WITH KEY WERKS = WA_diff-SWERK.
IF SY-SUBRC = 0.
WA_FINAL-QMNUM = WA_diff-QMNUM.
WA_FINAL-QMTXT = WA_diff-QMTXT.
WA_FINAL-ERDAT = WA_diff-ERDAT.
WA_FINAL-ERZEIT = WA_diff-ERZEIT.
WA_FINAL-SWERK = WA_diff-SWERK.
WA_FINAL-NAME1 = WA_T001W-NAME1.
WA_FINAL-AENAM = WA_diff-AENAM.
APPEND WA_FINAL TO IT_FINAL.
CLEAR WA_FINAL.
ENDIF.
ENDLOOP.
ENDIF.
clear:w_cparam,w_compop.
w_cparam-langu = 'AR'.
w_cparam-getotf = 'X'.
w_cparam-no_dialog = 'X'. " Suppressing the dialog box
W_COMPOP-TDNOPREV = 'X'.
w_compop-tddest = 'LP01'.
W_COMPOP-TDPRINTER = 'PRINTER'.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZPM_F_MAINTENANCE_REQUEST'
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
FM_NAME = lv_fMNAME
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3
IF sy-subrc <> 0.
Implement suitable error handling here
ENDIF.
CALL FUNCTION lv_fmname
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS = w_cparam
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS = w_compop
USER_SETTINGS = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO = t_otf_from_fm
JOB_OUTPUT_OPTIONS =
TABLES
it_final = it_final
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5
IF sy-subrc <> 0.
Implement suitable error handling here
ENDIF.
t_otf[] = t_otf_from_fm-otfdata[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
MAX_LINEWIDTH = 132
ARCHIVE_INDEX = ' '
COPYNUMBER = 0
ASCII_BIDI_VIS2LOG = ' '
PDF_DELETE_OTFTAB = ' '
PDF_USERNAME = ' '
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.
Implement suitable error handling here
ENDIF.
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.
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 = 'Maintenance Request'.
APPEND I_OBJTXT.
DESCRIBE TABLE I_OBJTXT LINES V_LINES_TXT.
READ TABLE I_OBJTXT INDEX V_LINES_TXT.
WA_DOC_CHNG-OBJ_NAME = 'ZPM_F_MAINTENANCE_REQUEST'.
*WA_DOC_CHNG-EXPIRY_DAT = SY-DATUM + 10.
WA_DOC_CHNG-OBJ_DESCR = 'Maintenance Request'.
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 = 'ZPM_F_MAINTENANCE_REQUEST'.
I_OBJPACK-OBJ_DESCR = 'Maintenance Request'.
APPEND I_OBJPACK.
CLEAR I_RECLIST.
I_RECLIST-RECEIVER = '[email protected]'.
I_RECLIST-REC_TYPE = 'U'.
APPEND I_RECLIST.
ENDLOOP.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = WA_DOC_CHNG
PUT_IN_OUTBOX = 'X'
SENDER_ADDRESS = SY-UNAME
SENDER_ADDRESS_TYPE = 'B'
COMMIT_WORK = 'X'
IMPORTING
SENT_TO_ALL = w_sent_all
NEW_OBJECT_ID =
SENDER_ID =
tables
packing_list = I_OBJPACK
OBJECT_HEADER = WA_OBJHEAD
CONTENTS_BIN = I_OBJBIN
CONTENTS_TXT = I_OBJTXT
CONTENTS_HEX =
OBJECT_PARA =
OBJECT_PARB =
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.
ENDIF.
ENDIF.
Please let me know what could be the problem.
Thanks in advance.
vs.sarvan.Hi Sarvan,
Post the code in code format.Check on the right side for example.
Sy-subrc = 0
Regards,
Madhu. -
How to display smartform through transaction code on action of button
Hi All,
Please let me know how can i display smartform through tcode on button action.
For e.g. I have a F.62 tcode where the smartform is attached. Now i want a button in BSP which when clicked should call tcode F.62 and display that smartform.
Also if i cannot use "CALL TRANSACTION" can i use "SUBMIT" and call that transaction.
If not how will i able to acheive that?
Please help as it is very urgent.
Thanks,
RahulHi,
Use ITS to display the F.62 transaction is worth a try. But I am not sure whether the ITS will be able to display Smartforms...
Another option is trying to launch the Smartforms (I dont know the F.62 transaction enough to tell if it is time-consuming or not) and convert it to PDF (there is plenty of threads about this in SDN) and then, display it through BSP (either inline or for the user to download).
Best regards,
Guillaume -
Converting Smartforms to PDF and displaying Smartforms on print preview
Hi,
How to convert smartforms to pdf?
How to attach this pdf to email?
How to attach this pdf to the email and at the same time can print preview the smartforms?
Thanks.Hi Navi,
Code Snippet for Simple Mail
*& Report ZZ_TEST *
REPORT zz_test .
INCLUDE zz_test_top.
INCLUDE zz_test01.
FORM entry *
--> RETURN_CODE *
--> US_SCREEN *
FORM entry USING return_code us_screen.
CLEAR retcode.
xscreen = us_screen.
PERFORM processing USING us_screen.
CASE retcode.
WHEN 0.
return_code = 0.
WHEN 3.
return_code = 3.
WHEN OTHERS.
return_code = 1.
ENDCASE.
ENDFORM. "entry
*& Include ZZ_TEST_TOP *
TABLES : nast,
tnapr.
TYPES : BEGIN OF t_SOUDNAMEI1.
INCLUDE STRUCTURE SOUDNAMEI1.
TYPES : END OF t_SOUDNAMEI1.
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,
i_lips LIKE lips OCCURS 0 WITH HEADER LINE,
i_SOUDNAMEI1 TYPE STANDARD TABLE OF t_SOUDNAMEI1.
Work Area declarations
DATA:w_objhead TYPE soli_tab,
wa_control_parameters TYPE ssfctrlop,
wa_output_options 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
wa_SOUDNAMEI1 TYPE t_SOUDNAMEI1,
Variables declarations
w_form_name TYPE rs38l_fnam,
w_len_in LIKE sood-objlen,
w_len_out LIKE sood-objlen,
w_len_outn TYPE i,
w_lines_txt TYPE i,
w_lines_bin TYPE i,
retcode TYPE sy-subrc,
xscreen TYPE c,
w_spld TYPE usr01-spld,
w_receiver TYPE SOXNA-FULLNAME,
w_OBJ_RECORD TYPE OBJ_RECORD,
w_user type sy-uname,
w_email TYPE ad_smtpadr.
Constants Declaration
CONSTANTS : c_x TYPE c VALUE 'X',
c_atrate(1) TYPE c VALUE '@'.
*& Include ZZ_TEST01 *
FORM PROCESSING *
FORM processing USING proc_screen.
SELECT * FROM lips
INTO TABLE i_lips
WHERE vbeln = nast-objky.
Call Function module to Getfunction Module name Generated by Smartform
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = tnapr-sform
IMPORTING
fm_name = w_form_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
IF sy-subrc <> 0.
retcode = sy-subrc.
ENDIF.
CLEAR : wa_control_parameters,
wa_output_options.
CASE nast-nacha.
WHEN '1'.
wa_control_parameters-device = 'PRINTER'.
WHEN '7'.
DATA: l_email TYPE ad_smtpadr.
wa_output_options-tdnoprev = c_x.
wa_control_parameters-getotf = c_x.
To get the default output device maintained in the
User profile
SELECT SINGLE spld FROM usr01
INTO w_spld
WHERE bname EQ nast-usnam.
IF sy-subrc EQ 0.
MOVE w_spld TO wa_output_options-tddest .
ENDIF.
wa_output_options-tdnoprev = c_x.
wa_control_parameters-getotf = c_x.
To get the email address maintained for the particular output
CALL FUNCTION 'NAST_GET_MESSAGE_OBJECT_RECV'
EXPORTING
pi_objkey = nast-tdname
IMPORTING
pe_addr = w_receiver
CHANGING
pc_objhandle = w_obj_record
EXCEPTIONS
maildata_not_readable = 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.
IF w_receiver NA c_atrate.
To retrieve the E-Mail Id in case we get the User name from NAST
CLEAR wa_soudnamei1.
REFRESH i_soudnamei1.
MOVE w_receiver TO wa_soudnamei1-fullname.
To get the user name
CALL FUNCTION 'SO_NAME_CONVERT_API1'
EXPORTING
name = wa_soudnamei1
TABLES
names = i_soudnamei1
EXCEPTIONS
user_not_exist = 1
parameter_error = 2
x_error = 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.
CLEAR wa_soudnamei1.
READ TABLE i_soudnamei1 INTO wa_soudnamei1 INDEX 1.
MOVE wa_soudnamei1-sapname TO w_user.
To get the e-mail Id maintained in the user profile
CALL FUNCTION 'FTR_CORR_CHECK_EMAIL_SAP_USER'
EXPORTING
i_user = w_user
IMPORTING
e_email_address = l_email
EXCEPTIONS
mail_address = 1
determination_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.
MOVE l_email TO w_receiver.
ENDIF.
MOVE w_receiver TO w_email.
ENDCASE.
wa_control_parameters-no_dialog = c_x.
wa_control_parameters-langu = nast-spras .
wa_output_options-tdteleland = nast-tland.
wa_output_options-tdtelenum = nast-telfx .
wa_output_options-tdsenddate = nast-erdat .
wa_output_options-tdsendtime = nast-eruhr .
wa_output_options-tddataset = nast-dsnam .
wa_output_options-tdsuffix1 = nast-dsuf1 .
wa_output_options-tdsuffix2 = nast-dsuf2 .
wa_output_options-tdimmed = nast-dimme .
wa_output_options-tddelete = nast-delet .
wa_output_options-tdautority = nast-tdautority.
wa_output_options-tdcovtitle = nast-tdcovtitle .
wa_output_options-tdcover = nast-tdocover .
wa_output_options-tdreceiver = nast-tdreceiver.
wa_output_options-tddivision = nast-tddivision.
wa_output_options-tdcopies = nast-anzal .
wa_output_options-tdnewid = c_x.
wa_output_options-tdarmod = nast-tdarmod.
wa_output_options-tdnoarmch = c_x.
CALL FUNCTION w_form_name
EXPORTING
archive_index = toa_dara
archive_parameters = arc_params
control_parameters = wa_control_parameters
output_options = wa_output_options
user_settings = ' '
IMPORTING
job_output_info = w_return
TABLES
it_lips = i_lips
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF nast-nacha EQ 7 AND sy-subrc EQ 0.
i_otf[] = w_return-otfdata[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = w_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 w_lines_bin.
Document information.
w_doc_chng-obj_name = 'Smartform'.
w_doc_chng-expiry_dat = sy-datum + 10.
CONCATENATE 'Delivery' 'Note'
INTO w_doc_chng-obj_descr.
*w_doc_chng-obj_descr = 'Smart form output'.
w_doc_chng-sensitivty = 'F'. "Functional object
w_doc_chng-doc_size = w_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 = w_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 = w_lines_bin.
i_objpack-doc_type = 'PDF'.
i_objpack-obj_name = 'Smartform'.
CONCATENATE 'Delivery' 'Note' '.pdf'
INTO i_objpack-obj_descr.
i_objpack-doc_size = w_lines_bin * 255.
APPEND i_objpack.
Document information.
CLEAR i_reclist.
e-mail receivers.
i_reclist-receiver = w_email.
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_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.
ENDIF.
ENDIF.
ENDFORM. "processing
OTF to PDF
========================================================================
Program1
*& REPORT zpmm_print1
REPORT zpmm_print1.
DATA : gw_ssfcrescl TYPE ssfcrescl.
DATA: gt_otf TYPE STANDARD TABLE OF itcoo ,
gt_tline TYPE STANDARD TABLE OF tline,
gv_len LIKE sood-objlen,
gw_ssfctrlop TYPE ssfctrlop, "for CONTROL_PARAMETERS
gw_ssfcompop TYPE ssfcompop. "for OUTPUT_OPTIONS
DATA fm_name TYPE rs38l_fnam.
gw_ssfctrlop-getotf = 'X'.
gw_ssfctrlop-no_dialog = 'X'.
gw_ssfcompop-tdnoprev = 'X'.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZPMM_1'
IMPORTING
fm_name = fm_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
IF sy-subrc <> 0.
<error handling>
ENDIF.
CALL FUNCTION fm_name
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
control_parameters = gw_ssfctrlop
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
output_options = gw_ssfcompop
user_settings = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO =
job_output_info = gw_ssfcrescl
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.
gt_otf[] = gw_ssfcrescl-otfdata[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = gv_len
TABLES
otf = gt_otf
lines = gt_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.
DATA : gv_filename LIKE rlgrap-filename VALUE 'C:\swet.pdf'.
CALL FUNCTION 'DOWNLOAD'
EXPORTING
bin_filesize = gv_len
filename = gv_filename
filetype = 'BIN'
filetype_no_show = 'X'
IMPORTING
act_filename = gv_filename
filesize = gv_len
cancel = ''
TABLES
data_tab = gt_tline.
Program 2
*& REPORT zpmm_print2
REPORT zpmm_print2.
DATA : gw_ssfcrescl TYPE ssfcrescl.
DATA: gt_otf TYPE STANDARD TABLE OF itcoo ,
gt_tline TYPE STANDARD TABLE OF tline,
gv_len LIKE sood-objlen,
gw_ssfctrlop TYPE ssfctrlop, "for CONTROL_PARAMETERS
gw_ssfcompop TYPE ssfcompop. "for OUTPUT_OPTIONS
DATA fm_name TYPE rs38l_fnam.
gw_ssfctrlop-getotf = 'X'.
gw_ssfctrlop-no_dialog = 'X'.
gw_ssfcompop-tdnoprev = 'X'.
CALL FUNCTION '/1BCDWB/SF00000041'
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
control_parameters = gw_ssfctrlop
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
output_options = gw_ssfcompop
user_settings = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO =
job_output_info = gw_ssfcrescl
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.
gt_otf[] = gw_ssfcrescl-otfdata[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = gv_len
TABLES
otf = gt_otf
lines = gt_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.
DATA : gv_filename LIKE rlgrap-filename VALUE 'C:\swet.pdf'.
CALL FUNCTION 'DOWNLOAD'
EXPORTING
bin_filesize = gv_len
filename = gv_filename
filetype = 'BIN'
filetype_no_show = 'X'
IMPORTING
act_filename = gv_filename
filesize = gv_len
cancel = ''
TABLES
data_tab = gt_tline.
=========================================================================
Cheers
Mohinder Singh Chauhan -
Print action's default printer
Hi,
I've configured a print action to trigger a custom smartform within CRMD_ORDER. My print action uses processing class CL_DOC_PROCESSING_CRM_ORDER, and method CRM_SRVORDER_EXEC_SMART_FORM
When I execute the action, I get a printout that reads 'PDF status page. PDF file not printed. 128 MB of memory is required to enable direct PDF printing'.
When I checked the output device (LOCM), it is using device type PDF1.
I understand that smartform doesn't allow direct PDF printing, so now I'd like to know.. where do I set the default printer? I don't want it to use LOCM.
I tried doing so in user profile - example, I put LOCL, but when I execute the print action again, the spool shows that it is using LOCM (the one with PDF1 as device type)!
Any thoughts?
Cheers, MYhi
just go inside the SCOT
and there change the PDF to text
now the action you have described to print the job ias perfect
just use t code SP01 and there in maitain the settings in spooling,
i am assuming in SM59 u have scheduled your job properly
also as u know PDF cant be printed directly
so just cahnged into the text
it will solve ur purpose
best regards
ashish -
Hi All,
I have maintained the new print action profile. if i select the print button in portal its showing smartform output, but it's triggering again and again without selecting the print button.
Thanks,
SubbuHi,
Give Max 1 action for each action defination
in the action merging field of your action details.
So that it will restrict the multiple actions triggering.
If you have multiple process types assigned to your action then give Set Highest Number of Processed Actions
and then go to action merging and select the radio button
one unprocessed action for each processing type
Give Max 1 successful action under number of processed actions.
Reward points if it helps.
Regards,
Madhu
Edited by: madhu kunduru on Mar 26, 2008 5:09 PM
Edited by: madhu kunduru on Mar 26, 2008 5:12 PM -
Error while saving a smartform in pdf with action profile in service order
Hi experts,
I have a problem in saving a smartform which is converted in pdf.
WHat i m doing is.
The action profile is configured with new Z class and Z method. CL_DOC_PROCESSING_CRM_ORDER and CRM_SRVORDER_EXEC_SMART_FORM.
But when i click the button in the Order, i m able to save the pdf in local drive, but an error is coming in the Order page(at the bottom) "Action could not be executed successfully".
The action has been setup with "Printonly" and "Smartforms print" in customization.
I have a dount whether, this action Printonly is only to print the smartform ??? Or can we use just to save the smartform in pdf.
But when i remove the pdf conversion and save dialog and try to print it directly, Its printing the smartform. No errors are coming.
But guys, please help me on this. I have tried all the tricks i know.
I just want to save a smartform in pdf with action profile configured.
Thanks in advance.
<REMOVED BY MODERATOR>
KK
Edited by: Alvaro Tejada Galindo on Mar 19, 2008 4:26 PMHi;
Did you checked
Queries Error With FRM-92101 In Many NLS Forms [ID 443922.1] << seems similar error like yours
Forms FRM-92050, FRM-92100, FRM-92101, FRM-92102 Reference Guide [ID 444690.1]
If its not help please enable trace
How To Perform System Tracing For All Forms Runtime Processes? [ID 400144.1]
Regard
Helios -
Print Output in Duplex Mode in Smartform
Hi Experts,
I have an situation where I want to terms & conditions page on back side of my last page in SmartForm.
e.g sales order have 4 pages so terms and condition page should be only on back side of 4th page.
SO we have total 4 pages in hand.
I used command line and call second page which has text but it will print text on 5th page and when i provide print control as duplex then print preview not appear.
Please Help...
Thank you.
Edited by: VARUN RAJULE on Dec 24, 2009 2:56 PMHi,
In your terms and conditons page ouput options select print mode as 'D' ( dUPLEX ) and for this page the
next page should be space and call this terms page through command node at the end of main window and after the tables.
Thanks,
Phani. -
Print's first line then freezes
Blue tooth connetion is fine on both printer and computer. Computer recognizes printer. Printer says "ready." When send a document to print, paper drops in properly, and printer makes printing noise. Display says "Now Printing," but nothing seems to be happening. Eventurally an error message displays on laptop. Cancel printing (which requires disabling from labtop to get it to stop). When paper comes out, only first line of text printed. Called tech support. They asked me to print from notepad. It prints from notepad (only tested on line of text). It wll also print from Word doc if only one line of text. WIth multiple lines of text or images from any program, it fails. I uninstalled, reinstalled, checked ink cartriges, checked paper, turned on-off, restarted, turned on devices in both orders (printer first, computer first)... all multiple times. Same result. The printer was able to print a webpage before (only printed one page since I've owned it). Now that I have installed the updated driver it does not work.
Hey , Welcome to the HP forums! I hope you enjoy your stay here. I see that you are experiencing some issues with printing from your Windows 8.1 machine to your Officejet 150. I can help with that. First, to make sure the printer itself is functional on the printer click on Setup and then Reports and then Print Status Report. If that prints then we know the printer itself is functional. Next, we'll test your print system. To do so:Turn the printer off.Go to your PC's Control Panel and then Printers and Devices.Right click on any picture of the printer you have.Click on Remove Device.Repeat for any other printers that are listed.Turn the printer on.Try printing.If this works then we know your print system is fine. From here we can try printing through Bluetooth. To do so:Return to Devices and Printers.Right click on the printer to remove it.Add the Bluetooth printer back.Try printing.Hopefully this will allow you to print. If you have any other questions please let me know. Likewise if it resolves your issues then please let others know by clicking on Accept as Solution below my post. I hope this helps and I hope you have a great evening!
-
Displaying Smartforms in Webdynpro ABAP
Hi All,
I have to display smartforms in WDA. For that I'm using following link.
[http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0de1eb8-0b98-2910-7996-8a3c2fcf6785?quicklink=index&overridelayout=true]
Now, in my case --
Form Name - 'ZFORM'
Importing Field - 'VBELN'
But, my problem is I'm unable to understand some of the fields, used in Tutorial in the link above, which are --
element_zinput
pernr = stru_input1-zpernr
reinr = stru_input1-zreinr
pdvrs = stru_input1-zpdvrs
I can understand that these must be user-defined. But, it has not defined in tutorial and hence, I'm confused.
Can anyone tell me what are these fields and from where are these coming?
Thakns.
Kumar Saurav.hi:Thomas
I have a requirement which smartform convert to pdf in web dynpro for abap ,But garbled for the Chinese.why is this?
my code:
method ONACTIONPDF2 .
DATA FM_NAME TYPE RS38L_FNAM.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'ZTEST_WDA'
IMPORTING
FM_NAME = FM_NAME
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: JOB_OUPUT TYPE SSFCRESCL,
LT_OTFDATA TYPE TABLE OF ITCOO.
DATA: LA_CTRL_FORM TYPE SSFCTRLOP,
LA_OUTPUT_OPT TYPE SSFCOMPOP.
** Spool Parameters
*LA_OUTPUT_OPT-TDIMMED = 'X'.
*LA_OUTPUT_OPT-TDDELETE = 'X'.
*LA_OUTPUT_OPT-TDLIFETIME = 'X'.
*LA_OUTPUT_OPT-TDDEST = 'LOCL'.
* Parameters passes to get the output in PDF format
LA_CTRL_FORM-NO_DIALOG = 'X'.
*LA_CTRL_FORM-PREVIEW = 'X'.
LA_CTRL_FORM-GETOTF = 'X'.
LA_CTRL_FORM-LANGU = '1'.
*LA_CTRL_FORM-DEVICE = 'PRINTER'.
LA_OUTPUT_OPT-tdprinter = 'PDF1'.
CALL FUNCTION FM_NAME
EXPORTING
CONTROL_PARAMETERS = LA_CTRL_FORM
OUTPUT_OPTIONS = LA_OUTPUT_OPT
IMPORTING
JOB_OUTPUT_INFO = JOB_OUPUT
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.
REFRESH LT_OTFDATA.
LT_OTFDATA[] = JOB_OUPUT-OTFDATA[].
CALL FUNCTION 'SSFCOMP_PDF_PREVIEW'
EXPORTING
I_OTF = LT_OTFDATA
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.
* convert otf to pdf
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
MAX_LINEWIDTH = 255
IMPORTING
BIN_FILESIZE = PDF_SIZE
BIN_FILE = PDF_DATA
TABLES
OTF = LT_OTFDATA[]
LINES = L_DUMMY
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.
WDR_TASK=>CLIENT_WINDOW->CLIENT->ATTACH_FILE_TO_RESPONSE(
* *path to the word file
I_FILENAME = 'WDA_SMARTFORMS.pdf'
* String Variable
I_CONTENT = PDF_DATA
* File Type
I_MIME_TYPE = 'PDF' ).
endmethod.
image1 for smartforms
image2 for pdf
Maybe you are looking for
-
Sudden loss of link after "getting" file from server
I have used the "get" feature to modify one of my files from my site. While I was saving my changes, I noticed that I had lost all the page's styles -- no style, no background, only html structures! I've tried to repeat the "get" feature to replace t
-
Doc No. displayed in F.19 but not in MR11
Hi, I have a typical issue with GR/IR clearing. I have a pending IR which doesn't have any GR against to clear it. This IR is not reflected in MR11 but is displayed in F.19. Can someone please help with this. Also please help with the ways of clearin
-
P-card process available for SRM 5.0 extended classic scenario
Hello, I didn't find the information, so I'm posting this message. Is the p-card functionality available for the extended classic scenario in SRM 5.0 ?
-
Update Mac osx 10.4.11
hi i have I mac OS X Version 10.4.11 processore 2 GHz intel core 2 1 GB ram how can update my mac osx on line ?
-
Hi All, I am trying to lock and unlock the users using UME api's. This is the code which I had used. com.sap.security.api.IUser user = UMFactory.getUserFactory().getUserByLogonID("test"); String userId = user.getUniqueNa