ebook img

Web Dynpro ABAP: Toolbar in ALV PDF

18 Pages·2011·0.44 MB·English
by  
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Web Dynpro ABAP: Toolbar in ALV

Web Dynpro ABAP: Toolbar in ALV Applies to: SAP ECC 6.0. For more information, visit the Web Dynpro ABAP homepage. Summary The article elaborates the use of button in ALV toolbar. Functionality of the button in toolbar is to display the details in popup window based on selected line. Author: J.Jayanthi Company: Siemens IT Solutions and Services Pvt. Ltd. Created on: 03 November 2010 Author Bio J.Jayanthi is a Certified ABAP consultant with HR ABAP knowledge. SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com © 2010 SAP AG 1 Web Dynpro ABAP: Toolbar in ALV Table of Contents ALV in Web Dynpro ABAP .................................................................................................................................. 3 Prerequisites ....................................................................................................................................................... 3 Goal…………. ..................................................................................................................................................... 3 Creating Web Dynpro ...................................................................................................................................... 3 Component Controller ..................................................................................................................................... 4 View…………….. ............................................................................................................................................ 6 Step 1: ........................................................................................................................................................... 10 Step 2: ........................................................................................................................................................... 10 Step 3: ........................................................................................................................................................... 10 Step 4: ........................................................................................................................................................... 10 Step 5: ........................................................................................................................................................... 11 Step 6: ........................................................................................................................................................... 11 Step 7: ........................................................................................................................................................... 11 Component Usages ...................................................................................................................................... 11 Embedding View ........................................................................................................................................... 12 Handling the Button Action ........................................................................................................................... 13 Creating Web Dynpro Application ................................................................................................................. 14 Code. ............................................................................................................................................................. 14 Output………… ................................................................................................................................................. 16 Related Content ................................................................................................................................................ 17 Disclaimer and Liability Notice .......................................................................................................................... 18 SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com © 2010 SAP AG 2 Web Dynpro ABAP: Toolbar in ALV ALV in Web Dynpro ABAP Normally ABAP Consultants will create the toolbar button in ALV programmatically. We are going to see how to display button in ALV toolbar using Webdynpro ABAP and how and where to write the functionality of the button. Prerequisites Component The component is the central, reusable unit of the application project. You can create any number of views in a component and arrange them in any number of windows. Component Usages Web Dynpro components can be nested. This means that you can integrate any number of other, already existing components into a component. View The view is the smallest unit of a Web Dynpro application visible for the user. The layout elements and dialog elements - for example, tables, text fields, or buttons - required for the application are arranged in a view. The view contains a controller and a controller context in which the application data to be processed is stored in a hierarchical structure. This allows the linking of the graphical elements with the application data. Window A window is used to group multiple views and to specify the navigation between the views. A view can only displayed by the browser if the view is embedded in a window. Singleton The property "Singleton" specifies the number of instances that can exist in a dependent context node (that does not belong directly to the root node). If the property "Singleton" is set, exactly one instance of the node exists. Its content changes when the lead selection of the parent node changes. If the property "Singleton" is not set, one instance per parent instance exists. The content of the instances does not change when the lead selection of the parent changes. Supply Function We can specify the name of a method which we can use to fill the context node at runtime in supply function. Goal In this article, Sales order details will be displayed initially in the main window and based on selected sales document, toolbar button will display the Sales order item details in popup window. We are going to use two views one for initial Sales Document display and another one for Popup Window. We need to use Component SALV_WD_TABLE for ALV display. In POPUP window, table will be used for diaplying vbeln and posnr. Since we need the item details of the sales order only when the particular sales document is clicked, we will use supply function. Creating Web Dynpro Go to SE80 and select Web Dynpro Comp./Intf. and provide the name(say ZZZ_JAYTEST9) to create. Then enter the description and choose the type as Web Dynpro Component. Enter the ALV for component use with component type SALV_WD_TABLE as below in the properties of the webdynpro ZZZ_JAYTEST9. This will create the component usages by name ALV. SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com © 2010 SAP AG 3 Web Dynpro ABAP: Toolbar in ALV Component Controller Go to Component Controller and Right click the context. Then select Create Node VBAK with dictionary structure as VBAK. Then select the fields required for display from VBAK table using ADD ATTRIBUTE FROM STRUCTURE button. In this example, we are selecting VBELN, VKORG, VTWEG and SPART. Then remove the dictionary structure VBAK from the node VBAK and set other properties of the node VBAK as below. SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com © 2010 SAP AG 4 Web Dynpro ABAP: Toolbar in ALV Create a node VBAP inside the node VBAK and add the attributes VBELN and POSNR from VBAP. Then set the property of VBAP as below. Create a supply function GET_ITEM. Here Singleton property is set in VBAP node. Uncomment the code which appears automatically and keep additionally only the logic for data selection. SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com © 2010 SAP AG 5 Web Dynpro ABAP: Toolbar in ALV View In Layout of the Main view, create ViewContianerUIElement using Insert element by right clicking the ROOTUIELEMENTCONTAINER. In properties tab, design the properties as below. Now in Context, drag and drop VBAK from right side to Left side. Delete the child node VBAP which we don’t require in Main view. symbol shows it is mapped. SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com © 2010 SAP AG 6 Web Dynpro ABAP: Toolbar in ALV Create another view say POPUP. In the context tab, Drag and Drop only the child node VBAP to the view from component controller. In the layout tab of POPUP view, Insert an element(say T1) Table. Set the datasource property as below. SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com © 2010 SAP AG 7 Web Dynpro ABAP: Toolbar in ALV Then right click T1 and select Create Binding. SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com © 2010 SAP AG 8 Web Dynpro ABAP: Toolbar in ALV Bind the elements as below. Now the layout will appear as below. Select the method WDDOINIT (For Main View) in methods tab. Use Web Dynpro code wizard to generate code automatically. SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com © 2010 SAP AG 9 Web Dynpro ABAP: Toolbar in ALV Step 1: Choose the radio button Read context for the node MAKT. Keep the below generated code and delete the rest which is not required. Step 2: Then select the data by the below logic. Step 3: Then bind the table. Step 4: Instantiate Used Component ALV. SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com © 2010 SAP AG 10

Description:
Web Dynpro ABAP: Toolbar in ALV Applies to: SAP ECC 6.0. For more information, visit the Web Dynpro ABAP homepage. Summary The article elaborates the use of button
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.