Skip to Content
author's profile photo Former Member
Former Member

passing fields in list header

Hi gurus

can i pass the the database field in the list header type SLIS_LISTHEADER.?

hw can i pass?

ex: passing date field at end of the heading in the report

Regards

Anand.N

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Nov 21, 2007 at 08:50 AM

    Hi,

    Yes u can, Refer below code.

    &----


    *& Form sub_top_of_page *

    &----


    • This form is to build the Page Header *

    ----


    FORM sub_top_of_page .

    *--Local Variable

    DATA : lv_title(120) TYPE c, " Title

    lv_month(30) TYPE c,

    lv_mont(30) TYPE c,

    lv_bud(16) TYPE c.

    *--Local Work Area

    DATA : lwa_line TYPE slis_listheader. " Hold list header

    • CONCATENATE p_month 'to' s_hmonth INTO lv_month SEPARATED BY space.

    • IF NOT s_hmonth IS INITIAL.

    • lv_mont = lv_month.

    • ELSE.

    lv_mont = p_month.

    • ENDIF.

    *--Title Display

    lwa_line-typ = 'H'. " header

    lv_title = sy-title.

    lwa_line-info = lv_title.

    APPEND lwa_line TO it_header.

    CLEAR lwa_line.

    *--Month Display

    lwa_line-typ = 'S'. " Item

    WRITE: lv_mont TO lv_month.

    lwa_line-key = text-024.

    lwa_line-info = lv_month.

    APPEND lwa_line TO it_header.

    *--Budget Display

    lwa_line-typ = 'S'. " Item

    WRITE: p_bud TO lv_bud.

    lwa_line-key = text-025.

    lwa_line-info = lv_bud.

    APPEND lwa_line TO it_header.

    CLEAR: lwa_line,

    lv_mont.

    *--This funcation module will display the top of the page

    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

    EXPORTING

    it_list_commentary = it_header.

    *--Free

    FREE : it_header.

    ENDFORM. "sub_top_of_page

    Reward Points

    Reagrds,

    Prashant

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 21, 2007 at 08:51 AM

    &----


    *& Include ZHRALV *

    &----


    type-pools: slis.

    constants:

    gc_xmargin type i value 5,

    gc_ymargin type i value 5,

    gc_top_of_page type slis_formname value 'TOP_OF_PAGE',

    gc_end_of_page type slis_formname value 'END_OF_PAGE',

    gc_end_of_list type slis_formname value 'END_OF_LIST',

    gc_pf_status_set type slis_formname value 'PF_STATUS_SET',

    gc_user_command type slis_formname value 'USER_COMMAND',

    gc_list_modify type slis_formname value 'LIST_MODIFY',

    gc_data_changed type slis_formname value 'DATA_CHANGED',

    yes type c value 'X',

    no type c value ' ',

    on type c value '1',

    off type c value '0',

    show type c value ' ',

    hide type c value 'X',

    red type c value '1',

    yellow type c value '2',

    green type c value '3',

    color_heading type i value 1,

    color_normal type i value 2,

    color_total type i value 3,

    color_key type i value 4,

    color_positive type i value 5,

    color_negative type i value 6,

    color_group type i value 7,

    found(1) type c value '1',

    not_found(1) type c value '0'.

    • ALV variables

    data: g_repid like sy-repid,

    gt_fieldcat type slis_t_fieldcat_alv,

    gt_list_top_of_page type slis_t_listheader,

    gt_list_end_of_list type slis_t_listheader,

    gs_sortinfo type slis_sortinfo_alv,

    gt_sortinfo type slis_t_sortinfo_alv,

    gt_filter type slis_t_filter_alv,

    gt_events type slis_t_event,

    gt_event_exit type slis_t_event_exit,

    gt_sp_group type slis_t_sp_group_alv,

    gt_color type slis_t_specialcol_alv with header line,

    gs_sp_group type slis_sp_group_alv,

    gs_layout type slis_layout_alv,

    gs_keyinfo type slis_keyinfo_alv,

    gs_print type slis_print_alv,

    gs_line type slis_listheader,

    gs_grid_layout type lvc_s_glay,

    g_preview type c value yes,

    g_grid_title(70),

    g_alv_logo(50).

    • report header/footer indicators

    data: g_hdr_dsel value yes, " data selection period

    g_hdr_psel value yes, " person selection period

    g_hdr_title value yes, " report title (sy-title)

    g_hdr_payarea value no, " payroll area

    g_hdr_payperiod value no, " payroll period

    g_ftr_rdate value yes, " run date

    g_ftr_ruser value yes, " user

    g_init_top_of_page like sy-repid value 'ZHRALV'.

    • report specific variables

    data: g_bukrs like t001-bukrs. " company code

    define alv_init.

    g_repid = sy-repid.

    perform alv_register_events using gt_events[].

    end-of-definition.

    define new_header_line.

    clear gs_line.

    gs_line-typ = &1.

    gs_line-key = &2.

    gs_line-info = &3.

    append gs_line to gt_list_top_of_page.

    end-of-definition.

    define new_footer_line.

    clear gs_line.

    gs_line-typ = &1.

    gs_line-key = &2.

    gs_line-info = &3.

    append gs_line to gt_list_end_of_list.

    end-of-definition.

    define set_field_color.

    read table gt_color with key fieldname = &1.

    if sy-subrc = 0.

    gt_color-fieldname = &1.

    gt_color-color-col = &2.

    gt_color-color-int = &3.

    gt_color-color-inv = &4.

    modify gt_color index sy-tabix.

    else.

    gt_color-fieldname = &1.

    gt_color-color-col = &2.

    gt_color-color-int = &3.

    gt_color-color-inv = &4.

    append gt_color.

    endif.

    end-of-definition.

    define alv_sort.

    clear gs_sortinfo.

    gs_sortinfo-fieldname = &1.

    gs_sortinfo-up = &2.

    gs_sortinfo-group = &3.

    gs_sortinfo-subtot = &4.

    append gs_sortinfo to gt_sortinfo.

    end-of-definition.

    define add_field_group.

    clear gs_sp_group.

    gs_sp_group-sp_group = &1.

    gs_sp_group-text = &2.

    append gs_sp_group to gt_sp_group.

    end-of-definition.

    *

    form alv_init_std_header.

    data: l_text like t549t-atext,

    l_temp type slis_listheader,

    l_date(10) type c,

    l_butxt like t001-butxt. " company name

    refresh gt_list_top_of_page.

    refresh gt_list_end_of_list.

    • REPORT HEADER

    • company name

    select single butxt

    from t001

    into l_butxt

    where bukrs = g_bukrs.

    if sy-subrc = 0.

    new_header_line 'H' space l_butxt.

    endif.

    • report title

    if g_hdr_title = yes.

    new_header_line 'H' space sy-title.

    endif.

    • REPORT FOOTER

    new_footer_line 'S' text-020 sy-repid.

    if g_ftr_rdate = yes.

    write sy-datum to l_date.

    new_footer_line 'S' text-018 l_date.

    endif.

    if g_ftr_ruser = yes.

    new_footer_line 'S' text-019 sy-uname.

    endif.

    endform.

    *

    form top_of_page.

    perform set_top_of_page in program (g_repid) if found.

    call function 'REUSE_ALV_COMMENTARY_WRITE'

    exporting

    i_logo = g_alv_logo

    it_list_commentary = gt_list_top_of_page.

    endform.

    *

    form end_of_page.

    write at: /01 'Page', sy-colno sy-pagno.

    endform.

    *

    form end_of_list.

    call function 'REUSE_ALV_COMMENTARY_WRITE'

    exporting

    it_list_commentary = gt_list_end_of_list

    i_end_of_list_grid = on.

    endform.

    *

    form alv_grid_disp tables f_outtab.

    call function 'REUSE_ALV_GRID_DISPLAY'

    exporting

    i_callback_program = g_repid

    i_grid_title = g_grid_title

    is_layout = gs_layout

    i_grid_settings = gs_grid_layout

    it_fieldcat = gt_fieldcat[]

    it_events = gt_events[]

    it_event_exit = gt_event_exit

    it_sort = gt_sortinfo

    it_filter = gt_filter

    it_special_groups = gt_sp_group

    is_print = gs_print

    i_save = 'A'

    tables

    t_outtab = f_outtab

    exceptions

    program_error = 1

    others = 2.

    if sy-subrc <> 0.

    message e016(rp) with 'Error in displaying ALV Grid'.

    endif.

    endform.

    *

    form alv_list_disp tables f_outtab.

    call function 'REUSE_ALV_LIST_DISPLAY'

    exporting

    i_callback_program = g_repid

    is_layout = gs_layout

    it_fieldcat = gt_fieldcat[]

    it_events = gt_events[]

    it_event_exit = gt_event_exit

    it_sort = gt_sortinfo

    it_filter = gt_filter

    it_special_groups = gt_sp_group

    is_print = gs_print

    i_save = 'A'

    tables

    t_outtab = f_outtab

    exceptions

    program_error = 1

    others = 2.

    if sy-subrc <> 0.

    message e016(rp) with 'Error in displaying ALV List'.

    endif.

    endform.

    *

    form alv_register_events using pi_events type slis_t_event.

    data: ls_event type slis_alv_event.

    clear ls_event.

    ls_event-name = slis_ev_pf_status_set.

    ls_event-form = gc_pf_status_set.

    append ls_event to pi_events.

    clear ls_event.

    ls_event-name = slis_ev_user_command.

    ls_event-form = gc_user_command.

    append ls_event to pi_events.

    clear ls_event.

    ls_event-name = slis_ev_top_of_page.

    ls_event-form = gc_top_of_page.

    append ls_event to pi_events.

    clear ls_event.

    ls_event-name = slis_ev_end_of_page.

    ls_event-form = gc_end_of_page.

    append ls_event to pi_events.

    clear ls_event.

    ls_event-name = slis_ev_end_of_list.

    ls_event-form = gc_end_of_list.

    append ls_event to pi_events.

    clear ls_event.

    ls_event-name = slis_ev_list_modify.

    ls_event-form = gc_list_modify.

    append ls_event to pi_events.

    clear ls_event.

    ls_event-name = slis_ev_data_changed.

    ls_event-form = gc_data_changed.

    append ls_event to pi_events.

    endform.

    hi,

    just add this to ur program, as include and check

    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.