Sample Alv Grid Program Sap
. An example of using linecolor (ALV). Here you have a good example of coloring rows, columns and specific cells in alvs. It comes in an example of how to use hashed tables.
Create a Simple SAP ALV. ALV list CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING it_fieldcat = it_fieldcat TABLES t_outtab = it_sbook EXCEPTIONS program _error. Dear SAP Community Member, In order to fully benefit from what the SAP Community has to. Sample ALV Grid program using the function module REUSE_ALV_GRID_DISPLAY. Create a Simple SAP ALV. ALV list CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING it_fieldcat = it_fieldcat TABLES t_outtab = it_sbook EXCEPTIONS program _error.
For coloured rows. report zbnstest. TABLES AND DATA DECLARATION. Logo should be uploaded into application server using transaction 'OAER'. Go to Transaction OAER, 2. Give Class Name as PICTURES 3.
Class type as OT 4. Object Key as the name of the. You need to create a screen 100 for calling it, and in the Element list of the sceen supply OKCODE of type OK & in the layout, place a Custom - control with name DILEEPTEST1. Then activate.

Demo program on interactive ALV By Swarna S, Tata Consultancy Services.&-.& Report ztcoderefresh.& Author: Swarna.S. Published at SAPTechnical.COM.&-.& AS: ALV report displaying all the transaction codes in SAP.& User can click any tcode on ALV and go to the same.The ALV displays.& first 25 records and on refreshing displays the next set.& of 25 records and so on.&.&-. REPORT zalvtcoderefresh.type pools for alv declarations TYPE-POOLS: slis.structure declaration for tstc table TYPES: BEGIN OF tytstc, tcode TYPE tcode, pgmna TYPE programid, dypno TYPE dynpronr, END OF tytstc. Internal table and workarea declarations for tstc DATA: ittstc TYPE STANDARD TABLE OF tytstc, watstc TYPE tytstc.data declarations for ALV DATA: itlayout TYPE slislayoutalv, wafieldcat TYPE slisfieldcatalv, itfieldcat TYPE slistfieldcatalv, iteventexit TYPE slisteventexit, waeventexit TYPE sliseventexit.initialisation event INITIALIZATION.start of selection event START-OF-SELECTION.subroutine to fetch data from the db table PERFORM fetchdata.subroutine for output display PERFORM alvoutput.&-.& Form fetchdata.&-.subroutine to fetch data from the db table.-. FORM fetchdata.Internal table and work area declaratin for TSTC (local tables) DATA: lttstc TYPE STANDARD TABLE OF tytstc, lststc TYPE tytstc.Static field definition.Reads the last tcode and stores it in ltstc that on refresh further data.beyond this value is fetched STATICS ltstc TYPE tcode.
Selection from the tstc table.we select till 25 rows and on further refresh next 25 are selected.we select transactions having screen numbers only SELECT tcode pgmna dypno FROM tstc INTO CORRESPONDING FIELDS OF TABLE lttstc UP TO 25 ROWS WHERE tcode GT ltstc AND dypno NE '0000'. Code for transferring the values of local table to output table. for 25 rows as sy-tfill is 25.In case there are no records a message pops up.
Sap Alv Grid Display

IF sy-subrc EQ 0. DESCRIBE TABLE ittstc.
READ TABLE lttstc INTO lststc INDEX sy-tfill. Ltstc = lststc-tcode. Ittstc = lttstc.
MESSAGE 'No Records found ' TYPE 'i'. 'readdata.&-.& Form alvoutput.&-.
text.-. FORM alvoutput.subroutine to refresh alv PERFORM eventexits.field catalogue PERFORM buildfieldcat.Layout for alv PERFORM buildlayout.output display PERFORM alvdisplay. 'alvoutput.&-.& Form eventexits.&-. text.-.subroutine to refresh alv FORM eventexits. CLEAR waeventexit. Waeventexit-ucomm = '&REFRESH'. ' Refresh waeventexit-after = 'X'.
APPEND waeventexit TO iteventexit. 'eventexits.&-.& Form buildfieldcat.&-. text.-.Field catalogue FORM buildfieldcat. CLEAR wafieldcat. Wafieldcat-rowpos = '1'. Wafieldcat-colpos = '1'.
Wafieldcat-fieldname = 'TCODE'. Wafieldcat-tabname = 'ittstc'. Wafieldcat-seltextm = 'TRANSACTION'. APPEND wafieldcat TO itfieldcat. CLEAR wafieldcat.
Wafieldcat-rowpos = '1'. Wafieldcat-colpos = '2'. Wafieldcat-fieldname = 'PGMNA'. Wafieldcat-tabname = 'ittstc'.
Wafieldcat-seltextm = 'PROGRAM'. APPEND wafieldcat TO itfieldcat. CLEAR wafieldcat. Wafieldcat-rowpos = '1'. Wafieldcat-colpos = '3'. Wafieldcat-fieldname = 'DYPNO'. Wafieldcat-tabname = 'ittstc'.
Wafieldcat-seltextm = 'SCREEN'. APPEND wafieldcat TO itfieldcat. 'buildfieldcat.&-.& Form buildlayout.&-.
text.-.Layout FORM buildlayout. Itlayout-zebra = 'X'. Itlayout-colwidthoptimize = 'X'. 'buildlayout.&-.& Form alvdisplay.&-. text.-.ALV output FORM alvdisplay. CALL FUNCTION 'REUSEALVGRIDDISPLAY' EXPORTING icallbackprogram = sy-repid icallbackusercommand = 'USERCOMMAND' icallbackpfstatusset = 'PFSTATUS' itfieldcat = itfieldcat islayout = itlayout iteventexit = iteventexit iscreenstartcolumn = 10 iscreenstartline = 20 iscreenendcolumn = 70 iscreenendline = 45 igridtitle = 'Call Tcode Refresh ALV' TABLES touttab = ittstc. 'alvdisplay.&-.& Form usercommand.&-.
text.-.User actions on ALV FORM usercommand USING rucomm TYPE sy-ucomm rsselfield TYPE slisselfield. CASE rucomm.User clicks a transaction code and that tcode is called from ALV WHEN '&IC1'. READ TABLE ittstc INDEX rsselfield-tabindex INTO watstc. IF sy-subrc = 0. CALL TRANSACTION watstc-tcode.user clicks the refresh button and the next 25 records are displayed WHEN '&REFRESH'. PERFORM fetchdata.
Rsselfield-refresh = 'X'. Rsselfield-colstable = 'X'. Rsselfield-rowstable = 'X'. 'usercommand.-.
FORM PFSTATUS.-.Form for settings the pf status to the alv FORM pfstatus USING utextab TYPE slistextab. SET PF-STATUS 'STANDARDFULLSCREEN' OF PROGRAM 'SAPLKKBL'. ' PFSTATUSSET Output Click on this Refresh button, the next set of 25 records are displayed Click on any transaction, and it takes you to that particular transaction. Please send us your feedback/suggestions at. © 2006-2007 SAPTechnical.COM.
All rights reserved. All product names are trademarks of their respective companies. SAPTechnical.COM is in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver, and and any other SAP trademarks are registered trademarks of SAP AG in Germany and in several other countries.
Every effort is made to ensure content integrity. Use information on this site at your own risk. Graphic Design.