Exercise # 7

  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Exercise # 7 as PDF for free.

More details

  • Words: 528
  • Pages: 3
Exercise # 7: Objectives: Develop a web dynpro application to populate default values in the selection screen & display the label using the text objects from the OTR (Online Text Repository). Tasks required to be performed for developing the application: 1. Create Web dynpro component. 2. Create Web dynpro window. 3. Create two views one for accepting the user inputs as selection criteria and the other view for displaying the data in the table based on the selection criteria. 4. In the first view, create a context with a node ‘P_ADDRESS_INFO’ with two attributes ‘PERNR’ and BEGDA’ and map it with the controller context. 5. In the component controller, create a context node suggested name: ‘ADDRESS_INFO’ with a reference to ABAP Dictionary structure PA0006 and set its cardinality as 0…n. Select the attributes as required such as NAME1, NAME2, ORT01, PSTLZ etc… 6. Map the controller context node with the view’s context node where the data would be displayed. 7. Use web dynpro code wizard to create a table display with binding to the context node ‘ADDRESS_INFO’. 8. Create a new method in the component controller (GET_ADDRESS_INFO). 9. In   

this method do the following: Read the context node ‘P_ADDRESS_INFO’ using the web dynpro code wizard. Create an internal table of type ADDRESS_INFO. A method could be called using an object reference of a pre-written class for fetching of data from the database table and storing them in the internal table created in step 11 needs to be done for the values read from the context node ‘P_ADDRESS_INFO’.  Use the web dynpro code wizard to read context node ‘ADDRESS_INFO’. Since the data needs to be stored in the context, remove all method calls created by the wizard except for the first one (GET_CHILD_NODE).  Call method BIND_STRUCTURE for context node ‘ADDRESS_INFO’ to store the contents of the internal table in the context node. 10. Create a new method in the component controller (GET_ADDRESS_INFO).

method GET_ADDRESS_INFO . DATA: node_personal_info TYPE REF TO if_wd_context_node, elem_personal_info TYPE REF TO if_wd_context_element, stru_personal_info TYPE if_componentcontroller=>element_personal_info . * navigate from to via lead selection node_personal_info = wd_context->get_child_node( name = if_componentcontroller=>wdctx_personal_info ). * get element via lead selection elem_personal_info = node_personal_info->get_element( ). * get all declared attributes elem_personal_info->get_static_attributes( IMPORTING static_attributes = stru_personal_info ). data:obj_address type ref to ZCL_COX_ADDRESS_CHANGE, x_address type ZCOX_ADDRESS_DETAILS. CREATE OBJECT obj_address EXPORTING pernr = stru_personal_info-pernr begda = stru_personal_info-begda. CALL METHOD obj_address->get_employee_details EXPORTING i_subtyp = '0006' IMPORTING e_addrdet = x_address. DATA: node_address_info TYPE REF TO if_wd_context_node, elem_address_info TYPE REF TO if_wd_context_element, stru_address_info TYPE if_componentcontroller=>element_address_info . * navigate from to via lead selection node_address_info = wd_context->get_child_node( name = if_componentcontroller=>wdctx_address_info ). move-corresponding x_address-p0006 to stru_address_info. CALL METHOD node_address_info->bind_structure EXPORTING new_item = stru_address_info * set_initial_elements = abap_true * index = receiving element = elem_address_info .

endmethod.

11. The method ‘GET_ADDRESS_INFO’ is executed after the navigation, immediately before the output view is displayed.

• • • •

Open method HANDLEFROM_INPUT_VIEW. Choose Web Dynpro Code Wizard. Select Method Call in Used Controller. Select the component controller and enter the name of the method.

12. Activate the component and create an Application and test the same. 13. The output appears as below:

Related Documents

Exercise 7
June 2020 12
Exercise # 7
June 2020 7
Exercise 7
August 2019 18
Exercise 7
November 2019 17
Exercise 7
November 2019 13
Exercise 7 6& 7 9
June 2020 10