----------------------------------------------------------------------------------------------
Create a web dynpro component. Add a method in the component controller and Select the Interface checkbox.
Provide the exporting parameter of the method and the below code.
Go to the Interface Controller method. We can see here the methods which are defined in the component controller with Interface marked.
Create another web dynpro component and in the used component add the previous component and the component interface and provide a used web dynpro component name.
Add a Node ( cardinality 0..N) in the component controller node.
--------------------------------------------------------------------------------------------------------
METHOD wddoinit.
DATA: lr_cmp_usage TYPE REF TO if_wd_component_usage,
lr_cmp_usg_intf TYPE REF TO ziwci_test_004,
lr_ctrl TYPE REF TO if_wd_controller,
lt_flight TYPE wd_this->elements_sflight,
lo_nd_sflight TYPE REF TO if_wd_context_node.
lr_cmp_usage = wd_this->wd_cpuse_test_004( ).
IF lr_cmp_usage->has_active_component( ) IS INITIAL.
lr_cmp_usage->create_component(
EXPORTING
component_name = 'ZTEST_004' ).
ENDIF.
lr_cmp_usg_intf = wd_this->wd_cpifc_test_004( ).
lr_cmp_usg_intf->get_sflight_records(
IMPORTING
et_sflight = lt_flight ).
lo_nd_sflight = wd_context->get_child_node( name = wd_this->wdctx_sflight ).
lo_nd_sflight->bind_table( new_items = lt_flight set_initial_elements = abap_true ).
ENDMETHOD.
---------------------------------------------------------------------------------------------------------
In the layout, add a table and bond it to the context node.
Create an application and test.
-----------------------------------------------------------------------------------------------
Create a web dynpro component. Add a method in the component controller and Select the Interface checkbox.
Go to the Properties tab and add the reused components by selecting the Create button.
Go to the component controller and open the INIT method.
Instantiate the reused component and used component interface. Call the used interface method to get the flight table. and bind it to the context node.
METHOD wddoinit.
DATA: lr_cmp_usage TYPE REF TO if_wd_component_usage,
lr_cmp_usg_intf TYPE REF TO ziwci_test_004,
lr_ctrl TYPE REF TO if_wd_controller,
lt_flight TYPE wd_this->elements_sflight,
lo_nd_sflight TYPE REF TO if_wd_context_node.
lr_cmp_usage = wd_this->wd_cpuse_test_004( ).
IF lr_cmp_usage->has_active_component( ) IS INITIAL.
lr_cmp_usage->create_component(
EXPORTING
component_name = 'ZTEST_004' ).
ENDIF.
lr_cmp_usg_intf = wd_this->wd_cpifc_test_004( ).
lr_cmp_usg_intf->get_sflight_records(
IMPORTING
et_sflight = lt_flight ).
lo_nd_sflight = wd_context->get_child_node( name = wd_this->wdctx_sflight ).
lo_nd_sflight->bind_table( new_items = lt_flight set_initial_elements = abap_true ).
ENDMETHOD.
---------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
No comments:
Post a Comment