Sunday, February 26, 2012
Supply Function is used to repopulate child nodes when the lead selection in the parent node changes.
Supply function is called automatically by the Web Dynpro Runtime when an attempt is made to read an empty node collection. This situation occurs for following condition.
Supply function is called automatically by the Web Dynpro Runtime when an attempt is made to read an empty node collection. This situation occurs for following condition.
- The node is never populated before.
- The lead selection of the parent node is changed.
- Application coding has explicitly invalidated the element collection.
Few examples where we can use Supply function.
- Lets say we have two drop down boxes. For every selected entry from first drop down box, if you want to set different kind of values, Supply function can be useful.
- Lets say we have two tables. For every selected row from first Table, if you have multiple elements to be shown in table, Supply function can be useful.
- Create Web Dynpro component and Save.
- Go to Component Controller context ->Create one root node(EMP_INFO) under context node as shown below for Employee information table. Set cardinality to 0..n
- Create one child node e.g IT0006_DATA under EMP_INFO root node where EMP_INFO is the source of supply for the node IT0006_DATA. Cardinality 0...n and Supply function GET_ADD_DATA should be mentioned.
- Go to view VIEW1 ->Context. Map component controller context to view context by drag and drop method.
- Go to view layout ->Set ROOTUIELEMENTCONTAINER layout to MatrixLayout type.
- Create EMP_INFO table UI Element ->Set table caption and Table Layout data property to MatrixHeadData. Create binding as shown in the print screen.
- Create IT0006_DATA table UI Element ->Set table caption and Table Layout data property to MatrixHeadData. Create binding as shown in the print screen.
- Save and Go to COMPONENTCONTROLLER - >Methods - >WDDOINIT. Write the below code
METHOD wddoinit. DATA lo_nd_emp_info TYPE REF TO if_wd_context_node. DATA lt_emp_info TYPE wd_this->elements_emp_info. * navigate fromto via lead selection lo_nd_emp_info = wd_context->get_child_node( name = wd_this->wdctx_emp_info ). SELECT * FROM pa0002 INTO CORRESPONDING FIELDS OF TABLE lt_emp_info UP TO 50 ROWS. lo_nd_emp_info->bind_table( new_items = lt_emp_info set_initial_elements = abap_true ). ENDMETHOD.
- COMPONENTCONTROLLER - >Methods - >WDDOINIT. Write the below code
METHOD get_add_data . * General Notes * ============= * A common scenario for a supply method is to aquire key * informations from the parameterand then * to invoke a data provider. * A free navigation thru the context, especially to nodes on * the same or deeper hierachical level is strongly discouraged, * because such a strategy may easily lead to unresolvable * situations!! * if necessary, get static attributes of parent element DATA ls_parent_attributes TYPE wd_this->element_emp_info. parent_element->get_static_attributes( IMPORTING static_attributes = ls_parent_attributes ). DATA lo_nd_it0006_data TYPE REF TO if_wd_context_node. DATA lt_it0006_data TYPE wd_this->elements_it0006_data. * navigate from to via lead selection lo_nd_it0006_data = wd_context->path_get_node( path = `EMP_INFO.IT0006_DATA` ). SELECT * FROM pa0006 INTO CORRESPONDING FIELDS OF TABLE lt_it0006_data WHERE pernr EQ ls_parent_attributes-pernr. lo_nd_it0006_data->bind_table( new_items = lt_it0006_data set_initial_elements = abap_true ). ENDMETHOD.
- Activate the Web Dynpro Component
- Create Web Dynpro application
- Execute the Web Dynpro application.
Followers
Popular Posts
- ABAP - ALV Report example with steps
- ABAP - Sending email with pdf attachment
- ABAP - Step by step tutorial on Smart Forms - Template Node
- SAP Adobe Form - Steps to create simple ADOBE Form and calling it from ABAP Program
- SAP ABAP - CL_ABAP_CHAR_UTILITIES class usage
- ABAP - Multiple value selection from F4 help for SELECT-OPTIONS
- Execute ABAP Report using SUBMIT statement
- ABAP - Select all or Deselect all in ALV or Check box handling in ALV
- Web Dynpro ABAP ALV - ON_CLICK event
- ABAP - Dynamic WHERE clause
0 comments:
Post a Comment
Your useful comments, suggestions are appreciated.Your comments are moderated.