1> Create smart form in Tcode: SMARTFORMS
YTEST_SF_001
Preview:
2> Create WDA Component
3> Assign UI elements to V_MAIN view:
Download file button and Interactive Form for displaying pdf
4> Design view context
Set supply function for Node N_PDF.
Db click SUPPLY_PDF
method supply_pdf .
data: l_x
data: ls_control_parameters type ssfctrlop,
data: lt_otfdata
* 1. get smartform
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
importing
exceptions
others
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 into l_message.
return.
endif.
* Set relevant control parameters
* Set relevant output options
"!!!Check your print device to ensure support UNICODE.
call function l_fm_name
exporting
*
*
*
*
*
*
*
*
*
importing
*
*
exceptions
others
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 into l_message.
return.
endif.
refresh lt_otfdata.
*2. Convert to PDF
data: l_dummy
clear: l_pdf_data, l_pdf_size.
* convert otf to pdf
call function 'CONVERT_OTF'
exporting
format
importing
tables
lines
exceptions
others
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 into l_message.
return.
endif.
*
** data declaration
data: ls_n_pdf type wd_this->element_n_pdf,
*** bind a single element
endmethod.
5> Design button action to DOWNLOAD FILE.
Action source:
data: lo_nd_n_pdf type ref to if_wd_context_node,
data: ls_n_pdf
*
*
*
if lo_el_n_pdf is initial.
return.
endif.
*
exporting
importing
value = lv_content ).
call method cl_wd_runtime_services=>attach_file_to_response
exporting
*
*
6> Test Application