Skip to Content

How can i add a header to my ALV/

Hi, i need to add a variable as header.any tips?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

8 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 22, 2008 at 05:55 AM

    in screen painter u add input/output box (text box ) for displaying fields and add variable to that.

    in prg u can populate that variable.

    so while display it shows the value in that box.

    Madhavi

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 22, 2008 at 05:56 AM

    &----


    TYPE-POOLS : SLIS.

    TABLES : SBOOK.

    TYPES : BEGIN OF TY_DB,

    CARRID LIKE SBOOK-CARRID,

    CONNID LIKE SBOOK-CONNID,

    FLDATE LIKE SBOOK-FLDATE,

    BOOKID LIKE SBOOK-BOOKID,

    PASSNAME LIKE SBOOK-PASSNAME,

    END OF TY_DB.

    DATA : ITAB TYPE TABLE OF SBOOK,

    WA TYPE SBOOK,

    LI TYPE SY-LILLI,

    LO TYPE I,

    ITAB1 TYPE TABLE OF SBOOK,

    WA1 TYPE SBOOK,

    LT_FILEDCATLOG TYPE SLIS_T_FIELDCAT_ALV,

    WA_FILEDCAT TYPE SLIS_FIELDCAT_ALV,

    LT_EVENTS TYPE SLIS_T_EVENT,

    WA_EVENTS TYPE SLIS_ALV_EVENT,

    Z_FORMNAME TYPE SLIS_FORMNAME,

    LT_HEADER TYPE SLIS_T_LISTHEADER,

    WA_HEADER TYPE SLIS_LISTHEADER,

    NA(10),

    NA1(30).

    Z_FORMNAME = 'TOP_OF_PAGE'.

    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.

    PARAMETERS : P_CARRID TYPE SBOOK-CARRID.

    SELECT-OPTIONS : S_CONNID FOR SBOOK-CONNID NO-EXTENSION,

    S_FLDATE FOR SBOOK-FLDATE NO-EXTENSION.

    SELECTION-SCREEN END OF BLOCK B1.

    *EXTRACTING DATA FROM THE DATABASE.

    PERFORM EXTRACT_DATA

    USING ITAB

    CHANGING ITAB.

    *FOR DISPLAYING RESULT.

    IF SY-SUBRC = 0.

    PERFORM DISPLAY_RESULT

    USING ITAB.

    ELSE.

    WRITE : 'INVALID ENTRY'.

    ENDIF.

    *FOR CAPTURING THE PARTICULAR ROW.

    AT LINE-SELECTION.

    PERFORM LISTING.

    PERFORM EVENTS

    USING LT_EVENTS

    CHANGING LT_EVENTS.

    PERFORM POPULATE_EVENTS

    USING LT_EVENTS

    CHANGING LT_EVENTS.

    PERFORM BUILD_FIELDCATLOG

    USING LT_FILEDCATLOG.

    PERFORM ALV_LIST.

    &----


    *& Form EXTRACT_DATA

    &----


    FORM EXTRACT_DATA USING VALUE(I_ITAB) LIKE ITAB

    CHANGING VALUE(I_ITAB1) LIKE ITAB.

    DATA : WA1 TYPE TY_DB.

    SELECT *

    FROM SBOOK INTO

    CORRESPONDING FIELDS OF TABLE I_ITAB UP TO 20 ROWS WHERE

    CARRID = P_CARRID AND CONNID IN S_CONNID AND FLDATE IN S_FLDATE .

    I_ITAB1[] = I_ITAB[].

    ENDFORM. " EXTRACT_DATA

    &----


    *& Form DISPLAY_RESULT

    &----


    • text

    FORM DISPLAY_RESULT USING VALUE(I_ITAB) LIKE ITAB.

    SORT I_ITAB BY CARRID CONNID FLDATE BOOKID.

    LOOP AT I_ITAB INTO WA.

    AT NEW FLDATE.

    WRITE : /10 WA-CARRID, 20 WA-CONNID, 30 WA-FLDATE.

    ENDAT.

    WRITE : 45 WA-BOOKID, 55 WA-PASSNAME.

    LO = SY-LINNO.

    LO = LO + 1.

    SKIP TO LINE LO.

    ENDLOOP.

    ENDFORM. " DISPLAY_RESULT

    &----


    *& Form LISTING

    &----


    • text

    FORM LISTING .

    LI = SY-LILLI - 2.

    READ TABLE ITAB INTO WA1 INDEX LI.

    APPEND WA1 TO ITAB1.

    ENDFORM. " LISTING

    &----


    *& Form EVENTS

    &----


    • text

    ----


    • -->VALUE(LT_EVtext1)

    • -->VALUE(LT_EVtext2)

    ----


    FORM EVENTS

    USING VALUE(LT_EVENTS1) LIKE LT_EVENTS

    CHANGING VALUE(LT_EVENTS2) LIKE LT_EVENTS.

    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

    IMPORTING

    ET_EVENTS = LT_EVENTS1[].

    .

    IF SY-SUBRC <> 0.

    ENDIF.

    LT_EVENTS2[] = LT_EVENTS1[].

    ENDFORM. " EVENTS

    &----


    *& Form POPULATE_EVENTS

    &----


    • text

    FORM POPULATE_EVENTS

    USING VALUE(LT_EVENTS1) LIKE LT_EVENTS

    CHANGING VALUE(LT_EVENTS2) LIKE LT_EVENTS.

    READ TABLE LT_EVENTS1 INTO WA_EVENTS WITH KEY = SLIS_EV_TOP_OF_PAGE.

    IF SY-SUBRC = 0.

    MOVE Z_FORMNAME TO WA_EVENTS-FORM .

    MODIFY LT_EVENTS1 FROM WA_EVENTS INDEX SY-TABIX.

    CLEAR WA_EVENTS.

    LT_EVENTS2[] = LT_EVENTS1[].

    ENDIF.

    ENDFORM. " POPULATE_EVENTS

    &----


    *& Form TOP_OF_PAGE

    &----


    • text

    ----


    FORM TOP_OF_PAGE.

    • For header

    WA_HEADER-TYP = 'A'.

    WA_HEADER-INFO = 'ASSIGNMENT'.

    NA = SY-REPID.

    CONCATENATE 'ASSIGNMENT:' NA INTO NA1.

    WA_HEADER-INFO = NA1.

    CLEAR NA.

    CLEAR NA1.

    APPEND WA_HEADER TO LT_HEADER.

    WA_HEADER-TYP = 'A'.

    NA = SY-UNAME.

    CONCATENATE 'EMPLOYEEID:' NA INTO NA1.

    WA_HEADER-INFO = NA1.

    CLEAR NA.

    CLEAR NA1.

    APPEND WA_HEADER TO LT_HEADER.

    WA_HEADER-TYP = 'A'.

    NA = SY-DATUM.

    CONCATENATE 'DATE:' NA INTO NA1.

    WA_HEADER-INFO = 'DATE'.

    WA_HEADER-INFO = NA1.

    CLEAR NA.

    CLEAR NA1.

    APPEND WA_HEADER TO LT_HEADER.

    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

    EXPORTING

    IT_LIST_COMMENTARY = LT_HEADER[].

    ENDFORM . "TOP_OF_PAGE

    &----


    *& Form BUILD_FIELDCATLOG

    &----


    • text

    FORM BUILD_FIELDCATLOG

    USING VALUE(LT_FILEDCATLOG1) LIKE LT_FILEDCATLOG.

    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

    EXPORTING

    I_PROGRAM_NAME = SY-REPID

    I_STRUCTURE_NAME = 'SBOOK'

    CHANGING

    CT_FIELDCAT = LT_FILEDCATLOG1[].

    .

    IF SY-SUBRC <> 0.

    ENDIF.

    ENDFORM. " BUILD_FIELDCATLOG

    &----


    *& Form ALV_LIST

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM ALV_LIST .

    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

    EXPORTING

    I_CALLBACK_PROGRAM = SY-REPID

    I_STRUCTURE_NAME = 'SBOOK'

    IT_FIELDCAT = LT_FILEDCATLOG[]

    IT_EVENTS = LT_EVENTS[]

    TABLES

    T_OUTTAB = ITAB1[].

    IF SY-SUBRC <> 0.

    ENDIF.

    ENDFORM. " ALV_LIST

    Reward points if helpful

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 22, 2008 at 05:59 AM
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 22, 2008 at 06:03 AM

    Have a look at below links. It contains sample code for alv grid.

    http://www.erpgenie.com/abap/controls/alvgrid.htm#Complete%20code%20for%20the%20ALV%20grid%20example

    http://www.sap-img.com/abap/sample-programs-on-alv-grid.htm

    http://sap.niraj.tripod.com/id64.html

    Also have a look at below for OO alv grid:

    http://help.sap.com/saphelp_erp2004/helpdata/en/0a/b5533cd30911d2b467006094192fe3/frameset.htm

    -->REUSE_ALV_GRID _DISPLAY

    Heirarchial

    Here is a simple example of such an ALV.

    code

    report zrich_0001.

    type-pools: slis.

    data: begin of head occurs 0,

    matnr type afpo-matnr,

    maktx type makt-maktx,

    EXPAND type c,

    end of head.

    data: begin of detail occurs 0,

    aufnr type afpo-aufnr,

    matnr type afpo-matnr,

    werks type aufk-werks,

    pwerk type afpo-pwerk,

    psmng type afpo-psmng,

    end of detail.

    start-of-selection.

    select * into corresponding fields of table detail

    from afpo

    inner join aufk

    on afpo~aufnr = aufk~aufnr

    inner join afko

    on afpo~aufnr = afko~aufnr

    up to 500 rows

    where aufk~auart = 'PP01'.

    if not detail[] is initial.

    sort detail ascending by matnr.

    select distinct * into corresponding fields of table head

    from makt

    for all entries in detail

    where matnr = detail-matnr

    and spras = sy-langu.

    endif.

    perform call_alv.

    -


    FORM call_alv *

    -


    ........ *

    -


    form call_alv.

    data: gt_fieldcat type slis_t_fieldcat_alv,

    gs_keyinfo type slis_keyinfo_alv,

    gs_layout type slis_layout_alv.

    .

    data: ls_fieldcat type slis_fieldcat_alv.

    clear gs_keyinfo.

    gs_keyinfo-header01 = 'MATNR'.

    gs_keyinfo-item01 = 'MATNR'.

    clear ls_fieldcat.

    ls_fieldcat-fieldname = 'MATNR'.

    ls_fieldcat-reptext_ddic = 'Material'.

    ls_fieldcat-tabname = 'HEAD'.

    ls_fieldcat-outputlen = 18.

    append ls_fieldcat to gt_fieldcat.

    clear ls_fieldcat.

    ls_fieldcat-fieldname = 'MAKTX'.

    ls_fieldcat-reptext_ddic = 'Description'.

    ls_fieldcat-tabname = 'HEAD'.

    ls_fieldcat-outputlen = 40.

    append ls_fieldcat to gt_fieldcat.

    clear ls_fieldcat.

    ls_fieldcat-fieldname = 'AUFNR'.

    ls_fieldcat-reptext_ddic = 'Production Order'.

    ls_fieldcat-tabname = 'DETAIL'.

    ls_fieldcat-outputlen = 12.

    append ls_fieldcat to gt_fieldcat.

    clear ls_fieldcat.

    ls_fieldcat-fieldname = 'WERKS'.

    ls_fieldcat-reptext_ddic = 'Production Plant'.

    ls_fieldcat-tabname = 'DETAIL'.

    ls_fieldcat-outputlen = 4.

    append ls_fieldcat to gt_fieldcat.

    clear ls_fieldcat.

    ls_fieldcat-fieldname = 'PWERK'.

    ls_fieldcat-reptext_ddic = 'Planning Plant'.

    ls_fieldcat-tabname = 'DETAIL'.

    ls_fieldcat-outputlen = 4.

    append ls_fieldcat to gt_fieldcat.

    clear ls_fieldcat.

    ls_fieldcat-fieldname = 'PSMNG'.

    ls_fieldcat-reptext_ddic = 'Quantity'.

    ls_fieldcat-tabname = 'DETAIL'.

    ls_fieldcat-outputlen = 20.

    append ls_fieldcat to gt_fieldcat.

    gs_layout-expand_fieldname = 'EXPAND'.

    call function 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

    exporting

    it_fieldcat = gt_fieldcat[]

    is_layout = gs_layout

    i_tabname_header = 'HEAD'

    i_tabname_item = 'DETAIL'

    is_keyinfo = gs_keyinfo

    tables

    t_outtab_header = head

    t_outtab_item = detail.

    endform.

    [/code]

    -->

    ABAP List Viewer

    The common features of report are column alignment, sorting, filtering, subtotals, totals etc. To implement these, a lot of coding and logic is to be put. To avoid that we can use a concept called ABAP List Viewer (ALV).

    This helps us to implement all the features mentioned very effectively.

    Using ALV, We can have three types of reports:

    1. Simple Report

    2. Block Report

    3. Hierarchical Sequential Report

    There are some function modules which will enable to produce the above reports without much effort.

    All the definitions of internal tables, structures and constants are declared in a type-pool called SLIS.

    1. SIMPLE REPORT.

    The important function modules are

    a. Reuse_alv_list_display

    b. Reuse_alv_fieldcatalog_merge

    c. Reuse_alv_events_get

    d. Reuse_alv_commentary_write

    e. Reuse_alv_grid_display

    A. REUSE_ALV_LIST_DISPLAY : This is the function module which prints the data.

    The important parameters are :

    I. Export :

    i. I_callback_program : report id

    ii. I_callback_pf_status_set : routine where a user can set his own pf status or change the functionality of the existing pf status

    iii. I_callback_user_command : routine where the function codes are handled

    iv. I_structure name : name of the dictionary table

    v. Is_layout : structure to set the layout of the report

    vi. It_fieldcat : internal table with the list of all fields and their attributes which are to be printed (this table can be populated automatically by the function module REUSE_ALV_FIELDCATALOG_MERGE

    vii. It_events : internal table with a list of all possible events of ALV and their corresponding form names.

    II. Tables :

    i. t_outtab : internal table with the data to be output

    B. REUSE_ALV_FIELDCATALOG_MERGE : This function module is used to populate a fieldcatalog which is essential to display the data in ALV. If the output data is from a single dictionary table and all the columns are selected, then we need not exclusively create the field catalog. Its enough to mention the table name as a parameter(I_structure name) in the REUSE_ALV_LIST_DISPLAY. But in other cases we need to create it.

    The Important Parameters are :

    I. Export :

    i. I_program_name : report id

    ii. I_internal_tabname : the internal output table

    iii. I_inclname : include or the report name where all the dynamic forms are handled.

    II Changing

    ct_fieldcat : an internal table with the type SLIS_T_FIELDCAT_ALV which is

    declared in the type pool SLIS.

    C. REUSE_ALV_EVENTS_GET : Returns table of possible events for a list type

    Parameters :

    I. Import :

    Et_Events : The event table is returned with all possible CALLBACK events

    for the specified list type (column 'NAME'). For events to be processed by Callback, their 'FORM' field must be filled. If the field is initialized, the event is ignored. The entry can be read from the event table, the field 'FORM' filled and the entry modified using constants from the type pool SALV.

    II. Export :

    I_List_type :

    0 = simple list REUSE_ALV_LIST_DISPLAY

    1 = hierarchcal-sequential list REUSE_ALV_HIERSEQ_LIST_DISPLAY

    2 = simple block list REUSE_ALV_BLOCK_LIST_APPEND

    3 = hierarchical-sequential block list

    REUSE_ALV_BLOCK_LIST_HS_APPEND

    D. REUSE_ALV_COMMENTARY_WRITE : This is used in the Top-of-page event to print the headings and other comments for the list.

    Parameters :

    I. it_list_commentary : internal table with the headings of the type slis_t_listheader.

    This internal table has three fields :

    Typ : ‘H’ – header, ‘S’ – selection , ‘A’ - action

    Key : only when typ is ‘S’.

    Info : the text to be printed

    E. REUSE_ALV_GRID_DISPLAY : A new function in 4.6 version, to display the results in grid rather than as a preview.

    Parameters : same as reuse_alv_list_display

    This is an example for simple list.

    2. BLOCK REPORT

    This is used to have multiple lists continuously.

    The important functions used in this report are:

    A. REUSE_ALV_BLOCK_LIST_INIT

    B. REUSE_ALV_BLOCK_LIST_APPEND

    C. REUSE_ALV_BLOCK_LIST_HS_APPEND

    D. REUSE_ALV_BLOCK_LIST_DISPLAY

    A. REUSE_ALV_BLOCK_LIST_INIT

    Parameters:

    I. I_CALLBACK_PROGRAM

    II. I_CALLBACK_PF_STATUS_SET

    III. I_CALLBACK_USER_COMMAND

    This function module is used to set the default gui status etc.

    B. REUSE_ALV_BLOCK_LIST_APPEND

    Parameters :

    Export :

    I. is_layout : layout settings for block

    II. it_fieldcat : field catalog

    III. i_tabname : internal table name with output data

    IV. it_events : internal table with all possible events

    Tables :

    i. t_outtab : internal table with output data.

    This function module adds the data to the block.

    Repeat this function for all the different blocks to be displayed one after the other.

    C. REUSE_ALV_BLOCK_LIST_HS_APPEND

    This function module is used for hierarchical sequential blocks.

    D. REUSE_ALV_BLOCK_LIST_DISPLAY

    Parameters : All the parameters are optional.

    This function module display the list with data appended by the above function.

    Here the functions REUSE_ALV_FIELDCATALOG_MERGE, REUSE_ALV_EVENTS_GET, REUSE_ALV_COMMENTARY_WRITE can be used.

    3. Hierarchical reports :

    Hierarchical sequential list output.

    The function module is

    A. REUSE_ALV_HIERSEQ_LIST_DISPLAY

    Parameters:

    I. Export:

    i. I_CALLBACK_PROGRAM

    ii. I_CALLBACK_PF_STATUS_SET

    iii. I_CALLBACK_USER_COMMAND

    iv. IS_LAYOUT

    v. IT_FIELDCAT

    vi. IT_EVENTS

    vii. i_tabname_header : Name of the internal table in the program containing the

    output data of the highest hierarchy level.

    viii. i_tabname_item : Name of the internal table in the program containing the

    output data of the lowest hierarchy level.

    ix. is_keyinfo : This structure contains the header and item table field

    names which link the two tables (shared key).

    II. Tables

    i. t_outtab_header : Header table with data to be output

    ii. t_outtab_item : Name of the internal table in the program containing the

    output data of the lowest hierarchy level.

    slis_t_fieldcat_alv : This internal table contains the field attributes. This internal table can be populated automatically by using ‘REUSE_ALV_FIELDCATALOG_MERGE’.

    Important Attributes :

    A. col_pos : position of the column

    B. fieldname : internal fieldname

    C. tabname : internal table name

    D. ref_fieldname : fieldname (dictionary)

    E. ref_tabname : table (dictionary)

    F. key(1) : column with key-color

    G. icon(1) : icon

    H. symbol(1) : symbol

    I. checkbox(1) : checkbox

    J. just(1) : (R)ight (L)eft (C)ent.

    K. do_sum(1) : sum up

    L. no_out(1) : (O)blig.(X)no out

    M. outputlen : output length

    N. seltext_l : long key word

    O. seltext_m : middle key word

    P. seltext_s : short key word

    Q. reptext_ddic : heading (ddic)

    R. ddictxt(1) : (S)hort (M)iddle (L)ong

    S. datatype : datatype

    T. hotspot(1) : hotspot

    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

    Reward If useful

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 22, 2008 at 09:45 AM

    hi sooness,

    in your declarations, add these:

    DATA: gt_list_end_of_list TYPE slis_t_listheader,

    gt_list_top_of_page TYPE slis_t_listheader,

    it_events TYPE slis_t_event.

    then i suggest you make one major subroutine say, FORM build_events_table_for_alv then call that before you display your ALV by REUSE_ALV_GRID_DISPLAY or REUSE_ALV_LIST_DISPLAY.

    in the subroutine you put these lines of codes:

    FORM build_events_table_for_alv .

    CONSTANTS: lcon_top(11) TYPE c VALUE 'TOP_OF_PAGE',

    lcon_eol(11) TYPE c VALUE 'END_OF_LIST'.

    CLEAR: wa_events.

    REFRESH: it_events.

    wa_events-name = lcon_top.

    wa_events-form = lcon_top.

    APPEND wa_events TO it_events.

    CLEAR: wa_events.

    wa_events-name = lcon_eol.

    wa_events-form = lcon_eol.

    APPEND wa_events TO it_events.

    ENDFORM. " build_events_table_for_alv

    then another two subroutines:

    FORM top_of_page.

    DATA: it_listhead TYPE slis_t_listheader,

    lw_listhead LIKE LINE OF it_listhead.

    DATA: l_text TYPE string.

    CLEAR lw_listhead.

    lw_listhead-typ = 'H'.

    lw_listhead-info = 'Title of Your Header'. " place your text header here or a VARIABLE you have to pass

    APPEND lw_listhead TO it_listhead.

    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

    EXPORTING

    it_list_commentary = it_listhead.

    ENDFORM. "TOP_OF_PAGE

    &----


    *& Form END_OF_LIST

    &----


    FORM end_of_list.

    • this can be blank.

    ENDFORM. "end_of_list

    finally in your REUSE_ALV_GRID_DISPLAY or REUSE_ALV_LIST_DISPLAY, in the parameter it_events, pass it_events[] like:

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

    i_callback_program = callback_repid

    i_bypassing_buffer = 'X'

    i_structure_name = l_struct

    is_layout = is_layout

    it_fieldcat = it_fieldcat[]

    it_sort = it_sort[]

    i_save = 'X'

    it_events = it_events[]

    TABLES

    t_outtab = i_wrongzz[]

    EXCEPTIONS

    program_error = 1

    OTHERS = 2.

    regards,

    laure

    reward points if useful

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 22, 2008 at 09:53 AM

    Hi,

    You can add header using REUSE_ALV_COMMENTARY_WRITE' function module.

    In this you can pass the hard coded text to the corres\ponding structure in the Function module.

    Also you can define font and size of the text.

    Reward points if useful

    Thanks,

    Nageswar

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 22, 2008 at 10:12 AM

    Hi,

    Please refer to the link below :

    http://www.sapdev.co.uk/reporting/alv/alvgrid_rephead.htm

    Thanks,

    Sriram Ponna.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 22, 2008 at 11:08 AM

    you just neeed to make a list header and tehn attach it to your list display fm.to learn about list header study slis_alv_list hedaer and populate this table with required entris and pass it to fm of list display

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.