Web Dynpro: Column Coloring in ALV

Applies to:
SAP ECC 6.0

Summary
The article aims to help the professionals who have only ABAP knowledge and passion to develop their Web Dynpro knowledge in ABAP. This article provides the knowledge for understanding ALV in Web dynpro and coloring a column in ALV. Author(s): J.Jayanthi Company: Siemens Information Processing Services Pvt. Ltd. Created on: 07 July 2010

Author Bio
J.Jayanthi is a Certified ABAP consultant with HR ABAP knowledge.

SAP COMMUNITY NETWORK © 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 1

.................................................. 4 Designing View.... 13 Copyright .................................................com | BPX ............................................................com | UAC .......................................................................................................................................................................................................................com | BOC ..... 3 Creating Web Dynpro .bpx............................. 5 Embedding View..................sap................................................. 11 Code . 13 Related Content .............................boc........ 10 Creating Web Dynpro Application ............................................................................................................................................................................................................ 10 Component Usages ..............................................................................................................uac.............................................. 12 Output .............................................................................................................................................................................................. 3 Prerequisites ............................................................... 14 SAP COMMUNITY NETWORK © 2010 SAP AG SDN ...........sdn........................ 3 Component Controller...............................................................................................................................................................................................................................................sap............................................................................................................Web Dynpro: Column Coloring in ALV Table of Contents ALV in Web Dynpro ABAP .....................................com 2 .......................................sap..sap............................................

boc. etc. The layout elements and dialog elements . already existing components into a component.sap. This means that you can integrate any number of other.for example. You can create any number of views in a component and arrange them in any number of windows. we are going to see how to approach the ALV in Web Dynpro and color a column in ALV. Component Usages Web Dynpro components can be nested. reusable unit of the application project.com | UAC . Prerequisites Component The component is the central.sap.com 3 .bpx. and provide the name(say ZZZ_JAYTEST3) to create.sap. View The view is the smallest unit of a Web Dynpro application visible for the user. SAP COMMUNITY NETWORK © 2010 SAP AG SDN . The view contains a controller and a controller context in which the application data to be processed is stored in a hierarchical structure.required for the application are arranged in a view.com | BPX . text fields..com | BOC .sdn. A view can only displayed by the browser if the view is embedded in a window. Window A window is used to group multiple views and to specify the navigation between the views./Intf. F4 help for a cell. Being an ABAP consultant. or buttons .uac. displaying cell as button. tables. This allows the linking of the graphical elements with the application data. coloring a cell. Mention the Component Use as ALV and Component as SALV_WD_TABLE in the Used Components tab in Web Dynpro (ZZZ_JAYTEST3).Web Dynpro: Column Coloring in ALV ALV in Web Dynpro ABAP ABAP Consultants are generally familiar in SAP List Viewer (ALV) and aware of the ways to play with ALV by coloring a row. coloring a column. Then enter the description and choose the type as Web Dynpro Component.sap. Creating Web Dynpro Go to SE80 and select Web Dynpro Comp.

Web Dynpro: Column Coloring in ALV This will create a Component Usages by name ALV. Then select the fields from the structure. Then select Create Node.com | UAC .bpx.com 4 . Component Controller Go to Component Controller and Right click the context.uac.sap.sap.sdn.com | BPX .com | BOC .boc.sap. SAP COMMUNITY NETWORK © 2010 SAP AG SDN .sap.

sap.bpx.sdn.sap.com | UAC .sap. change the cardinality to 0:n.Web Dynpro: Column Coloring in ALV Double click the node Mara and then remove the dictionary structure.boc.Fill the ID and choose the Typ as ViewContainerUIElement.com 5 . SAP COMMUNITY NETWORK © 2010 SAP AG SDN .com | BOC .com | BPX .uac.sap. Uncheck the Initialization Lead selection. Designing View Go to the layout in view and right click the ROOTUIELEMENTCONTAINER and then choose Insert element.

After drag and drop.Web Dynpro: Column Coloring in ALV After doing the same.sap.sap. drag and drop the context which appears under component controller to view(Main is the view name). In the properties.com 6 .sdn.com | BOC .sap.com | UAC . In context tab.boc.com | BPX . define as below.sap. the context will appear as below. SAP COMMUNITY NETWORK © 2010 SAP AG SDN .uac. the layout will appear as below.bpx.

bpx. This will generate the below code. Again use Code Wizard as below.sdn.com | BOC . Choose the radio button Read context and then press F4 to select the context Mara.Web Dynpro: Column Coloring in ALV Select the method WDDOINIT in methods tab.boc.com | UAC . SAP COMMUNITY NETWORK © 2010 SAP AG SDN .sap.sap.com 7 .sap. Then use Method call in Used controller as below in Code Wizard.uac. Use Web Dynpro code wizard to generate code automatically.sap.com | BPX . Keep the below generated code and delete the rest which is not required.

