You are on page 1of 10

WebDynpro ALV 15 steps

Step 20: Now in the similar way create a view called ‘MAIN’. In this view create two elements of the type
ViewContainerUIelement. As shown in the picture below.

Step 21: Click on the ROOTELEMENTCONTAINER of the MAIN view and change the layout property to
MATRIX LAYOUT.
Step 22: Also click on each ViewConatinerUIElement and change the layout to MATRIX HEAD DATA. You will
get the layout like this.

(For mapping refer to Step 12). Step 24: Save MAIN view and double click on the Component name (ZSAM_TEST).Step 23: Navigate to the CONTEXT tab. . And MAP both the nodes created in the component controller.

Step 25: Now go to ‘Component usages’ in the left side tree and expand ALV_TEST and double click on the INTERFACECONTROLLER_USAGE.Go to Properties tab of the component and declare the ALV component in it as shown below: Here ALV_TEST now stands for the ALV component that we are going to use in the application. .

( After F4 ) . Now the component controller will open in the right side panel as shown above. Right click on container 1 (CONT1) and click on EMBED VIEW. click on the CONTROLLER USAGE Button. This will declare a mapping. Embed the Input View in the first container. Press F4 on the ‘View To Be Embedded’ input box and enter the TABLE view of the ALV_TEST component. Double click the link. Meaning we have just declared which node is going to be displayed in the ALV. you will see the two View containers. Refer to the screen shots below. Similarly right click on the second container and say Embed View.Step 26: You will see the screen as in the given picture. Step 27: SAVE everything. Now click on the arrow next to MAIN. WINDOWS > ZSAM_TEST. Drag and drop the NODE_ALV into the DATA node of the Interface Controller. Drag and drop MAIN view onto the Window.

Step 27: The Window will now look like this. . Click the link Create > Application. Enter the following details. Step 28: Now save everything and right click on the Component (ZSAM_TEST).

There you will find a method ONACTIONACTION_FIND already created. This is the event handler method of the action FIND. which is the last tab. .Step 29: Now this is the most important step of all. go to the Input View and click on METHODS. CODING  For coding.

elem_node_vbak TYPE REF TO if_wd_context_element. * navigate from <CONTEXT> to <NODE_VBAK> via lead selection node_node_vbak = wd_context->get_child_node( name = if_input_view=>wdctx_node_vbak ).Double click on the method name. lt_where LIKE TABLE OF ls_where. DATA: node_node_vbak TYPE REF TO if_wd_context_node. * create where condition . * get all declared attributes elem_node_vbak->get_static_attributes( IMPORTING static_attributes = stru_node_vbak ). stru_node_vbak TYPE if_input_view=>element_node_vbak . on the editor write the following code: METHOD onactionaction_find . * get element via lead selection elem_node_vbak = node_node_vbak->get_element( ). lt_vbak TYPE STANDARD TABLE OF zstr_vbak. DATA: ls_where(72) TYPE c.

. ENDIF. * navigate from <CONTEXT> to <NODE_ALV> via lead selection node_node_alv = wd_context->get_child_node( name = if_input_view=>wdctx_node_alv ). APPEND ls_where TO lt_where. IF NOT stru_node_vbak-erdat EQ '00000000'. ENDIF.IF NOT stru_node_vbak-vbeln EQ ''. TYPE if_input_view=>element_node_alv . ENDIF. CONCATENATE 'AND' ls_where INTO ls_where SEPARATED BY space. DATA: node_node_alv stru_node_alv TYPE REF TO if_wd_context_node. IF stru_node_vbak-vbeln NE ''. 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). APPEND ls_where TO lt_where. CONCATENATE 'ERDAT = ''' stru_node_vbak-erdat '''' INTO ls_where. CONCATENATE 'VBELN = ''' stru_node_vbak-vbeln '''' INTO ls_where.

ENDMETHOD Step 30: SAVE the application and activate the Component.* get all declared attributes node_node_alv->bind_table( lt_vbak ). Now run the application. Here’s the output  .