12-26-2006 5:46 AM
12-26-2006 5:48 AM
An excellent guide
Regards,
Ravi
Note - Please mark all the helpful answers
12-26-2006 5:48 AM
Check the program under the package SLIS in SE80
u hav a lot of programs on ALV Grids in there.
Regards
- Gopi
12-26-2006 5:55 AM
Hi,
just go to se38 and type bcalv* and press f4 you will get lots of alv examples .
Regards
Ashutosh
Reward points if helpful
12-26-2006 5:58 AM
Hi,
ALV is available in two modes: list and grid. List mode is good old list processing with standard functionnalities, and grid mode is using a new OCX object displaying grids.
Status Icon [ALV,Table Control,Tab Strip]
http://www.sapdesignguild.org/resources/MiniSG-old/from_develop/norm_status_icons.htm#positioning_4
ALV Group Heading
http://www.sap-img.com/fu037.htm
Simple ALV report
http://www.sapgenie.com/abap/controls/alvgrid.htm
ALVGRID with refresh
http://www.geocities.com/mpioud/Z_DEMO_ALV_REFRESH_BUTTON.html
ALV
http://www.geocities.com/mpioud/Abap_programs.html
Chk the demo program
BCALV_GRID_DEMO - Simple ALV Control Call Demo Program
Rgds,
Prakash
12-26-2006 6:02 AM
hi
Give me your e-mail id and i will send you a good material on grid control.
You can mail me on navneet.saraogi@gmail.com
Regards,
Navneet
12-26-2006 6:02 AM
hi,
ALV
http://www.geocities.com/mpioud/Abap_programs.html
http://www.sapdevelopment.co.uk/reporting/reportinghome.htm
Simple ALV report
http://www.sapgenie.com/abap/controls/alvgrid.htm
http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox
ALV
1. Please give me general info on ALV.
http://www.sapfans.com/forums/viewtopic.php?t=58286
http://www.sapfans.com/forums/viewtopic.php?t=76490
http://www.sapfans.com/forums/viewtopic.php?t=20591
http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
2. How do I program double click in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=11601
http://www.sapfans.com/forums/viewtopic.php?t=23010
3. How do I add subtotals (I have problem to add them)...
http://www.sapfans.com/forums/viewtopic.php?t=20386
http://www.sapfans.com/forums/viewtopic.php?t=85191
http://www.sapfans.com/forums/viewtopic.php?t=88401
http://www.sapfans.com/forums/viewtopic.php?t=17335
4. How to add list heading like top-of-page in ABAP lists?
http://www.sapfans.com/forums/viewtopic.php?t=58775
http://www.sapfans.com/forums/viewtopic.php?t=60550
http://www.sapfans.com/forums/viewtopic.php?t=16629
5. How to print page number / total number of pages X/XX in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
http://www.sapfans.com/forums/viewtopic.php?t=64320
http://www.sapfans.com/forums/viewtopic.php?t=44477
7. How can I set the cell color in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=52107
8. How do I print a logo/graphics in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=81149
http://www.sapfans.com/forums/viewtopic.php?t=35498
http://www.sapfans.com/forums/viewtopic.php?t=5013
9. How do I create and use input-enabled fields in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=84933
http://www.sapfans.com/forums/viewtopic.php?t=69878
10. How can I use ALV for reports that are going to be run in background?
http://www.sapfans.com/forums/viewtopic.php?t=83243
http://www.sapfans.com/forums/viewtopic.php?t=19224
11. How can I display an icon in ALV? (Common requirement is traffic light icon).
http://www.sapfans.com/forums/viewtopic.php?t=79424
http://www.sapfans.com/forums/viewtopic.php?t=24512
12. How can I display a checkbox in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=88376
http://www.sapfans.com/forums/viewtopic.php?t=40968
http://www.sapfans.com/forums/viewtopic.php?t=6919
Go thru these programs they may help u to try on some hands on
ALV Demo program
BCALV_DEMO_HTML
BCALV_FULLSCREEN_DEMO ALV Demo: Fullscreen Mode
BCALV_FULLSCREEN_DEMO_CLASSIC ALV demo: Fullscreen mode
BCALV_GRID_DEMO Simple ALV Control Call Demo Program
BCALV_TREE_DEMO Demo for ALV tree control
BCALV_TREE_SIMPLE_DEMO
BC_ALV_DEMO_HTML_D0100
Regards
Anver
12-26-2006 6:23 AM
Hi
Some important facts about ALV :
ALV stands for ABAP List Viewer.
The ALV Classic is a collective term for several function modules in function group SALV
The ALV Classic is a tool for the standardized output of
1 . Simple lists
2. Hierarchical/consecutive lists with two hierarchy levels
2. Why ALV ?
Until the introduction of the ABAP List Viewer (ALV), different report tools were used in the R/3 System.
Every report tool had its own function and application areas.
The ABAP List Viewer standardizes and simplifies the usage of lists in the R/3 System
Logic for presentation of data is removed from the selection of data.
Layout of the report is changeable without making a new selection or re-writing the code.
Standard Tool Functions have been enhanced with Component Specific Functions.
A standardized data interface and a standardized list layout is available for all lists.
3. Programming Steps :
Declare data areas.
Declare an internal table to store selected data.
Select data into the internal table.
Build the layout.
Build field catalogue.
Build sort catalogue.
Build event catalogue.
Start viewer.
Process call back events.
These are the facts about ALV which I have tried to highlight.
You can go through the following link for the details :
http://esnips.com/doc/ad20dca9-6182-4903-8d8f-96a66dc8590c/ALV.pdf
http://www.sapfriends.com/HelpSAP/ABAP%20List%20Viewer%20Classic%20(ALV).pdf
http://www.sap-hefte.de/download/dateien/1025/087_leseprobe.pdf
http://www.sap-img.com/abap/what-is-alv-programming.htm
http://www.sap-img.com/abap-function.htm
-charitha
01-08-2007 7:33 PM
I have been to most of the links others have provided in response to your question. These are all very good resources. But, as far as printing printing page numbers goes, I have not seen anything that allows for this provided by SAP.
What I do right now is set up a variable/field for the page number, clear that variable/field at the ALV PRINT_TOP_OF_LIST event, then increment and print the page number in the PRINT_TOP_OF_PAGE event.
The following is a template that I use when starting my projects. This may help since it does not have much code to distract from the subject:
***********************************************************************
Report : *
Author : *
Date : {Project Start Date} *
DEV ID : *
=====================================================================
Description:
=====================================================================
Tables Used : | SELECT | UPDATE | INSERT | DELETE *
=====================================================================
Input/Output Files: N/A *
=====================================================================
Includes : N/A *
=====================================================================
Program History *
----
Date DEV ID USER ID Change Request SAP Rel Phase *
Description *
----
MM-DD-YYYY DEVK9***** X.X P? *
{Description of changes} *
***********************************************************************
REPORT
LINE-COUNT LINE-SIZE MESSAGE-ID zp1fi
NO STANDARD PAGE HEADING.
*(If required data declaration can be written in separate include)
************************************************************************
Type Declarations: *
************************************************************************
************************************************************************
OOP - Class Definitions: *
************************************************************************
----
CLASS lcl_event_handler DEFINITION
----
*
----
CLASS lcl_event_handler DEFINITION.
PUBLIC SECTION.
METHODS:
print_top_of_page
FOR EVENT print_top_of_page OF cl_gui_alv_grid,
print_top_of_list
FOR EVENT print_top_of_list OF cl_gui_alv_grid.
PRIVATE SECTION.
ENDCLASS. "lcl_event_handler DEFINITION
----
CLASS lcl_event_handler IMPLEMENTATION
----
*
----
CLASS lcl_event_handler IMPLEMENTATION.
METHOD print_top_of_page.
PERFORM alv_top_of_page.
ENDMETHOD. "print_top_of_page
METHOD print_top_of_list.
PERFORM alv_top_of_list.
ENDMETHOD. "print_top_of_page
ENDCLASS. "lcl_event_handler IMPLEMENTATION
************************************************************************
Data - Internal Tables: *
************************************************************************
************************************************************************
Data - Screen Elements: *
************************************************************************
TABLES: sscrfields.
************************************************************************
Data - Variables/Fields: *
************************************************************************
DATA: v_pageno(5) TYPE n,
ok_code LIKE sy-ucomm.
************************************************************************
Data - Field Catalogs: *
************************************************************************
DATA: it_fcat_alv_grid TYPE lvc_t_fcat, " Field catalog table
wa_fcat_alv_grid TYPE lvc_s_fcat, " Field catalog workarea
it_sort TYPE lvc_t_sort, " Sort order table
wa_sort TYPE lvc_s_sort. " Sort order workarea
************************************************************************
Data - Work Areas or Structures: *
************************************************************************
************************************************************************
Field Symbols: *
************************************************************************
************************************************************************
Constants: *
************************************************************************
************************************************************************
Includes: *
************************************************************************
************************************************************************
Select-Options & Parameters: *
************************************************************************
************************************************************************
Intializaton: *
************************************************************************
INITIALIZATION.
************************************************************************
At Selection-Screen: *
************************************************************************
AT SELECTION-SCREEN.
DATA: v_errtxt TYPE string,
o_error TYPE REF TO cx_root.
TRY.
" Processing code area
CATCH cx_root INTO o_error.
" Exception
v_errtxt = o_error->get_text( ).
MESSAGE e000(zp1fi) WITH
v_errtxt.
ENDTRY.
************************************************************************
Start-Of-Selection: *
************************************************************************
START-OF-SELECTION.
************************************************************************
End-Of-Selection: *
************************************************************************
************************************************************************
Top-Of-Page: *
************************************************************************
************************************************************************
Subroutines:( if required can written in Separate Include) *
************************************************************************
&----
*& Form alv_top_of_page
&----
text
----
FORM alv_top_of_page.
"----
" Report header.
"----
DATA: lv_label(128) TYPE c,
lv_colpos TYPE i,
lv_vtext TYPE tvkot-vtext.
SELECT SINGLE vtext
FROM tvkot
INTO lv_vtext
WHERE ( spras = sy-langu+0(1) )
AND ( vkorg = '1000' ).
WRITE: / 'Date:',
sy-datlo,
'@',
sy-timlo,
AT 30 sy-uname,
AT 42 sy-sysid,
AT 50 'Client:',
AT 58 sy-mandt.
lv_label = sy-repid.
lv_colpos = ( ( sy-linsz - STRLEN( lv_label ) ) / 2 ).
WRITE: AT lv_colpos lv_label.
v_pageno = ( v_pageno + 1 ).
lv_label = v_pageno.
CONCATENATE
'Page:'
lv_label
INTO lv_label SEPARATED BY space.
lv_colpos = ( sy-linsz - STRLEN( lv_label ) ).
WRITE: AT lv_colpos lv_label.
lv_colpos = ( ( sy-linsz - STRLEN( lv_vtext ) ) / 2 ).
WRITE: AT lv_colpos lv_vtext,
''.
SKIP.
ENDFORM. "alv_top_of_page
&----
*& Form alv_top_of_list
&----
Reset the page number.
----
FORM alv_top_of_list.
CLEAR v_pageno.
ENDFORM. "alv_top_of_list
*----
Build field catalog and sort table.
*----
FORM frmfcat.
" Field catalog
CLEAR wa_fcat_alv_grid.
*----
Example:
wa_fcat_alv_grid-fieldname = 'KUNNR'.
wa_fcat_alv_grid-ref_field = 'KUNNR'.
wa_fcat_alv_grid-ref_table = 'KNA1'.
wa_fcat_alv_grid-coltext = 'Customer Number'.
wa_fcat_alv_grid-seltext = 'Customer Number'.
wa_fcat_alv_grid-outputlen = 10.
wa_fcat_alv_grid-no_out = 'X'. " Hides the given column
APPEND wa_fcat_alv_grid TO it_fcat_alv_grid.
CLEAR wa_fcat_alv_grid.
*----
" Sort Table
CLEAR wa_sort.
*----
Example:
wa_sort-spos = '1'.
wa_sort-fieldname = 'KUNNR'.
wa_sort-up = 'X'.
wa_sort-subtot = 'X'.
wa_sort-group = 'UL'.
APPEND wa_sort TO it_sort.
CLEAR wa_sort.
*----
ENDFORM. "frmfcat
*----
Display ALV Grid.
*----
FORM frmalvgrid.
DATA: lv_variant TYPE disvariant,
lo_ccont001 TYPE REF TO cl_gui_custom_container,
lo_alvgr001 TYPE REF TO cl_gui_alv_grid.
lo_alv_event_handler TYPE REF TO lcl_event_handler,
wa_layout TYPE lvc_s_layo.
CREATE OBJECT lo_ccont001
EXPORTING
container_name = 'CNT_ALV_GRID'.
CREATE OBJECT lo_alvgr001
EXPORTING
i_parent = lo_ccont001.
CREATE OBJECT lo_alv_event_handler.
SET HANDLER lo_alv_event_handler->print_top_of_page FOR lo_alvgr001.
SET HANDLER o_alv_events->print_top_of_list FOR o_alvgr001.
wa_layout-zebra = 'X'.
wa_layout-no_totarr = 'X'.
wa_layout-grid_title = '{Title of Report}'.
lv_variant-report = sy-repid.
lv_variant-username = sy-uname.
PERFORM frmfcat. " Create field catalog and sort table.
lo_alvgr001->set_table_for_first_display(
EXPORTING
is_variant = lv_variant
i_save = 'A'
is_layout = wa_layout
CHANGING
it_outtab = it_output
it_fieldcatalog = it_fcat_alv_grid
it_sort = it_sort
).
lo_alvgr001->refresh_table_display( ).
CLEAR v_pageno.
CALL SCREEN 0100. "Screen containing the ALV grid container.
"----
" Note:
" Screen dimensions 150 X 27
" fits most user displays.
"----
ENDFORM. " frmalvgrid
I hope this is helpfull.
Skip Munk