method ONACTIONPRINT .
CONSTANTS: c_f_x(1) TYPE c VALUE 'X'.
DATA: l_f_fm_name TYPErs38l_fnam.
DATA: l_current_controllerTYPE REF TO if_wd_controller,
l_message_manager TYPE REF TO if_wd_message_manager.
DATA : Z_BID_INFO TYPE STANDARD TABLE OFZSRMII_BID_VEN .
DATA:
node_zbid_info TYPE REF TO if_wd_context_node,
elem_zbid_info TYPE REF TO if_wd_context_element,
stru_zbid_info TYPE if_result_view=>element_zbid_info .
* navigate from<CONTEXT> to<ZBID_INFO> via lead selection
node_zbid_info = wd_context->get_child_node( name =if_result_view=>wdctx_zbid_info ).
* get element via leadselection
elem_zbid_info =node_zbid_info->get_element( ).
* get all declaredattributes
elem_zbid_info->get_static_attributes(
IMPORTING
static_attributes = stru_zbid_info ).
APPENDstru_zbid_info TO Z_BID_INFO .
IFstru_zbid_info-OBJECT_ID IS NOT INITIAL .
TRY.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZSRMII_WDA_0013'
IMPORTING
fm_name = l_f_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.
CATCH cx_fp_api_repository.
RETURN.
CATCH cx_fp_api_usage.
RETURN.
CATCH cx_fp_api_internal.
RETURN.
ENDTRY.
CHECK l_f_fm_name IS NOT INITIAL.
* Set relevant controlparameters
DATA: l_f_rspoptype TYPE rspoptype.
CALL FUNCTION 'SSF_GET_DEVICE_TYPE'
EXPORTING
i_language = '1'
IMPORTING
e_devtype = l_f_rspoptype
EXCEPTIONS
no_language = 1
language_not_installed = 2
no_devtype_found = 3
system_error = 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: l_s_control_parameters TYPE ssfctrlop.
l_s_control_parameters-getotf = c_f_x. "OTF output
l_s_control_parameters-no_dialog = c_f_x. "No print dialog
l_s_control_parameters-preview = space. "No preview
* l_s_control_parameters-langu = sy-langu.
* Set relevant outputoptions
DATA: l_s_output_options TYPE ssfcompop.
l_s_output_options-tdnewid =c_f_x. "Print parameters: Spool control
l_s_output_options-tddelete =space. "Print parameters: Spool control
l_s_output_options-tdprinter = l_f_rspoptype.
l_s_output_options-tddest = 'DEFAULT'.
DATA: l_s_job_output_info TYPE ssfcrescl.
CALL FUNCTION l_f_fm_name
EXPORTING
control_parameters = l_s_control_parameters
output_options = l_s_output_options
IMPORTING
job_output_info = l_s_job_output_info
TABLES
Z_BID_INFO = Z_BID_INFO
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.
RETURN.
ENDIF.
* 产生PDF源数据
WD_COMP_CONTROLLER->generate_pdf_xstring(
s_job_output_info = l_s_job_output_info
).
* invoke PDF view
WD_COMP_CONTROLLER->create_popup(
i_f_title = '供应商认证'
i_f_view_name = 'POPUP_PDF'
).
ELSE .
"查询成功
l_current_controller ?= wd_this->wd_get_api( ).
CALL METHODl_current_controller->get_message_manager
RECEIVING
message_manager = l_message_manager .
* report message
CALL METHODl_message_manager->report_t100_message
EXPORTING
MSGID = 'Z_SRM_MESSAGE'
MSGNO = '047'
MSGTY = 'E' .
ENDIF .
endmethod.
上面调用WD_COMP_CONTROLLER->create_popup 和WD_COMP_CONTROLLER->generate_pdf_xstring方法
下面为这两个方法:
method CREATE_POPUP .
DATA: l_ref_component TYPE REF TOif_wd_component.
CHECK i_f_view_name IS NOT INITIAL.
l_ref_component =wd_this->wd_get_api( ).
TRY.
CALL METHODcl_wdr_runtime_services=>display_view_in_popup
EXPORTING
component = l_ref_component
* target_component_name =
* target_cmp_usage_name =
* target_window_name =
target_view_name = i_f_view_name
modal = abap_true
window_title = i_f_title
close_button = abap_true
* button_kind =
* create_only = abap_false
* message_type = if_wd_window=>co_msg_type_none
* is_value_help = abap_false
* close_in_any_case = abap_true
* message_display_mode =
* default_button =
* IMPORTING
* popup_window =
* component_usage =
.
CATCHcx_wd_runtime_repository .
ENDTRY.
endmethod.
method GENERATE_PDF_XSTRING .
DATA:l_itab_otfdata TYPE tsfotf.
* Smart Forms: Smart Composer
l_itab_otfdata = s_job_output_info-otfdata.
CALL FUNCTION 'SSFCOMP_PDF_PREVIEW'
EXPORTING
i_otf = l_itab_otfdata
EXCEPTIONS
convert_otf_to_pdf_error = 1
cntl_error = 2
OTHERS = 3.
IF sy-subrc <>0.
MESSAGE IDsy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
DATA: l_dummy TYPE STANDARDTABLE OF tline,
pdf_data TYPE xstring,
pdf_size TYPE i.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
* MAX_LINEWIDTH = 132
* ARCHIVE_INDEX = ' '
* COPYNUMBER = 0
* ASCII_BIDI_VIS2LOG = ' '
* PDF_DELETE_OTFTAB = ' '
IMPORTING
bin_filesize = pdf_size
bin_file = pdf_data
TABLES
otf = l_itab_otfdata[]
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 IDsy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
RETURN.
ENDIF.
DATA:
node_pdf TYPE REF TO if_wd_context_node,
elem_pdf TYPE REF TO if_wd_context_element,
stru_pdf TYPE if_componentcontroller=>element_pdf .
* navigate from <CONTEXT> to<PDF> via lead selection
node_pdf =wd_context->get_child_node( name =if_componentcontroller=>wdctx_pdf ).
* get element via lead selection
elem_pdf =node_pdf->get_element( ).
** get all declared attributes
* elem_pdf->get_static_attributes(
* IMPORTING
* static_attributes = stru_pdf ).
* set single attribute
CALL METHODelem_pdf->set_attribute
EXPORTING
value = pdf_data
name = 'SOURCE' .
endmethod.
需要建一个node 里面有个一个xstring类型的attribute ,对interactiveforms进行绑定!