,

ALV Programs

ALV Programs

ALV Programs Explained

ALV (ABAP List Viewer) Programs are very easy to write when you know few basic facts about them. There are many Functions modules provided by SAP to handle different tasks. Just go to SE37 and use *REUSE*ALV* and this would display all the function modules related to ALV. Now to analyze and explain ALV, lets use the simple ALV Grid function module ‘REUSE_ALV_GRID_DISPLAY’ as an example.
ALV is Easy
Typically, all the ALV Reporting ends up into two different Categories.

  • Create Field catalogue
  • Create Events to display Top of Page/End of Page
  • Call the relevant ALV Function Module to display the output.

Create Field catalogue

First thing to do is decide all the fields you want to display in the grid. Make a list and fill all these reporting fields in the internal table IT_FIELDCAT. You need to add these field to get the minimal working; col_pos, fieldname,tabname,seltext_m,outputlen & key.

col_pos = Column Position
fieldname = Field Name
tabname = Table name or Internal table Name.
seltext_m = Field Description
outputlen = Output Length
key = Should this is part of key field. can be ‘X’ or space.

Now,keep filling all the data into the intenal table IT_FIELDCAT.

Create Events to display Top of Page/End of Page

If you have a top-of-page or end-of-page include these in the internal table IT_EVENTS.

Call the relevant ALV Function Module to display the output

Now comes the actual part of calling all the relevant function modules.
CALL FUNCTION ‘REUSE_ALV_GRID_DISPLAY’
EXPORTING
i_callback_program = sy-repid
i_callback_pf_status_set = ‘SET_PF_STATUS’ “PF Status
i_callback_user_command = ‘USER_COMMAND’ “Create a routine USER_COMMAND
i_grid_title = gv_grid_title “Title
it_fieldcat = it_alv_catalog “Created Above
it_events = it_alv_event “Created Above
TABLES
t_outtab = gt_output. “Internal Table with actual data

Additional Sources for ALV Examples:
  • One of our Authors Swarna writes a lot of programs using ALVs. Refer his Posts for some examples on ALV.
  • I found a page on web with lots of ALV Programs.
  • SAP has included its own demo examples. Refer the below programs for more examples on ALV.
    BCALV_FULLSCREEN_DEMO
    BCALV_FULLSCREEN_DEMO_CLASSIC
    BCALV_GRID_DEMO
    BCALV_TREE_DEMO
    BCALV_TREE_SIMPLE_DEMO

Copyright SAP Database : SAP Certification, Ebooks, PDF’s, Articles, News, Tips and Tricks.
This article can be reproduced as long as the above line stays.

ERP Avatar

One response to “ALV Programs”

  1. pankaj sharma Avatar
    pankaj sharma

    many many thanks.

    a great work who help many sap professional.

    also give more sap press books for functional and technical counsultents.

Leave a Reply

Your email address will not be published. Required fields are marked *