on 10-30-2013 8:29 PM
Hello,
I am having problem to get the exercise 4 work properly. As shown in the attached image, the pop-up does not show the content of the internal table that has been binded in the method DISPLAY_DETAILS on the sub-component.
Method in the sub component:
method DISPLAY_DETAILS .
DATA: lt_bookings TYPE wd_this->elements_bookings,
lo_nd_bookings TYPE REF TO if_wd_context_node.
CLEAR lt_bookings[].
SELECT * INTO CORRESPONDING FIELDS OF TABLE lt_bookings
FROM sbook WHERE carrid = is_flight-carrid
AND connid = is_flight-connid
AND fldate = is_flight-fldate.
* bind all the elements
lo_nd_bookings = wd_context->get_child_node( if_componentcontroller=>wdctx_bookings ).
lo_nd_bookings->bind_table( lt_bookings ).
endmethod.
Methods in the main component:
method PROCESS_SUB_COMP .
DATA lo_nd_flights TYPE REF TO if_wd_context_node.
DATA lo_el_flights TYPE REF TO if_wd_context_element.
DATA ls_flights TYPE wd_this->element_flights.
*navigate from <CONTEXT> to <FLIGHTS> via lead selection
lo_nd_flights = wd_context->path_get_node( path = 'CONNECTION.FLIGHTS' ).
*get element via lead selection
lo_el_flights = lo_nd_flights->get_element( ).
*get all declared attributes
lo_el_flights->get_static_attributes( IMPORTING static_attributes = ls_flights ).
DATA lo_nd_sub_comp_info TYPE REF TO if_wd_context_node.
DATA lo_el_sub_comp_info TYPE REF TO if_wd_context_element.
DATA ls_sub_comp_info TYPE wd_this->element_sub_comp_info.
* DATA ls_sub_comp_info TYPE if_componentcontroller=>element_sub_comp_info.
DATA lv_name TYPE wd_this->element_sub_comp_info-name.
*read from context, which component implementing the same comp interface
*has to be instantiated
* lo_nd_sub_comp_info = wd_context->get_child_node( name = if_componentcontroller=>wdctx_sub_comp_info ).
lo_nd_sub_comp_info = wd_context->path_get_node( path = 'CONNECTION.SUB_COMP_INFO' ).
lo_el_sub_comp_info = lo_nd_sub_comp_info->get_element( ).
lo_el_sub_comp_info->get_attribute( EXPORTING name = 'NAME'
IMPORTING value = lv_name ).
data: lo_cmp_usage TYPE REF TO if_wd_component_usage,
lo_interfacecontroller TYPE REF TO ziwci_00_net311_04_if_abel.
*instantiate component usage if necessary
lo_cmp_usage = wd_this->wd_cpuse_details_comp( ).
IF lo_cmp_usage->has_active_component( ) IS INITIAL.
lo_cmp_usage->create_component( component_name = lv_name ).
ENDIF.
*pass key fields of selected flight to used component instance
lo_interfacecontroller = wd_this->wd_cpifc_details_comp( ).
lo_interfacecontroller->display_details( is_flight = ls_flights ).
endmethod.
method ONACTIONDISP_DETAILS_SUBCOMP .
*
DATA: lr_window_manager TYPE REF TO if_wd_window_manager,
lr_cmp_api TYPE REF TO if_wd_component,
lv_text TYPE string.
CONSTANTS: lv_if_name TYPE string VALUE 'DETAILS_WINDOW',
lv_cmp_name TYPE string VALUE 'DETAILS_COMP'.
DATA lo_componentcontroller TYPE REF TO ig_componentcontroller.
*Read window title from assistance class
lv_text = wd_assist->get_text( '003' ).
*Call the component controller method PROCESS_SUB_COMP( ).
*Instantiate component usage and pass key of selected flight to this comp. usage
lo_componentcontroller = wd_this->get_componentcontroller_ctr( ).
* lo_componentcontroller->process_sub_comp( ).
wd_comp_controller->process_sub_comp( ).
*Create modal dialog box sending window of own component
*Get reference to the compenent's controller application interface
lr_cmp_api = wd_comp_controller->wd_get_api( ).
*Get referece to the Window Manager on the compenent's controller application interface
lr_window_manager = lr_cmp_api->get_window_manager( ).
*Create window from the referece to in Window Manager
wd_comp_controller->gr_window =
lr_window_manager->create_window_for_cmp_usage(
interface_view_name = lv_if_name
component_usage_name = lv_cmp_name
title = lv_text
close_in_any_case = abap_false ).
*Open dialog box of the newly created window
wd_comp_controller->gr_window->open( ).
endmethod.
method WDDOINIT .
*Get message manager
DATA lo_api_controller TYPE REF TO if_wd_controller.
DATA lo_message_manager TYPE REF TO if_wd_message_manager.
lo_api_controller ?= wd_this->wd_get_api( ).
CALL METHOD lo_api_controller->get_message_manager
RECEIVING
message_manager = wd_this->gr_mess_man.
endmethod.
Kind regards and thanks in advance.
Primo.
Hello,
I have looked to the exercise and what you need to do to be sure after you write the code are the following steps :
1. You need to Embedd the 2 Component (Used Component) in your 1 Component (Usage Component)
2. Then you need to Declare that you Use the second Component also in the View from where are you instantiate the second Component and where you call your interface method that you pass the data : LS_SFLIGHT
3. Your Interface need to be a Interface Method if you want to call it from your 1 Component, than you will get a compile error, it needs to be a Interface Method, because you call it from another Component.
4. You need to be sure that You have Embedd the View from your 2 Component in the View, because if now you will receive a blue screen, without any data, like in your case now.
I hope this will help you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.