Skip to Content
author's profile photo
Former Member

help me out on alv

hi all

hope all r doing grt ,

can any one send me alv code..

how to create alv & how to post alv ..how to test the status of alv.

thnx

venky

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • Best Answer
    author's profile photo
    Former Member
    Oct 01, 2005 at 08:10 AM

    Hi

    For Help & sample code check this out

    http://www.sapdevelopment.co.uk/reporting/alv/alvgrid.htm

    You can also find a few DEMO programs in SE38.

    Do an F4 with ALVDEMO* .

    Dont forget to reward if answers helped.

    Cheers.

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Oct 01, 2005 at 03:19 PM
    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Oct 01, 2005 at 04:40 PM
    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Oct 01, 2005 at 04:48 PM

    Hello Venkat,

    Welcome to SDN.

    ABAP List Viewer (ALV) is a simple, user friendly and better looking reporting tool as compared to the usage of write statements in a conventional / interactive report.

    SAP provides a set of ALV (ABAP LIST VIEWER) function modules, which can be put into use to embellish the output of a report. This set of ALV functions is used to enhance the readability and functionality of any report output.

    Two Approaches

    Conventional (Using Standard Function Modules)

    Object Oriented (Using Standard Classes and Methods)

    We will concentrate on the conventional approach

    The commonly used ALV functions used for this purpose are;

    REUSE_ALV_VARIANT_DEFAULT_GET

    REUSE_ALV_VARIANT_F4

    REUSE_ALV_VARIANT_EXISTENCE

    REUSE_ALV_EVENTS_GET

    REUSE_ALV_COMMENTARY_WRITE

    REUSE_ALV_FIELDCATALOG_MERGE

    REUSE_ALV_POPUP_TO_SELECT

    REUSE_ALV_LIST_DISPLAY

    REUSE_ALV_GRID_DISPLAY

    Sap standard type pools: SLIS , KKBLO .

    Sap standard tables types taken from the type pools are:

    SLIS_LAYOUT_ALV ,

    SLIS_T_FIELDCAT_ALV,

    SLIS_T_LISTHEADER,

    SLIS_T_EVENT,

    SLIS_SELFIELD.

    Internal tables to used in the program declared based on the above table types

    DATA: I_LAYOUT TYPE SLIS_LAYOUT_ALV,

    I_FIELDTAB TYPE SLIS_T_FIELDCAT_ALV,

    I_HEADING TYPE SLIS_T_LISTHEADER,

    I_EVENTS TYPE SLIS_T_EVENT.

    TYPES: KKBLO_SELFIELD TYPE SLIS_SELFIELD.

    A layout is build for the report output description USING the internal table for Layout (I_LAYOUT).

    Output list description structure.

    The parameters are described under the following heads:

    Display options

    Exceptions

    Totals

    Interaction

    Detail screen

    Color

    Other

    The layout table is of type slis_layout_alv_spec.

    A field catalog is prepared using the internal table (I_FIELDCAT) of type SLIS_T_FIELDCAT_ALV. Field catalog contain descriptions of the output fields (usually a subset of the internal output table fields).

    The field catalog for the output table is built-up in the caller's coding. The build-up can be completely or partially automated by calling the REUSE_ALV_FIELDCATALOG_MERGE module

    All the values entered in the catalog is specific to the particular field whose name is entered in the fieldname FIELDNAME of the fieldcat structure. The name of the table is also entered in the corr. Fieldname TABNAME of the structure.

    An Events table is used for firing both user commands and the system dependent events i.e. top of page, end of page etc.

    A list of possible events is populated into an event table (I_EVENTS) when this table is passed to the function module REUSE_ALV_EVENT_NAMES_GET. The return table from this function module contains all the possible events.

    Sample code :

    FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE',

    FORMNAME_END_OF_PAGE TYPE SLIS_FORMNAME VALUE 'END_OF_PAGE', FORMNAME_USER_COMMAND TYPE SLIS_FORMNAME VALUE 'USER_COMMAND'.

    DATA: L_I_EVENT TYPE SLIS_ALV_EVENT.

    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

    EXPORTING

    I_LIST_TYPE = 0

    IMPORTING

    ET_EVENTS = I_EVENTS.

    READ TABLE I_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE

    INTO L_I_EVENT.

    IF SY-SUBRC = 0.

    MOVE FORMNAME_TOP_OF_PAGE TO L_I_EVENT-FORM.

    APPEND L_I_EVENT TO I_EVENTS.

    ENDIF.

    READ TABLE I_EVENTS WITH KEY NAME = SLIS_EV_END_OF_PAGE

    INTO L_I_EVENT.

    IF SY-SUBRC = 0.

    MOVE FORMNAME_END_OF_PAGE TO L_I_EVENT-FORM.

    APPEND L_I_EVENT TO I_EVENTS.

    ENDIF.

    CLEAR L_I_EVENT.

    READ TABLE I_EVENTS WITH KEY NAME = SLIS_EV_USER_COMMAND

    INTO L_I_EVENT.

    IF SY-SUBRC = 0.

    MOVE FORMNAME_USER_COMMAND TO L_I_EVENT-FORM.

    APPEND L_I_EVENT TO I_EVENTS.

    ENDIF.

    REPORT Y_DEMO_ALV_LIST NO STANDARD PAGE HEADING.

    *

    • Data to be displayed

    DATA: I_SFLIGHT TYPE TABLE OF SFLIGHT.

    *----


    *

    • Selection

    SELECT * FROM SFLIGHT INTO TABLE I_SFLIGHT.

    • Call ABAP List Viewer (ALV)

    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

    EXPORTING

    I_STRUCTURE_NAME = 'SFLIGHT'

    TABLES

    T_OUTTAB = I_SFLIGHT.

    Please reward points for the useful answers.

    Regards,

    Naren

    Add comment
    10|10000 characters needed characters exceeded