- The structure of web dynpro component is shown below.
Implementation of each action created above is written below.
method onactiongo .* implicitly available data objects
* wd_Context type ref to if_wd_context_node.
* wd_This type ref to if_v1.
data: message_node type ref to if_wd_context_node.data: input_node type ref to if_wd_context_node,
text_area_input type string.
input_node = wd_context->get_child_node( 'NODE1' ).
message_node = wd_context->get_child_node( 'MESSAGES' ).
message_node->invalidate( ).endmethod.
* wd_Context type ref to if_wd_context_node.
* wd_This type ref to if_v1.
data: message_node type ref to if_wd_context_node.data: input_node type ref to if_wd_context_node,
text_area_input type string.
input_node = wd_context->get_child_node( 'NODE1' ).
message_node = wd_context->get_child_node( 'MESSAGES' ).
message_node->invalidate( ).endmethod.
-----------------------------------------------------------------------------
method onactiongoval .* just default handling
endmethod.
endmethod.
-----------------------------------------------------------------------------
method onactionset_ctxt .
data: node_1 type ref to if_wd_context_node.
node_1 = wd_context->get_child_node( 'NODE1' ).
node_1->set_attribute( name = 'DATE' value = '20041225' ).endmethod.
data: node_1 type ref to if_wd_context_node.
node_1 = wd_context->get_child_node( 'NODE1' ).
node_1->set_attribute( name = 'DATE' value = '20041225' ).endmethod.
-----------------------------------------------------------------------------
method onactionset_value .wd_this->correct_value = 'ABC'.endmethod.
Methods Created in Component Controller are shown below.
Implementation of each method shown above is written below.-----------------------------------------------------------------------------
method supply_messages .
data: context type ref to if_wd_context,
component type ref to if_wd_component,
exception_manager type ref to cl_wdr_message_manager,
context_is_valid type abap_bool.
data: text1 type if_v1=>element_messages,
texts type table of if_v1=>element_messages,
messages type string_table.
component = wd_comp_controller->wd_get_api( ).
exception_manager ?= component->get_message_manager( ).
context = wd_context->get_context( ).
context_is_valid = exception_manager->if_wd_validation~is_context_valid(
context = context ).
if context_is_valid = abap_false.
messages = exception_manager->if_wd_validation~get_messages_for_context(
context = context ).
loop at messages into text1-text.
append text1 to texts.
endloop.
node->bind_elements( texts ).
endif.endmethod.
data: context type ref to if_wd_context,
component type ref to if_wd_component,
exception_manager type ref to cl_wdr_message_manager,
context_is_valid type abap_bool.
data: text1 type if_v1=>element_messages,
texts type table of if_v1=>element_messages,
messages type string_table.
component = wd_comp_controller->wd_get_api( ).
exception_manager ?= component->get_message_manager( ).
context = wd_context->get_context( ).
context_is_valid = exception_manager->if_wd_validation~is_context_valid(
context = context ).
if context_is_valid = abap_false.
messages = exception_manager->if_wd_validation~get_messages_for_context(
context = context ).
loop at messages into text1-text.
append text1 to texts.
endloop.
node->bind_elements( texts ).
endif.endmethod.
-----------------------------------------------------------------------------
method supply_multinode .** data declaration
data:
itab_multinode type if_v1=>elements_multinode,
stru_multinode like line of itab_multinode.** @TODO compute values
** e.g. call a data providing FuBa
call method cl_wd_flight_model=>get_sflight_by_carrid
exporting
i_carrid = ''
importing
et_sflight = itab_multinode.*
** bind all the elements
node->bind_table(
new_items = itab_multinode
set_initial_elements = abap_true ).endmethod.
data:
itab_multinode type if_v1=>elements_multinode,
stru_multinode like line of itab_multinode.** @TODO compute values
** e.g. call a data providing FuBa
call method cl_wd_flight_model=>get_sflight_by_carrid
exporting
i_carrid = ''
importing
et_sflight = itab_multinode.*
** bind all the elements
node->bind_table(
new_items = itab_multinode
set_initial_elements = abap_true ).endmethod.
-----------------------------------------------------------------------------
method supply_node2 .data: flight type if_v1=>element_node2.flight-price = '12.34'.
flight-currency = 'EUR'.
node->bind_structure( flight ).endmethod.
This is how the output will look like.
Related Articles :
Basics of Web Dynpro ABAP
ABAP Data Types and Objects
ABAP Statements
WD4A - Topics to be covered in the upcoming posts
WD4A - Introduction
WDA - SAP Logon Procedures
WD4A-Format the Values appearing on value Axis of Business Graphic
WD4A-Navigate from one view to another and back to previous view
WD4A - How to Calculate next 12 months from current month in web dynpro ABAP
No comments:
Post a Comment
You are welcome to express your views here...