com | BPX . To change the MATNR column color.sap. we need to know the class and the method which is needed.boc. To generate the code.uac. we need to use SET_CELL_DESIGN method in class cl_salv_wd_column.com | BOC .bpx.sdn.com 8 . To do that. use Pattern as shown below and pass the value.Web Dynpro: Column Coloring in ALV Then our aim is to change the Column color. if_salv_wd_column_settings~get_columns is the required method which is available in the class cl_salv_wd_config_table.sap. SAP COMMUNITY NETWORK © 2010 SAP AG SDN .sap.com | UAC .sap.

com | BPX .sap.uac.sap.com | BOC .Web Dynpro: Column Coloring in ALV Click the squared arrow as above to get the different values that can be passed.sap.bpx.com | UAC . SAP COMMUNITY NETWORK © 2010 SAP AG SDN .sap.com 9 .sdn.boc.

com | BPX .boc.sap.uac. SAP COMMUNITY NETWORK © 2010 SAP AG SDN .com | BOC . Drag and drop the node(MARA in right side) from Component Controller context to Data(in left side) in Controller Usage Context.sap.com | UAC .com 10 .sap. Embedding View Embed the view by right clicking the Material in the window.bpx.sap.Web Dynpro: Column Coloring in ALV We can pass different values instead of e_cell_design-one to view different colors.sdn. Component Usages Right click the component Usage (here with name ALV) and Create controller Usage.

sap. Right click the Web Dynpro component and activate.uac.com 11 .com | UAC .bpx.sap.com | BPX .com | BOC . SAP COMMUNITY NETWORK © 2010 SAP AG SDN .sdn.Web Dynpro: Column Coloring in ALV Creating Web Dynpro Application Create Web Dynpro Application by right clicking the Webdynpro(ZZZ_JAYTEST3).boc.sap.sap.

com 12 .bpx.uac.Web Dynpro: Column Coloring in ALV Code SAP COMMUNITY NETWORK © 2010 SAP AG SDN .com | BPX .com | UAC .sap.sap.boc.sap.sdn.com | BOC .sap.

com | BOC .boc.sap.com | UAC .Web Dynpro: Column Coloring in ALV Output 1st column appears with different color.sap.bpx.com | BPX .sap.sdn. Reference 1 Reference 2 SAP COMMUNITY NETWORK © 2010 SAP AG SDN .sap.com 13 . Related Content Please include at least three references to SDN documents or web pages.uac.

GPFS. HACMP. i5/OS. Parallel Sysplex. Netfinity. and MultiWin are trademarks or registered trademarks of Citrix Systems. iSeries. Intelligent Miner. Crystal Decisions. the Adobe logo. DB2. RACF. ByDesign. BatchPipes. Oracle is a registered trademark of Oracle Corporation. R/3. JavaScript is a registered trademark of Sun Microsystems. System z10. DB2 Universal Database. Citrix. Program Neighborhood. z/VM. World Wide Web Consortium. PartnerEdge.sap. VideoFrame. eServer. and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and other countries. Inc.S. and Reader are either trademarks or registered trademarks of Adobe Systems Incorporated in the United States and/or other countries. Java is a registered trademark of Sun Microsystems. OS/400. BusinessObjects. The information contained herein may be changed without prior notice. X/Open. PowerVM. System z9. BladeCenter. POWER5+. POWER5.sap. All other product and service names mentioned are the trademarks of their respective companies. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only. POWER6+.com | BPX . SAP Business ByDesign. XHTML and W3C are trademarks or registered trademarks of W3C®. System Storage. System x. System z. Power Architecture. MetaFrame. Massachusetts Institute of Technology. z/OS. WinFrame. System p5.com | BOC . if any. Inc. pSeries. Data contained in this document serves informational purposes only. PostScript.uac. ICA. Duet. and PowerPoint are registered trademarks of Microsoft Corporation. OSF/1. Business Objects is an SAP company. AS/400. S/390 Parallel Enterprise Serv er. Acrobat. Outlook. All rights reserved. Linux is the registered trademark of Linus Torvalds in the U. Xcelsi us. without representation or warranty of any kind.boc. and Motif are registered trademarks of the Open Group. SAP NetWeaver.Web Dynpro: Column Coloring in ALV Copyright © Copyright 2010 SAP AG. Microsoft. WebSphere.A. PowerPC. Crystal Reports. in the United States and in other countries. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services. POWER6. z10. xSeries.sap.com | UAC . Nothing herein should be construed as constituti ng an additional warranty. Business Objects and the Business Objects logo. National product specifications may vary. Web Intelligence. S/390. System i. HTML. UNIX. OS/390. and SAP Group shall not be liable fo r errors or omissions with respect to the materials. and other countries. used under license for technology invented and implemented by Netscape. RETAIN. MVS/ESA. Excel. IBM. System i5.. and other Business Objects products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of Business Objects S.bpx. Redbooks. Adobe. Tivoli and Informix are trademarks or registered trademarks of IBM Corporation. z9. zSeries. SAP. AIX. No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG.sap. XML. DB2 Connect. Inc. POWER. OpenPower. SAP COMMUNITY NETWORK © 2010 SAP AG SDN . These materials are subject to change without notice. Windows. OS/2. Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors.sdn.com 14 . System p.

Sign up to vote on this title
UsefulNot useful