Display smart form in PDF
Hi all,
I have created a smart form , and I can down load it to the local drive in PDF format.
But I want to display my smart form in PDF first , then if the user want to save , he should be able to do so. How can i do thtat.
Many thanks ,
Sandeep.
hi friend,
pls go through the code
rewards are expecting .
vivek
*& Report Y_SD_PRE_SHIPMENT
REPORT y_sd_pre_shipment.
**************DATA DECLARATION****************************************
DATA : BEGIN OF i_vbrk OCCURS 0,
vbeln TYPE vbrp-vbeln,
END OF i_vbrk.
DATA: prog TYPE sy-repid,
dynnr TYPE sy-dynnr,
FNAM TYPE RS38L_FNAM,
v_vbeln type ZSDTANNXINV-vbeln,
idx type i,
cnt type i.
DATA: I_FINAL TYPE TABLE OF YPSHIP,
W_FINAL TYPE YPSHIP.
DATA: I_HEAD TYPE TABLE OF YPSHIP1,
W_HEAD TYPE YPSHIP1.
DATA: it_otf TYPE STANDARD TABLE OF itcoo,
it_docs TYPE STANDARD TABLE OF docs,
it_lines TYPE STANDARD TABLE OF tline,
st_job_output_info TYPE ssfcrescl,
st_document_output_info TYPE ssfcrespd,
st_job_output_options TYPE ssfcresop,
st_output_options TYPE ssfcompop,
st_control_parameters TYPE ssfctrlop,
v_len_in TYPE so_obj_len,
v_language TYPE sflangu VALUE 'E',
v_e_devtype TYPE rspoptype,
v_bin_filesize TYPE i,
v_name TYPE string,
v_path TYPE string,
v_fullpath TYPE string,
v_filter TYPE string,
v_uact TYPE i,
v_guiobj TYPE REF TO cl_gui_frontend_services,
v_filename TYPE string.
******USER INTERACTION OPTION FOR THE INVOICE NO
SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE r.
PARAMETERS: invoice LIKE ZSDTANNXINV-vbeln obligatory .
SELECTION-SCREEN : END OF BLOCK b1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR invoice.
REFRESH i_vbrk.
SELECT vbeln FROM vbrk INTO TABLE i_vbrk.
IF sy-subrc IS INITIAL.
prog = sy-repid.
dynnr = sy-dynnr.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = ' '
retfield = 'VBELN'
dynpprog = prog
dynpnr = dynnr
dynprofield = 'INVOICE'
value_org = 'S'
TABLES
value_tab = i_vbrk.
FIELD_TAB =
RETURN_TAB =
DYNPFLD_MAPPING =
exceptions
parameter_error = 1
no_values_found = 2
others = 3
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
at selection-screen on invoice.
if invoice is not initial.
clear v_vbeln.
select single vbeln from ZSDTANNXINV into v_vbeln where vbeln = invoice.
if sy-subrc is not initial.
message 'Enter Valid Document No' type 'E'.
endif.
endif.
START-OF-SELECTION.
perform get_data.
perform process_data.
*& Form get_data
text
--> p1 text
<-- p2 text
form get_data .
IF INVOICE IS NOT INITIAL.
SELECT VBELN
VTEXT
NETWT
GROSSWT
vsslname
kindofpack
INCO1
INCO2
REMDATE
DESTINATION
SHPNGLIN1
CNTRNO
TRAILERNO1
ETDDATE
ETADATE
baanr
FROM ZSDTANNXINV
INTO TABLE I_HEAD
WHERE VBELN = INVOICE.
ENDIF.
IF I_HEAD[] IS NOT INITIAL.
select vbeln
POSNR
MATNR
MAKTX
meins
RATE
VALUE
WAERK
PRPOSNR
from zsafii
into corresponding fields of table i_final
for all entries in i_head
where vbeln = i_head-vbeln.
ENDIF.
describe table i_final lines cnt.
idx = 1.
loop at i_final into w_final.
if idx le cnt.
read table i_head into w_head with key vbeln = w_final-vbeln.
if sy-subrc is initial.
move-corresponding w_head to w_final.
modify i_final from w_final index idx.
idx = idx + 1.
endif.
endif.
endloop.
endform. " get_data
*& Form process_data
text
--> p1 text
<-- p2 text
form process_data .
CALL FUNCTION 'SSF_GET_DEVICE_TYPE'
EXPORTING
i_language = v_language
i_application = 'SAPDEFAULT'
IMPORTING
e_devtype = v_e_devtype.
st_output_options-tdprinter = v_e_devtype.
*st_output_options-tdprinter = 'locl'.
st_control_parameters-no_dialog = 'X'.
st_control_parameters-getotf = 'X'.
sort i_final by vbeln.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'Y_SSF_PRESHIPMENT'
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
FM_NAME = FNAM
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 fnam is not initial.
CALL FUNCTION FNAM
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS = st_control_parameters
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS = st_output_options
USER_SETTINGS = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO = st_document_output_info
JOB_OUTPUT_INFO = st_job_output_info
JOB_OUTPUT_OPTIONS = st_job_output_options
TABLES
itab = I_FINAL
i_head = I_HEAD
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
.........................CONVERT TO OTF TO PDF.......................
CALL FUNCTION 'CONVERT_OTF_2_PDF'
IMPORTING
bin_filesize = v_bin_filesize
TABLES
otf = st_job_output_info-otfdata
doctab_archive = it_docs
lines = it_lines
EXCEPTIONS
err_conv_not_possible = 1
err_otf_mc_noendmarker = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
........................GET THE FILE NAME TO STORE....................
CONCATENATE 'smrt' '.pdf' INTO v_name.
CREATE OBJECT v_guiobj.
CALL METHOD v_guiobj->file_save_dialog
EXPORTING
default_extension = 'pdf'
default_file_name = v_name
file_filter = v_filter
CHANGING
filename = v_name
path = v_path
fullpath = v_fullpath
user_action = v_uact.
IF v_uact = v_guiobj->action_cancel.
EXIT.
ENDIF.
..................................DOWNLOAD AS FILE....................
MOVE v_fullpath TO v_filename.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = v_bin_filesize
filename = v_filename
filetype = 'BIN'
TABLES
data_tab = it_lines
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.
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.
********************************************************************8
endform. " process_data
Similar Messages
-
Display SMART form as PDF in WD ABAP
Hi ,
To display smart form as PDF , I am following the SDN article :
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0de1eb8-0b98-2910-7996-8a3c2fcf6785?quicklink=index&overridelayout=true
In my component , I have created the view VIEW_PDF, for this . I have created Adobe interactive UI element, and bind the property source to the attribute (XSTRING) where I will get PDF (after OTF conversion).
First of all I am using the FM SSF_FUNCTION_MODULE_NAME and usingf the import parameter fm_name .
Then using this FM
CALL FUNCTION lv_fm_name
EXPORTING
OUTPUT_OPTIONS = lwa_output_options
GW_VENREQDAT = lwa_venreqdat
GW_REQHEADER = lwa_venreqhdr
IMPORTING
JOB_OUTPUT_INFO = lv_ssf_output.
from smart form ZVM_SFM_SUMMARY,I want to get the data in OTF format using the importing parameter JOB_OUTPUT_INFO of the above FM.
But I am not able to retrieve the data .Please direct me , where am I missing?
For converting it to PDF , I am using the FM CONVERT_OTF .
regards,
amitYou may continue like this there after...
call function w_fmodule
exporting
control_parameters = w_cparam
output_options = w_outoptions ":lv_output_options
user_settings = ' '
importing
job_output_info = t_otf_from_fm
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_otf_from_fm-otfdata[].
call function 'SSFCOMP_PDF_PREVIEW'
exporting
i_otf = t_otf
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.
call function 'CONVERT_OTF'
exporting
format = 'PDF'
* max_linewidth = 132
importing
bin_filesize = pdf_size
bin_file = pdf_data
tables
otf = t_otf[]
lines = l_dummy
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.
data lv_source like ls_pdf-source.
* navigate from <CONTEXT> to <PDF> via lead selection
lo_nd_pdf = wd_context->get_child_node( name = wd_this->wdctx_pdf ).
* get element via lead selection
lo_el_pdf = lo_nd_pdf->get_element( ).
* get single attribute
lo_el_pdf->set_attribute(
exporting
name = `SOURCE`
value = pdf_data ).
Regards
Gopi -
Action Profile - Display SMART FORM in PDF
Hi All,
I have a requirement in action profile, in which when a SMART FORM PRINT action is triggered in CRMD_ORDER, the smart form should be displayed in PDF. Then the user should be able to save or print the pdf form.
Can some body provide some pointers?Hi,
You can achieve this using action profile in your transaction type, just create new action definiation in action profile using Process type Smart Forms Print assign your smart form, define action conditions for this definiation.
You can take look at standard Action Profile for reference ACTIVITY definiation ACTIVITY_PRINT
Regards,
Dipesh. -
Conversion of Smart form to PDF in Webdypro UI
Hi Gurus,
I want to display a smart form as PDF by converting OTF to PDF and thereby passing the PDF format data to Interactive Form UI element in a Webdynpro application (via portal iview). Do I need ADS server for publishing the OTF converted PDF data in the Interactive Form UI element of the WDA framework.
Is there a better way to display a smartform in Webdynpro application by avoiding ADS?
Regards,
SubhadipHi Thomas,
Great to see reply from you. I still cherish the memories of your TechEd sessions that I have attended in 2007.
Well back to the topic I'm able to publish a Smartform as PDF via OTF conversion and passing the binary PDF string to pdfsource. While I'm testing the webdynpro application in the WebAS backend I can see the PDF screen with data but when I'm trying to run it from prortal as an iview I can only see a blank screen even without the PDF container. Can you please suggest me whether ADS is a requirement in this kind of scenario (ie portal integration via iview) or this different issue altogether. In case if you feel it's not due to ADS can you please give me a clue on the issue.
Regards,
Subhadip -
Creation of Smart Forms for PDF
Hi All,
I am new to SFP. So, please tell me how to create Smart Forms for PDF.
I already have an SAP standard form of Customer Invoice in this format (SFP) and I need to change the layout and add some additional fields in it as well.
Please guide me through the process. Earliest reponse will be highly appreciated.
Regards,
ShabbarHi,
I take that you meant PDF Forms in SAP.
Refer the following help links.
http://help.sap.com/saphelp_nw04s/helpdata/en/dc/f1783fe3263042e10000000a114084/content.htm
This PDF link (Has got many Pdf files)
https://www.sdn.sap.com/irj/sdn/interactiveforms?rid=/webcontent/uuid/d1088b7e-0c01-0010-c78e-984c0537e3ec [original link is broken]
Also check this Tech-ed 06 session at Amsterdam.
http://www.sapteched.com/emea/edu_sessions/session.htm?sid=317
Check this download from SDN.
https://www.sdn.sap.com/irj/sdn/downloaditem?rid=/library/uuid/2dd3dbcd-0401-0010-55b8-b10808ff688e
Is this you are looking for?
Feel free to revert back.
--Ragu -
Problem in converting smart form into PDF
HI Experts,
I am using a Function Module CONVERT_OTF for converting smart form into pdf file for send it to with attachment.
But i got a error when i am using that FM.
Runtime Errors CONVT_NO_NUMBER
unable to interpret *292 as a no.
Is that because my file size too large about 13 pages of PDF?
and when i run it for other smart forms which have 2 or 3 pages of PDF, its working perfectly.
can anyone tell what is problem with that FM?
Thanks
ShakunHi,
I had the similar issue and after analysis I have that this is the issue by not passing the IMPORTING parameter of the Function Module "BIN_FILESIZE". Please try to pass some variable to this paramter and then this will be completely rectified.
DATA ; v_filesize TYPE i.
*--Convert OTF data to PDF data
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = v_filesize
TABLES
otf = it_otfdata
lines = it_pdfdata
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
err_bad_otf = 4
OTHERS = 5.
Please verify whether this reolves the problem for you.
Regards,
SRinivas -
How to convert Smart Form into PDF format and return the result in BAPI?
I want to convert a Smart Form into PDF format and return the result in BAPI.
can anyone tell me how it can be done with related example
regards
pranayhi,
smart form to pdf--
All you have to do is call your SF to get OTF and then concert it to PDF. Works like charm:
DATA: p_output_options TYPE ssfcompop,
p_control_parameters TYPE ssfctrlop.
p_control_parameters-no_dialog = 'X'.
p_control_parameters-getotf = 'X'.
CALL FUNCTION v_func_name "call your smartform
EXPORTING
output_options = p_output_options
control_parameters = p_control_parameters
IMPORTING
job_output_info = s_job_output_info.
call function 'CONVERT_OTF_2_PDF'
tables
otf = s_job_output_info-otfdata
lines = t_pdf
and if u need more u can check below links also
Check the below links..
Re: Smartforms to PDF
Re: smartform (otf) as pdf and sending as email-attachment
VISIT THIS LINK
Re: Smartforms to PDF
PLZ REWARD POINTS IF IT HELPS YOU
rgds
anver -
How to show Smart form in PDF format
Hi Experts,
I have a requirement in which I have to show a smart form in
PDF Format coming from the RFC .
Please give your helpful suggestion.
Thanks and Regards
Upendra AgrawalHi ,
Just look this pdf
see this link
http://www.****************/Tutorials/Smartforms/SFinEPasPDF/Page1.htm
Thanks
Edited by: Anup Bharti on Nov 7, 2008 7:00 AM -
dear experts,
do you have any experience with the forms in GTS. we have to print LTVD (long term vendor declarations) and have to decide wether to go for smart forms or pdf (adobe, incl this java stacks and ads configuration)
appreciate any experience feedback.
many thanks for you time
peterHi,
No, there is no technical restriction on using particular layout. u can use whatever u wanna to use. For know more about smartforms go thru,
http://help.sap.com/saphelp_47x200/helpdata/en/a5/de6838abce021ae10000009b38f842/frameset.htm
Smartform have following advantages:
1. Creating and maintaining forms in less time than SAPScript.
2. Adapting forms without any programming knowledge due to entirely graphical user interface. ( ofcourse you need to write driver program for smartforms, but you can write most of your code in smartform itself.. see the above given link for more detail)
3. Integrating input elements into the HTML output, which enables you to use a form in Internet applications as well.
I hope this will help you.
Pratik -
How to display smart form stored in SAP in Webdynpro java( TLINE table)
Hi
I have a requirement where I have to display the smart form from WD Java end.
The BAPI is producing output in TLINE(TDLINE(132),TDFORMAT(2)). I am trying to concat both(TDLINE+TDFORMAT) and put in the interactive form but I am not able to get the output from BAPI.
Is it because the TLINE format is not supported in the WD java. How can I solve the issue.
Looking forward for the reply.
Regards,
PawanHi..
Try this PDF URL.... u might get useful things...
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/8fd773b3-0301-0010-eabe-82149bcc292e
Web Dynpro Java
yours GS -
Hello Abapers ,
I have to display the smart form generated to be displayed in the PDF format. I have no idea regarding this Process.Can anyone pls let me know the process....
Thanks
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Apr 11, 2008 1:21 PMSummury: Converting the smartfrom to PDF is process of 3 simple steps.
Calling the Smart form, then it returns the OTF data in Return.
Converting the OTF data into required format using the Function Module CONVERT_OTF_2_PDF.
Download the File
*& Report ZTEST_NREDDY_PDF
REPORT ZTEST_NREDDY_PDF.
DATA: it_otf TYPE STANDARD TABLE OF itcoo,
it_docs TYPE STANDARD TABLE OF docs,
it_lines TYPE STANDARD TABLE OF tline,
st_job_output_info TYPE ssfcrescl,
st_document_output_info TYPE ssfcrespd,
st_job_output_options TYPE ssfcresop,
st_output_options TYPE ssfcompop,
st_control_parameters TYPE ssfctrlop,
v_len_in TYPE so_obj_len,
v_language TYPE sflangu VALUE 'E',
v_e_devtype TYPE rspoptype,
v_bin_filesize TYPE i,
v_name TYPE string,
v_path TYPE string,
v_fullpath TYPE string,
v_filter TYPE string,
v_uact TYPE i,
v_guiobj TYPE REF TO cl_gui_frontend_services,
v_filename TYPE string,
v_fm_name TYPE rs38l_fnam.
CONSTANTS c_formname TYPE tdsfname VALUE 'ZTEST'.
CALL FUNCTION 'SSF_GET_DEVICE_TYPE'
EXPORTING
i_language = v_language
i_application = 'SAPDEFAULT'
IMPORTING
e_devtype = v_e_devtype.
st_output_options-tdprinter = v_e_devtype.
*st_output_options-tdprinter = 'locl'.
st_control_parameters-no_dialog = 'X'.
st_control_parameters-getotf = 'X'.
.................GET SMARTFORM FUNCTION MODULE NAME.................
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = c_formname
IMPORTING
fm_name = v_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.
...........................CALL SMARTFORM............................
CALL FUNCTION v_fm_name
EXPORTING
control_parameters = st_control_parameters
output_options = st_output_options
IMPORTING
document_output_info = st_document_output_info
job_output_info = st_job_output_info
job_output_options = st_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.
ELSE.
.........................CONVERT TO OTF TO PDF.......................
CALL FUNCTION 'CONVERT_OTF_2_PDF'
IMPORTING
bin_filesize = v_bin_filesize
TABLES
otf = st_job_output_info-otfdata
doctab_archive = it_docs
lines = it_lines
EXCEPTIONS
err_conv_not_possible = 1
err_otf_mc_noendmarker = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
........................GET THE FILE NAME TO STORE....................
CONCATENATE 'smrt' '.pdf' INTO v_name.
CREATE OBJECT v_guiobj.
CALL METHOD v_guiobj->file_save_dialog
EXPORTING
default_extension = 'pdf'
default_file_name = v_name
file_filter = v_filter
CHANGING
filename = v_name
path = v_path
fullpath = v_fullpath
user_action = v_uact.
IF v_uact = v_guiobj->action_cancel.
EXIT.
ENDIF.
..................................DOWNLOAD AS FILE....................
MOVE v_fullpath TO v_filename.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = v_bin_filesize
filename = v_filename
filetype = 'BIN'
TABLES
data_tab = it_lines
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.
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.
Regards,
Raj. -
Smart Form as PDF within iframe
Hi all,
the problem i'm facing today is that i can't display a SMART FORM as a PDF in an <iframe> Tag.
If i call a simple PDF (which is stored on my PC as a local file) everything works fine and the PDF is
shown within the iframe Tag.
<html>
<head>
</head>
<body>
Test<p>
<iframe src="C:Test.pdf" width="90%" height="400" name="test"></iframe>
</body>
</html>
If i try to do the same with my test BSP the PDF is not shown within iframe Tag. Instead the iframe Tag
stays empty and the PDF is called directly by the Adobe Reader and not by my Browser (IE7).
<html>
<head>
</head>
<body>
Test<p>
<iframe src="https://vsapex2ci.daksap.de:44320/sap/bc/bsp/sap/zpdf_test/test.htm"
width="90%" height="400" name="test"></iframe>
</body>
</html>
On my test.htm only OnInitialization is implemented. Here's the Code:
DATA: lv_pdf TYPE xstring,
ls_output_data TYPE ssfcrescl,
ls_ctrl_param TYPE ssfctrlop,
lv_fm_name TYPE rs38l_fnam,
lt_lines TYPE TABLE OF tline,
lv_pdf_len TYPE i.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZTESTPDF'
IMPORTING
fm_name = lv_fm_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
ls_ctrl_param-no_dialog = 'X'.
ls_ctrl_param-getotf = 'X'.
CALL FUNCTION lv_fm_name
EXPORTING
CONTROL_PARAMETERS = ls_ctrl_param
USER_SETTINGS = space
IMPORTING
JOB_OUTPUT_INFO = ls_output_data
* Conversion of output format OTF into PDF format
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
IMPORTING
bin_filesize = lv_pdf_len
bin_file = lv_pdf
TABLES
otf = ls_output_data-otfdata
lines = lt_lines.
response->set_header_field( name = 'content-type'
value = 'application/pdf' ).
response->set_header_field( name = 'cache-control'
value = 'max-age=0' ).
response->set_header_field( name = 'content-disposition'
value = 'attachment; filename=test.pdf' ).
lv_pdf_len = XSTRLEN( lv_pdf ).
response->set_data( data = lv_pdf
length = lv_pdf_len ).
navigation->response_complete( ).
How can i display my generated PDF (SMART FORM) within an iframe Tag?
Regards
Mark-Andréhere is the code
data: cached_response type ref to if_http_response.
create object cached_response type cl_http_response exporting add_c_msg = 1.
cached_response->set_data( file_content ).
cached_response->set_header_field( name = if_http_header_fields=>content_type
value = file_mime_type ).
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 into display_url.
cl_http_server=>server_cache_upload( url = display_url
response = cached_response ).
return.
now in the layout use display_url as the src for iframe
Raja -
Convertion of Smart form to pdf and sending mail to vendor for PO
Hello all,
I have modified a standard PO Smartform and running it through ME23N.
In this i have to convert it to a pdf file and then send it through mail to the vendor.
I have found out FMs'CONVERT_OTF'and
'SO_NEW_DOCUMENT_ATT_SEND_API1'
to convert it and send mail. But can u tell me how to go about using it.
As i am using a standard program do i have to copy this prog to zprog and then call the fm out there. I am not sure.
Thanks
SalilHi,
Here is the sample code.If you find this as useful,kindly reward points by clicking the star on the left of reply.
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
w_objhead TYPE soli_tab,
w_ctrlop TYPE ssfctrlop,
w_compop 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
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 = 'ZZZ_TEST2'
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.
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 v_lines_bin.
Object with main text of the mail.
i_objtxt = 'Find attached the output of the smart form.'.
APPEND i_objtxt.
i_objtxt = 'Regards,'.
APPEND i_objtxt.
i_objtxt = 'J.Jayanthi'.
APPEND i_objtxt.
DESCRIBE TABLE i_objtxt LINES v_lines_txt.
Document information.
w_doc_chng-obj_name = 'Smartform'.
w_doc_chng-expiry_dat = sy-datum + 10.
w_doc_chng-obj_descr = 'Smart form output'.
w_doc_chng-sensitivty = 'F'. "Functional object
w_doc_chng-doc_size = v_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 = v_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 = v_lines_bin.
i_objpack-doc_type = 'PDF'.
i_objpack-obj_name = 'Smartform'.
CONCATENATE 'Smartform_output' '.pdf'
INTO i_objpack-obj_descr.
i_objpack-doc_size = v_lines_bin * 255.
APPEND i_objpack.
Document information.
CLEAR i_reclist.
e-mail receivers.
i_reclist-receiver = '[email protected]'.
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_hex = 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. -
In our Travel and expenses implementation of ESS, The display trip shows up in HTML. I was wondering how/if we can show up the form in pdf instead.
Thanks.Hello Christopher,
thats actually exactly how it does work. You embed a Adobe UI element into your Web Dynpro application, either ABAP via SE80 or Java via NWDS. If you "design" it, the installed Adobe Livecycle Designer gets called right into your IDE (SE80/NWDS), its kinda like you click a *.doc element and your Word gets open.
What i have learned, especially if it comes to HCM processes and forms and Interactive forms in general, is that you should always use the lastest Adobe Designer, which is right now 7.10. The big advantage if you install it seperatly you can remove and install a new version easily. If you install the Adobe Designer along the NWDS and SAP GUI you have to remove the entire IDE (SAP GUI / NWDS) in order to install a "new" version of Adobe Designer (I actually had this problem a few weeks ago with my NWDS) And as i have already posted, afaik the version which comes alaong the SAP Gui / NWDS is still the "old" one 6.0
I hope this helps
Markus -
Display W2 form in PDF format in ESS
I am trying to develop a WebDynpro ABAP application to display W2 Form in the Portal 7.0 ESS. I have designed a view with an Adobe Form element to hold the W2 form, and looking for any ideas about getting W2 form in PDF format from the ECC 6.0 system by providing parameters like EE number, Tax Company, and year.
I know that the tcode PU19 can be used for getting W2 in PDF format, but it involves too many steps to generate and view the W2 in PDF format. I am not sure what kind of coding (e.g. classes, methods, logic to retrieve W2) will I need to do in the Web Dynpro application to retrieve W2 in PDF format from the ECC system.
I will appreciate and reward any useful answers or pointers.
Thanks,
SaurabhSaurabh,
Have you found a way to produce the W2s without using tcode PU19. I am looking at doing W2s in ESS for our company and am interested in anything you have done on this.
Thanks,
Robert
Maybe you are looking for
-
How does the security model work for external USB disks attached to an AEBS
I've attached a USB disk to my AEBS after partitioning it first on my MBP using Disk Utility. I created a single partition with a GUID partition table covering the entire disk. Next I deselected the "Ignore ownership on this volume" checkmark and ass
-
Developer using ms sql as datasource
i'm trying to develope a program which retrieve data from ms sql database. the problem is when i use select statement in sqlplus there is no prob!! But when i try to query data in developer form!! problem occur!. it says datatype is not supported! th
-
Consignment Fill up Process(with Bebit and credit entries)
Hi all, I want to do following entries in consignmen Fillup process. 1)consignmen Fillup:- Goods on sale consignee Cr. Consignment Agent Dr. since proforma invoice is gets created in Fill up process, shall i configure cmer
-
WLC 5508 not communicating with ACS 4.2
Hi, Strange one here, I have setup a WLAN with PEAP user authentication through ACS to the Windows database. My clients cannot connect to the WLAN. From the logs, I can see no activity on the Radius server stats (as seen from the controller) and no f
-
Is there a manual for PS Touch?
I need to merge images from two photos but even looking at the tutorials I can't understand how to do this. Any help would be very much appreciated!