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

OOPs ALV Footer and Header

if i run program RCATS_DISPLAY_ACTIVITIES

header and footer are not there

i want to keep footer and header

alv grid is the type CL_GRID_HISTORY_DETAIL_CATSXi

dont know OOPs

please help me?????

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jun 16, 2008 at 09:28 AM

    Hi,

    Check the below block in SDN

    [/people/vijaybabu.dudla/blog/2006/07/21/topofpage-in-alv-using-clguialvgrid|/people/vijaybabu.dudla/blog/2006/07/21/topofpage-in-alv-using-clguialvgrid]

    Regards,

    Boobalan Suburaj

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 16, 2008 at 11:41 AM

    hi

    check this sample code

    ----


    • FORM dispaly *

    ----


    FORM dispaly.

    v_repid = sy-repid.

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

    I_CALLBACK_PROGRAM = v_repid

    i_callback_html_top_of_page = 'TOP_OF_PAGE'

    I_GRID_TITLE = 'SALES REGISTER '

    is_layout = gd_layout

    IT_FIELDCAT = it_salesreg

    I_CALLBACK_HTML_END_OF_LIST = 'END_OF_LIST_HTML'

    i_save = 'X'

    TABLES

    T_OUTTAB = salesreg.

    IF SY-SUBRC <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    ENDFORM.

    ----


    • FORM fieldcat1 *

    ----


    • ........ *

    ----


    • --> FNAME *

    • --> POS *

    • --> REFFIELD *

    • --> SELTEXT *

    • --> TABNAME *

    • --> P_OUTPUTLEN *

    • --> P_KEY *

    • --> P_NO_ZERO *

    • --> P_EMPHASIZE *

    ----


    FORM fieldcat1 USING fname TYPE slis_fieldname

    pos LIKE sy-cucol

    reffield LIKE dd03p-fieldname

    seltext LIKE dd03p-scrtext_l

    tabname TYPE slis_tabname

    p_outputlen

    p_key type c

    p_no_zero type c

    p_emphasize.

    clear wa_salesreg .

    wa_salesreg-fieldname = fname.

    wa_salesreg-col_pos = pos.

    wa_salesreg-ref_fieldname = reffield.

    wa_salesreg-seltext_l = seltext.

    wa_salesreg-tabname = tabname.

    wa_salesreg-outputlen = p_outputlen.

    wa_salesreg-key = p_key.

    wa_salesreg-no_zero = p_no_zero.

    wa_salesreg-emphasize = p_emphasize.

    APPEND wa_salesreg TO it_salesreg.

    ENDFORM.

    ----


    • Form TOP-OF-PAGE *

    ----


    FORM top_of_page USING document TYPE REF TO cl_dd_document.

    DATA: l_text TYPE sdydo_text_element,

    ld_lines type i,

    ld_linesc(10) type c,

    R_AREA TYPE REF TO CL_DD_AREA.

    CALL METHOD document->INITIALIZE_DOCUMENT.

    CALL METHOD document->VERTICAL_SPLIT

    EXPORTING

    SPLIT_AREA = document

    SPLIT_WIDTH = '60%'

    IMPORTING

    RIGHT_AREA = R_AREA.

    concatenate 'Ex-Stock sales from' s_fkdat-low+6(2) '.'

    s_fkdat-low+4(2) '.'

    s_fkdat-low(4)

    'to' s_fkdat-high+6(2) '.'

    s_fkdat-high+4(2) '.'

    s_fkdat-high(4)

    into l_text separated by space.

    CALL METHOD document->add_text

    EXPORTING

    text = l_text

    • SAP_COLOR = CL_DD_DOCUMENT=>LIST_HEADING_INT

    sap_fontsize = cl_dd_document=>large

    sap_emphasis = cl_dd_document=>strong.

    CALL METHOD R_AREA->ADD_PICTURE

    EXPORTING

    PICTURE_ID = 'GMLOGO1'

    WIDTH ='75'.

    CALL METHOD document->new_line.

    CALL METHOD document->new_line.

    l_text = 'Complete Invioce'.

    CALL METHOD document->add_icon

    EXPORTING

    sap_icon = 'ICON_LED_GREEN'.

    CALL METHOD document->add_text

    EXPORTING

    text = l_text

    sap_emphasis = cl_dd_document=>strong.

    l_text = 'Cancellation of Invoice / Credit Memo'.

    CALL METHOD document->add_icon

    EXPORTING

    sap_icon = 'ICON_LED_RED'.

    CALL METHOD document->add_text

    EXPORTING

    text = l_text

    sap_emphasis = cl_dd_document=>strong.

    CALL METHOD document->new_line.

    CALL METHOD document->new_line.

    describe table salesreg lines ld_lines.

    ld_linesc = ld_lines.

    concatenate 'Total No. of Records Selected: ' ld_linesc

    into l_text separated by space.

    CALL METHOD document->add_text

    EXPORTING

    text = l_text

    sap_fontsize = cl_dd_document=>large.

    ENDFORM. "top_of_page

    ----


    • Form Build Layout *

    ----


    FORM bld_layout.

    gd_layout-zebra = 'X'.

    GD_LAYOUT-NO_INPUT = 'X'.

    GD_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.

    GD_LAYOUT-INFO_FIELDNAME = 'LINE_COLOR'.

    GD_LAYOUT-WINDOW_TITLEBAR = 'GRID DISPLAY'.

    GD_LAYOUT-CONFIRMATION_PROMPT = 'X'.

    ENDFORM.

    FORM END_OF_LIST_HTML USING END TYPE REF TO CL_DD_DOCUMENT.

    DATA: LS_TEXT TYPE SDYDO_TEXT_ELEMENT,

    L_GRID TYPE REF TO CL_GUI_ALV_GRID,

    F(14) TYPE C VALUE 'SET_ROW_HEIGHT'.

    data S_AREA TYPE REF TO CL_DD_AREA.

    data : value type i,

    value1 type i,

    value2 type i,

    value3 type i,

    value4 type i.

    CALL METHOD END->INITIALIZE_DOCUMENT.

    CALL METHOD END->VERTICAL_SPLIT

    EXPORTING

    SPLIT_AREA = END

    SPLIT_WIDTH = '60%'

    IMPORTING

    RIGHT_AREA = S_AREA.

    CALL METHOD END->ADD_GAP

    EXPORTING

    WIDTH = 45.

    LS_TEXT = 'Tax Summary'.

    • adds test (via variable)

    CALL METHOD END->ADD_TEXT

    EXPORTING

    TEXT = LS_TEXT

    sap_fontsize = cl_dd_document=>large

    SAP_EMPHASIS = 'strong'.

    • adds new line (start new line)

    CALL METHOD END->NEW_LINE.

    CALL METHOD END->NEW_LINE.

    CALL METHOD END->ADD_GAP

    EXPORTING

    WIDTH = 15.

    • display text(normal)

    CALL METHOD END->ADD_TEXT

    EXPORTING

    TEXT = 'Tax Type'.

    CALL METHOD END->ADD_GAP

    EXPORTING

    WIDTH = 40.

    CALL METHOD END->ADD_TEXT

    EXPORTING

    TEXT = 'Rate'.

    CALL METHOD END->ADD_GAP

    EXPORTING

    WIDTH = 24.

    CALL METHOD END->ADD_TEXT

    EXPORTING

    TEXT = 'Amount'.

    CALL METHOD END->NEW_LINE.

    CALL METHOD END->underline.

    *************************LST**********

    CALL METHOD END->ADD_GAP

    EXPORTING

    WIDTH = 15.

    CALL METHOD END->ADD_TEXT

    EXPORTING

    TEXT = 'LST(Local Sales Tax)'

    SAP_EMPHASIS = 'medium'.

    CALL METHOD END->NEW_LINE.

    loop at t_lst_taxsum.

    value = 70.

    LS_TEXT = t_lst_taxsum-rate.

    CONDENSE LS_TEXT NO-GAPS.

    value1 = strlen( LS_TEXT ).

    if value1 = 5.

    value = value.

    elseif value1 > 5.

    value1 = value1 - 5.

    value = value - value1.

    else.

    value1 = 5 - value1.

    value = value + value1 + 1.

    endif.

    CALL METHOD END->ADD_GAP

    EXPORTING

    WIDTH = value.

    CALL METHOD END->ADD_TEXT

    EXPORTING

    TEXT = LS_TEXT.

    LS_TEXT = t_lst_taxsum-amt.

    CONDENSE LS_TEXT NO-GAPS.

    value2 = 20.

    value3 = strlen( LS_TEXT ).

    if value3 = 11.

    value2 = value2.

    elseif value3 > 11.

    value3 = value3 - 11.

    value2 = value2 - value3.

    else.

    value3 = 11 - value3.

    • value2 = value2 + value3 + 2.

    case value3.

    when 1.

    value2 = value2 + value3 + 1.

    when 2.

    value2 = value2 + value3 + 2.

    when 3.

    value2 = value2 + value3 + 3.

    when 4.

    value2 = value2 + value3 + 4.

    when 5.

    value2 = value2 + value3 + 5.

    when 6.

    value2 = value2 + value3 + 6.

    when 7.

    value2 = value2 + value3 + 7.

    when others.

    endcase.

    endif.

    CALL METHOD END->ADD_GAP

    EXPORTING

    WIDTH = value2.

    CALL METHOD END->ADD_TEXT

    EXPORTING

    TEXT = LS_TEXT.

    CALL METHOD END->NEW_LINE.

    endloop.

    *******************************CST**************

    CALL METHOD END->ADD_GAP

    EXPORTING

    WIDTH = 15.

    CALL METHOD END->ADD_TEXT

    EXPORTING

    TEXT = 'CST(Central Sales Tax)'

    SAP_EMPHASIS = 'medium'.

    CALL METHOD END->NEW_LINE.

    loop at t_cst_taxsum.

    value = 70.

    LS_TEXT = t_cst_taxsum-rate.

    CONDENSE LS_TEXT NO-GAPS.

    value1 = strlen( LS_TEXT ).

    if value1 = 5.

    value = value.

    elseif value1 > 5.

    value1 = value1 - 5.

    value = value - value1.

    else.

    value1 = 5 - value1.

    value = value + value1 + 1.

    endif.

    CALL METHOD END->ADD_GAP

    EXPORTING

    WIDTH = value.

    CALL METHOD END->ADD_TEXT

    EXPORTING

    TEXT = LS_TEXT.

    LS_TEXT = t_cst_taxsum-amt.

    CONDENSE LS_TEXT NO-GAPS.

    value2 = 20.

    value3 = strlen( LS_TEXT ).

    if value3 = 11.

    value2 = value2.

    elseif value3 > 11.

    value3 = value3 - 11.

    value2 = value2 - value3.

    else.

    value3 = 11 - value3.

    case value3.

    when 1.

    value2 = value2 + value3 + 1.

    when 2.

    value2 = value2 + value3 + 2.

    when 3.

    value2 = value2 + value3 + 3.

    when 4.

    value2 = value2 + value3 + 4.

    when 5.

    value2 = value2 + value3 + 5.

    when 6.

    value2 = value2 + value3 + 6.

    when 7.

    value2 = value2 + value3 + 7.

    when others.

    endcase.

    endif.

    CALL METHOD END->ADD_GAP

    EXPORTING

    WIDTH = value2.

    CALL METHOD END->ADD_TEXT

    EXPORTING

    TEXT = LS_TEXT.

    CALL METHOD END->NEW_LINE.

    endloop.

    *******************************AVAT**************

    CALL METHOD END->ADD_GAP

    EXPORTING

    WIDTH = 15.

    CALL METHOD END->ADD_TEXT

    EXPORTING

    TEXT = 'AVAT(Additional VAT)'

    SAP_EMPHASIS = 'medium'.

    CALL METHOD END->NEW_LINE.

    loop at t_addi_taxsum.

    value = 70.

    LS_TEXT = t_addi_taxsum-rate.

    CONDENSE LS_TEXT NO-GAPS.

    value1 = strlen( LS_TEXT ).

    if value1 = 5.

    value = value.

    elseif value1 > 5.

    value1 = value1 - 5.

    value = value - value1.

    else.

    value1 = 5 - value1.

    value = value + value1 + 1.

    endif.

    CALL METHOD END->ADD_GAP

    EXPORTING

    WIDTH = value.

    CALL METHOD END->ADD_TEXT

    EXPORTING

    TEXT = LS_TEXT.

    LS_TEXT = t_addi_taxsum-amount.

    CONDENSE LS_TEXT NO-GAPS.

    value2 = 20.

    value3 = strlen( LS_TEXT ).

    if value3 = 11.

    value2 = value2.

    elseif value3 > 11.

    value3 = value3 - 11.

    value2 = value2 - value3.

    else.

    value3 = 11 - value3.

    case value3.

    when 1.

    value2 = value2 + value3 + 1.

    when 2.

    value2 = value2 + value3 + 2.

    when 3.

    value2 = value2 + value3 + 3.

    when 4.

    value2 = value2 + value3 + 4.

    when 5.

    value2 = value2 + value3 + 5.

    when 6.

    value2 = value2 + value3 + 6.

    when 7.

    value2 = value2 + value3 + 7.

    when others.

    endcase.

    endif.

    CALL METHOD END->ADD_GAP

    EXPORTING

    WIDTH = value2.

    CALL METHOD END->ADD_TEXT

    EXPORTING

    TEXT = LS_TEXT.

    CALL METHOD END->NEW_LINE.

    endloop.

    ***************Cess on VAT*************************

    CALL METHOD END->ADD_GAP

    EXPORTING

    WIDTH = 15.

    CALL METHOD END->ADD_TEXT

    EXPORTING

    TEXT = 'Cess on VAT'

    SAP_EMPHASIS = 'medium'.

    CALL METHOD END->NEW_LINE.

    loop at t_cess_vatsum.

    value = 70.

    LS_TEXT = t_cess_vatsum-rate.

    CONDENSE LS_TEXT NO-GAPS.

    value1 = strlen( LS_TEXT ).

    if value1 = 5.

    value = value.

    elseif value1 > 5.

    value1 = value1 - 5.

    value = value - value1.

    else.

    value1 = 5 - value1.

    value = value + value1 + 1.

    endif.

    CALL METHOD END->ADD_GAP

    EXPORTING

    WIDTH = value.

    CALL METHOD END->ADD_TEXT

    EXPORTING

    TEXT = LS_TEXT.

    LS_TEXT = t_cess_vatsum-amount.

    CONDENSE LS_TEXT NO-GAPS.

    value2 = 20.

    value3 = strlen( LS_TEXT ).

    if value3 = 11.

    value2 = value2.

    elseif value3 > 11.

    value3 = value3 - 11.

    value2 = value2 - value3.

    else.

    value3 = 11 - value3.

    case value3.

    when 1.

    value2 = value2 + value3 + 1.

    when 2.

    value2 = value2 + value3 + 2.

    when 3.

    value2 = value2 + value3 + 3.

    when 4.

    value2 = value2 + value3 + 4.

    when 5.

    value2 = value2 + value3 + 5.

    when 6.

    value2 = value2 + value3 + 6.

    when 7.

    value2 = value2 + value3 + 7.

    when others.

    endcase.

    endif.

    CALL METHOD END->ADD_GAP

    EXPORTING

    WIDTH = value2.

    CALL METHOD END->ADD_TEXT

    EXPORTING

    TEXT = LS_TEXT.

    CALL METHOD END->NEW_LINE.

    endloop.

    • Tax Collected from source ****************

    CALL METHOD END->ADD_GAP

    EXPORTING

    WIDTH = 15.

    CALL METHOD END->ADD_TEXT

    EXPORTING

    TEXT = 'Tax Collected From Source'

    SAP_EMPHASIS = 'medium'.

    CALL METHOD END->NEW_LINE.

    loop at t_tcs_taxsum.

    value = 70.

    LS_TEXT = t_tcs_taxsum-rate.

    CONDENSE LS_TEXT NO-GAPS.

    value1 = strlen( LS_TEXT ).

    if value1 = 5.

    value = value.

    elseif value1 > 5.

    value1 = value1 - 5.

    value = value - value1.

    else.

    value1 = 5 - value1.

    value = value + value1 + 1.

    endif.

    CALL METHOD END->ADD_GAP

    EXPORTING

    WIDTH = value.

    CALL METHOD END->ADD_TEXT

    EXPORTING

    TEXT = LS_TEXT.

    LS_TEXT = t_tcs_taxsum-amount.

    CONDENSE LS_TEXT NO-GAPS.

    value2 = 20.

    value3 = strlen( LS_TEXT ).

    if value3 = 11.

    value2 = value2.

    elseif value3 > 11.

    value3 = value3 - 11.

    value2 = value2 - value3.

    else.

    value3 = 11 - value3.

    case value3.

    when 1.

    value2 = value2 + value3 + 1.

    when 2.

    value2 = value2 + value3 + 2.

    when 3.

    value2 = value2 + value3 + 3.

    when 4.

    value2 = value2 + value3 + 4.

    when 5.

    value2 = value2 + value3 + 5.

    when 6.

    value2 = value2 + value3 + 6.

    when 7.

    value2 = value2 + value3 + 7.

    when others.

    endcase.

    endif.

    CALL METHOD END->ADD_GAP

    EXPORTING

    WIDTH = value2.

    CALL METHOD END->ADD_TEXT

    EXPORTING

    TEXT = LS_TEXT.

    CALL METHOD END->NEW_LINE.

    endloop.

    CALL METHOD END->underline.

    ************Total Tax*****************

    CALL METHOD END->ADD_TEXT

    EXPORTING

    TEXT = 'Total TAX paid to the Government'

    SAP_EMPHASIS = 'strong'.

    LS_TEXT = w_gtot_tax.

    CONDENSE LS_TEXT NO-GAPS.

    value4 = strlen( LS_TEXT ).

    case value4.

    when 11.

    value4 = 38.

    when 10.

    value4 = 39.

    when 9.

    value4 = 40.

    when 8.

    value4 = 41.

    when 7.

    value4 = 42.

    when 6.

    value4 = 43.

    when 5.

    value4 = 44.

    when 4.

    value4 = 45.

    when others.

    endcase.

    CALL METHOD END->ADD_GAP

    EXPORTING

    WIDTH = value4.

    CALL METHOD END->ADD_TEXT

    EXPORTING

    TEXT = LS_TEXT

    SAP_EMPHASIS = 'strong'.

    *set height of this section

    CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

    IMPORTING

    E_GRID = L_GRID.

    CALL METHOD L_GRID->PARENT->PARENT->(F)

    EXPORTING

    ID = 3

    HEIGHT = 11.

    ENDFORM. "end_of_list_html.

    thanks

    sitaram

    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.