This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
Steps for implementing an Interactive ALV Report: ........................................................................................ 3
Step by Step Process ......................................................................................................................................... 4
Step 1: Create a Web Dynpro Component. .................................................................................................... 4
Step 2: Data Binding. ...................................................................................................................................... 5
Related Content ................................................................................................................................................ 17
Disclaimer and Liability Notice .......................................................................................................................... 18
WDA: Interactive ALV
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
WDA provides a Web Dynpro Component SALV_WD_TABLE for including SAP List Viewer. In most cases the end user requirements will be drill through the reports ie., from a header level report, on clicking a particular field the corresponding item level report should be displayed. This article is a step by step guide to make the ALV Report interactive.
Steps for implementing an Interactive ALV Report:
1. Create a Web Dynpro Component.
2. Data Binding.
3. Context Mapping.
4. Declare Component Usage.
5. Declare the component Usage in the view controller.
6. Design the layout.
7. Embed the VIEWCONTAINERUIELEMENT.
8. Context Mapping Between the two components.
9. Create a view for Item Details
10. Bind the node to be displayed as ALV.
11. Set the HOTSPOT
12. Create an event handler method for hotspot click.
13. Create Plugs for navigation between the views.
14. Navigation from Header details to Item details.
15. Navigate back from Item details to the header details.
16. Activate and create a Web Dynpro Application.
WDA: Interactive ALV
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
Note: a new folder of Component Usages is created in the objects tree in the left hand side of the screen.
Step 5: Declare the component Usage in the view controller.
Go to the properties tab of the view. Here also the SALV_WD_TABLE component should be specified among the Used Controllers/Components as the View of the SAL_WD_TABLE component is to be displayed in the layout of the custom view created.
WDA: Interactive ALV
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
Insert a VIEWCONTAINERUIELEMENT on the view. This is done to embed the TABLE view from the SALV_WD_TABLE component, which contains the ALV report, into our view.
Step 7: Embed the VIEWCONTAINERUIELEMENT.
Go to the window and select the VIEWCONTAINERUIELEMENT we have created in the view. Embed the required view from SALV_WD_TABLE. Right Click the VIEWCONTAINERUIELEMENT and select Embed View Option.
WDA: Interactive ALV
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
Now go to the Context Tab and map the node from your component to the Interface Controller of SALV_WD_TABLE.
Here you want to show the data in HEADER node as the ALV Report so drag and drop the HEADER node of our component into the DATA node of SALV_WD_TABLE.
Now the DATA node will have a double headed arrow.
Step 9: Create a view for Item Details
In this example, on clicking the hotspot the item details for the particular sales order will be displayed. So another view for displaying the Item Details should be created. Do the context mapping and design the layout.
Step 10: Bind the node to be displayed as ALV.
Go to the WDDOINIT method of the component controller. Read the context node to which the data is to be bound. Populate the internal table and bind the data to the node.
method WDDOINIT.
DATA lo_nd_header TYPE REF TO if_wd_context_node.
DATA lo_el_header TYPE REF TO if_wd_context_element.
DATA lt_header TYPE STANDARD TABLE OF vbak.
* navigate from <CONTEXT> to <HEADER> via lead selection
lo_nd_header = wd_context->get_child_node( name = wd_this->wdctx_header ).
* get element via lead selection
lo_el_header = lo_nd_header->get_element( ).
* For the example the select query for fetching the header details is wr
iiten here.
* Actually this should be avoided and data is to be fetched throught class methods
SELECT * FROM vbak INTO TABLE lt_header UP TO 50 rows.
WDA: Interactive ALV
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
Step 12: Create an event handler method for hotspot click.
Go to methods tab of the view in which ALV is embedded, and create an event handler method for handling the event ON_CLICK of SALV_WD_TABLE.
Step 13: Create Plugs for navigation between the views.
Create an inbound and outbound plug each for the two views and navigation links. Outbound plug from Header Screen is triggered when hotspot is clicked and outbound plug from item details is triggered when BACK button is pressed.
WDA: Interactive ALV
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is not supported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade.
SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this document, and anyone using these methods does so at his/her own risk.
SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this technical article or code sample, including any liability resulting from incompatibility between the content within this document and the materials and services offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of this document.