Steps To Create Webdynpro Alv Report
Steps To Create Webdynpro Alv Report
drop down list select web Dynpro Component Step 2: Enter the application name (ZALV_TEST1)
Step 3: You will get a pop up as shown above. Click Yes. Step 4: Enter the description on the next pop up as shown in below screen shot
Step 5 : A web dynpro component will then be created A COMPONENT CONTROLLER WINDOW INTERFACE COMPONENTS will be created automatically.
Step 6: Double click on the Component Controller. You will see an empty context
Step 7: Before creating the CONTEXT click on change mode. Right click on the CONTEXT and click on the create Node. Step 8: Enter the details on the pop up as shown below (NODE NAME = NODE_VBAK) AND specify your dictionary structure.
Step 9: Click on Add attribute from structure button Step 10: A Pop up will be displayed on the screen. Fields of table VBAK
Step 11: Select the FIELDS WHICH YOU NEED here I selected VBELN and ERDAT Step 12: Now we are created NODE called NODE_VBAK. This is used for storing the values of the input fields that the inputs are given by the user.
Step 13: Again right click the on the CONTEXT create another NODE called NODE_ALV. And dictionary structure as ZK_VBAK. This node will be used to store the records for displaying the ALV output. For the ouput we need to create a Dictionary structure as ZK_VBAK
Step 14: Click on add attribute from structure button and you will get the pop up window Shown below
Step 15 : Right click on the main program Create View you will see the figure shown below
Step 16 : Click on view you will get the prompt window. Specify the View name as INP_VIEW & Description as input view
Step : 17 Now we have created a view which will be displaying input fields accept from the user and its navigated to layout of view will be displayed
Step 18 : Navigate to the CONTEXT TAB. you will see the following screen
You can see the prompt window as shown below for mapping the ROOT NODE
Step 20: Navigate to the layout tab on the input view. Right click on the ROOT ELEMENT CONTAINER and click on create container form.
Step 21: After creating container form you will get the prompt window.
Step 22: Then click the context button. Double click on NODE_VBAK.
Step 23 : After Choosing the Context input view the input is ready for display Elements are VBELN & ERDAT . Then create the button for input user. You create insert element for BUTTON
Step 24: Specity the Button Name and Type of the Element.
Step 26: In the properties on the BUTTON. There is a property called EVENTS. Next to that create icon is there. Click on create you will get a pop up window shown below Note: Enter the Corresponding details. An action called ACTION_FIND is no0w created a EVENT handler method will also be created automatically to handle this.
Click on icon enter. Step 27: Now similarly create another view called MAIN_VIEW. In this VIEW create Two Elements of the View Container UI-Element. And Specify the VIEW NAME & DESCRIPTION AS shown below
Step 28: Now Click on ROOTELEMENTCONTAINER of the MAIN_VIEW & Change the layout property to MATRIX Layout.
Step 29 : Right Click on ROOTELEMENTCONTAINER and create the ELEMENT Name as CONT1 and TYP as VIEWCONTAINERUIELEMENT and Change the Layout as Matrix Header data as shown below
Step 30: And similarly create another ELEMENT Right Click on ROOTELEMENTCONTAINER and create the ELEMENT Name as CONT2 and TYP as VIEWCONTAINERUIELEMENT and Change the Layout as Matrix Header data as shown below
Step 31: Before that check the properties for layout as MATRIX HEADER DATA .After the creating the Two elements you will get the screen as below.
Step 32 : Navigate to the CONTEXT Tab . And Map Both the nodes created in component Controller.
Step 32 : Save the main window and Double click on the Component name (ZALV_TEST1). Then Go to Properties tab of the component and declare the Alv component as shown below.
Now ALV_TEST is stands for ALV Component that we are going to use in the Application
Step 33 : Now go to Component Interface on Left Sub Tree and Expand the ALV_TEST and Double Click on the Interface Controller usuage. In the change Mode.
Note : click on CONTROLLER USUAGE . Now it expands on the right panel as zalv_test1 Component controller. Shown below.
Step 34 : Drag and drop the NODE_ALV into data node of INTERFACE CONTROLLER . this will declare mapping . We just declared which node is going to be displayed in ALV.
Step 35 : Double click on link windows ZALV_TEST1 . drag and drop the window . Now click on the arrow next to MAIN_VIEW . you will see two VIEW containers .
Right click on (cont1) and click on embed view . Embed the inp_view in first container . Similarly Right click on (cont2) and click on embed view . Press f4 on the view to be Embedded input box and enter the table view of the alv_test
Step 36: now save everything click on component (ZALV_TEST1) and click on create web dynpro application as shown below.
Step 38 : Save the application and navigate to the INP_VIEW and click on methods. For doing the coding part. Click on methods Tab There u will find a method ONACTIONACTION_FIELD already created . This is event handler method of ACTION FIND
Note : Double click on the method name on the edit mode you can write the coding Report : DATA: node_node_vbak elem_node_vbak stru_node_vbak TYPE REF TO if_wd_context_node, TYPE REF TO if_wd_context_element, TYPE if_input_view=>element_node_vbak .
* navigate from <CONTEXT> to <NODE_VBAK> via lead selection node_node_vbak = wd_context->get_child_node( name = if_input_view=>wdctx_node_vbak ).
* create where condition IF NOT stru_node_vbak-vbeln EQ ''. CONCATENATE 'VBELN = ''' stru_node_vbak-vbeln '''' INTO ls_where. APPEND ls_where TO lt_where. ENDIF. IF NOT stru_node_vbak-erdat EQ '00000000'. CONCATENATE 'ERDAT = ''' stru_node_vbak-erdat '''' INTO ls_where. IF stru_node_vbak-vbeln NE ''. CONCATENATE 'AND' ls_where INTO ls_where SEPARATED BY space. ENDIF. APPEND ls_where TO lt_where. ENDIF.
SELECT VBELN ERDAT ERZET ERNAM ANGDT BNDDT AUDAT VBTYP TRVOG AUART AUGRU GWLDT SUBMI LIFSK FAKSK NETWR WAERK VKORG VTWEG SPART VKGRP VKBUR GSBER GSKST GUEBG GUEEN KNUMV FROM vbak INTO TABLE lt_vbak WHERE (lt_where).
* navigate from <CONTEXT> to <NODE_ALV> via lead selection node_node_alv = wd_context->get_child_node( name = if_input_view=>wdctx_node_alv ).