ALV FOOTER
Hi there,
I just newbies in ABAP programming, i just need little help from all of you regarding on ALV.
Can help me how to create the footer line in my ALV based on the coding given?
DATA : it_sflight TYPE TABLE OF sflight.
data : r_table type REF TO CL_SALV_TABLE.
PARAMETERS: PA_LIS AS CHECKBOX.
START-OF-SELECTION.
select * from sflight into TABLE IT_sflight.
TRY.
cl_salv_table=>factory(
EXPORTING
list_display = PA_LIS
r_container =
container_name =
IMPORTING
r_salv_table = r_table
CHANGING
t_table = it_sflight
r_table->display( ).
Hi,
Check the demo program SALV_TEST_TABLE_FORM_EVENTS..
You can find more programs try searching using SALV_TEST* in SE38.
Similar Messages
-
Hi All,
I need to display a summary table in ALV footer with multiple columns. I am using event end of list and table with line type slis_listheader but this has limited columns.
Any ideas?
Thanks and Best Regards,
TykenHi,
Use block ALV refer below code
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
i_callback_program = v_repid.
wa_layout1-colwidth_optimize = 'X'.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = wa_layout1
it_fieldcat = it_fieldcat[]
i_tabname = 'it_final'
it_events = it_events
TABLES
t_outtab = it_final
EXCEPTIONS
program_error = 1
maximum_of_appends_reached = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
LOOP AT it_fieldcat INTO wa_fieldcat.
lv_index = sy-tabix.
IF wa_fieldcat-fieldname = 'ERDAT'.
wa_fieldcat-fieldname = 'TITLE'.
wa_fieldcat-seltext_m = text-026.
wa_fieldcat-outputlen = 10.
ENDIF.
MODIFY it_fieldcat FROM wa_fieldcat INDEX lv_index TRANSPORTING
fieldname seltext_m outputlen.
CLEAR : wa_fieldcat.
ENDLOOP.
wa_layout2-no_colhead = 'X'.
wa_layout2-colwidth_optimize = 'X'.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = wa_layout2
it_fieldcat = it_fieldcat[]
i_tabname = 'it_total'
it_events = it_event1
TABLES
t_outtab = it_total
EXCEPTIONS
program_error = 1
maximum_of_appends_reached = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
wa_layout3-no_colhead = 'X'.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = wa_layout3
it_fieldcat = it_fieldcat2[]
i_tabname = 'it_ship'
it_events = it_event2
TABLES
t_outtab = it_ship
EXCEPTIONS
program_error = 1
maximum_of_appends_reached = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
IF NOT it_final IS INITIAL OR
NOT it_total IS INITIAL OR
NOT it_ship IS INITIAL.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
Regards,
Prashant -
My ALV footer should contain at least 70 characters. I used the standard slis_listheader for my footer but the standard info (type slis_entry) is only 60 characters. Is there any way to build a footer without using the standard? Also, I don't want to change the codes below because it is used by other programs. If I have to adjust, it's in my main program.
The following are excerpts from my include program:
<i>data: wa_line TYPE slis_listheader.
new_footer_line 'S' 'END OF REPORT' sy-repid.
DEFINE new_footer_line.
clear wa_line.
wa_line-typ = &1.
wa_line-key = &2.
wa_line-info = &3.
append wa_line to it_list_end_of_list.
END-OF-DEFINITION.</i>Hi,
In this case, You cannot do anything as it was a main program and it effects all other programs.
Regards,
Hari krishna. -
Hi All
How to create ALV Footer.I would like to print two types.
Each page want to ALV Footer and another report in required Last page only.
Thanks & Regards
hariHI,
just go thru this code,it can help u.
this is to print the footer by using events.
DISPLAYING FOOTER DATA BY USING EVENTS
REPORT ZCS_PRG7.
TABLES VBAK.
TYPE-POOLS SLIS.
Data Declaration
TYPES: BEGIN OF T_VBAK,
VBELN TYPE VBAK-VBELN,
ERDAT TYPE VBAK-ERDAT,
ERNAM TYPE VBAK-ERNAM,
AUDAT TYPE VBAK-AUDAT,
VBTYP TYPE VBAK-VBTYP,
NETWR TYPE VBAK-NETWR,
VKORG TYPE VBAK-VKORG,
VKGRP TYPE VBAK-VKGRP,
LINE_COLOR(4) TYPE C,
END OF T_VBAK.
DATA: IT_VBAK TYPE STANDARD TABLE OF T_VBAK INITIAL SIZE 0,
WA_VBAK TYPE T_VBAK.
ALV Data Declaration
DATA: FLDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
GD_LAYOUT TYPE SLIS_LAYOUT_ALV,
GD_REPID TYPE SY-REPID,
I_EVENTS TYPE SLIS_T_EVENT,
W_EVENTS LIKE LINE OF I_EVENTS.
DATA: I_COMMENT TYPE SLIS_T_LISTHEADER,
WA_COMMENT TYPE SLIS_LISTHEADER.
START-OF-SELECTION.
PERFORM DATA_RETRIEVAL.
PERFORM BLD_FLDCAT.
PERFORM BLD_LAYOUT.
PERFORM CALL_EVENTS.
PERFORM DISPLAY_ALV_REPORT.
Build Field Catalog for ALV Report
FORM BLD_FLDCAT.
FLDCAT-FIELDNAME = 'VBELN'.
FLDCAT-SELTEXT_M = 'Sales Document'.
FLDCAT-COL_POS = 0.
*FLDCAT-EMPHASIZE = 'C411'.
FLDCAT-OUTPUTLEN = 20.
FLDCAT-KEY = 'X'.
APPEND FLDCAT TO FLDCAT.
CLEAR FLDCAT.
FLDCAT-FIELDNAME = 'ERDAT'.
FLDCAT-SELTEXT_L = 'Record Date created'.
FLDCAT-COL_POS = 1.
FLDCAT-KEY = 'X'.
APPEND FLDCAT TO FLDCAT.
CLEAR FLDCAT.
FLDCAT-FIELDNAME = 'ERNAM'.
FLDCAT-SELTEXT_L = 'Cteated Object Person Name'.
APPEND FLDCAT TO FLDCAT.
CLEAR FLDCAT.
FLDCAT-FIELDNAME = 'AUDAT'.
FLDCAT-SELTEXT_M = 'Document Date'.
FLDCAT-COL_POS = 3.
FLDCAT-EMPHASIZE = 'C110'.
APPEND FLDCAT TO FLDCAT.
CLEAR FLDCAT.
FLDCAT-FIELDNAME = 'VBTYP'.
FLDCAT-SELTEXT_L = 'SD Document category'.
FLDCAT-COL_POS = 4.
APPEND FLDCAT TO FLDCAT.
CLEAR FLDCAT.
FLDCAT-FIELDNAME = 'NETWR'.
FLDCAT-SELTEXT_L = 'Net Value of the SO in Document Currency'.
FLDCAT-COL_POS = 5.
FLDCAT-OUTPUTLEN = 60.
FLDCAT-DO_SUM = 'X'.
FLDCAT-DATATYPE = 'CURR'.
APPEND FLDCAT TO FLDCAT.
CLEAR FLDCAT.
FLDCAT-FIELDNAME = 'VKORG'.
FLDCAT-SELTEXT_L = 'Sales Organization'.
FLDCAT-COL_POS = 6.
APPEND FLDCAT TO FLDCAT.
CLEAR FLDCAT.
FLDCAT-FIELDNAME = 'VKGRP'.
FLDCAT-SELTEXT_M = 'Sales Group'.
FLDCAT-COL_POS = 7.
FLDCAT-EMPHASIZE = 'C801'.
APPEND FLDCAT TO FLDCAT.
CLEAR FLDCAT.
ENDFORM.
Build Layout for ALV Grid Report
FORM BLD_LAYOUT.
GD_LAYOUT-NO_INPUT = 'X'.
GD_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
GD_LAYOUT-INFO_FIELDNAME = 'LINE_COLOR'.
ENDFORM.
Display report using ALV grid
FORM DISPLAY_ALV_REPORT.
DATA T_EVENT TYPE SLIS_T_EVENT.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = T_EVENT.
IF SY-SUBRC 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
GD_REPID = SY-REPID.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = GD_REPID
IS_LAYOUT = GD_LAYOUT
I_CALLBACK_HTML_TOP_OF_PAGE = 'TOP_OF_PAGE_SPLIT'
I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE'
I_CALLBACK_HTML_END_OF_LIST = 'END_OF_LIST_HTML'
IT_EVENTS = I_EVENTS
IT_FIELDCAT = FLDCAT[]
I_SAVE = 'X'
TABLES
T_OUTTAB = IT_VBAK
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
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.
Retrieve data from VBAK table and populate itab IT_VBAK
FORM DATA_RETRIEVAL.
DATA LD_COLOR(1) TYPE C.
SELECT VBELN ERDAT ERNAM AUDAT VBTYP NETWR VKORG
UP TO 100 ROWS
FROM VBAK
INTO TABLE IT_VBAK.
LOOP AT IT_VBAK INTO WA_VBAK.
LD_COLOR = LD_COLOR + 1.
IF LD_COLOR = 8.
LD_COLOR = 1.
ENDIF.
CONCATENATE 'C' LD_COLOR '10' INTO WA_VBAK-LINE_COLOR.
MODIFY IT_VBAK FROM WA_VBAK.
ENDLOOP.
ENDFORM.
FORM CALL_EVENTS.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = I_EVENTS
EXCEPTIONS
LIST_TYPE_WRONG = 1
OTHERS = 2
IF SY-SUBRC 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF NOT I_EVENTS[] IS INITIAL.
READ TABLE I_EVENTS INTO W_EVENTS WITH KEY NAME = 'END_OF_LIST'.
W_EVENTS-FORM = 'GENERATE_USERCOMMAND_FOOTER'.
MODIFY I_EVENTS FROM W_EVENTS INDEX SY-TABIX.
ENDIF.
ENDFORM.
FORM GENERATE_USERCOMMAND_FOOTER.
CLEAR I_COMMENT[].
WA_COMMENT-TYP = 'H'.
WA_COMMENT-KEY = V_DATA.
WA_COMMENT-INFO = 'CHANDU'(019).
APPEND WA_COMMENT TO I_COMMENT.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = I_COMMENT
I_LOGO = ''
I_END_OF_LIST_GRID = 'X'.
ENDFORM.
Regards,
Padmam. -
How to print Page No. in ALV footer.
I am using the follwoing code but when I got print the page numbers are not displaying. I was copy the code from one of group message.
Please tell where I am making mistakes means why page numbers are not displaying at footer.
I want to print 30 rows on each page and display the page no. in footer of each page.
REPORT zift_test_alv.
Report Name: PS Report *
Created by: IALI *
Tables ( To support selection screen )
TABLES:
MSEG.
S E L E C T I O N S C R E E N *
*SELECT-OPTIONS: PostDate FOR BSIS-BUDAT.
SELECTION-SCREEN: Begin of block B01 WITH FRAME TITLE TITLE01.
SELECT-OPTIONS: so_plant FOR mseg-werks. " Plant
SELECTION-SCREEN: end of block B01.
D A T A D E C L A R A T I O N *
Types
types: begin of slis_print_alv1,
no_print_selinfos(1) type c, " display no selection infos
no_coverpage(1) type c, "
no_new_page(1) type c, "
reserve_lines type i, " lines reserved for end of page
no_print_listinfos(1) type c, " display no listinfos
no_change_print_params(1) type c, " don't change linesize
no_print_hierseq_item(1) type c, "don't expand item
print_ctrl type ALV_S_Pctl,
end of slis_print_alv1.
types: begin of slis_print_alv.
include type alv_s_prnt.
include type slis_print_alv1.
types: end of slis_print_alv.
types: begin of slis_alv_event,
name(30),
form(30),
end of slis_alv_event.
types: slis_t_event type slis_alv_event occurs 0.
TYPES: BEGIN OF ty_mseg,
WBS type mseg-PS_PSP_PNR,
MSEG_WERKS TYPE MSEG-WERKS, " Plant
ABLAD TYPE MSEG-ABLAD, " Unloading Point
WEMPF TYPE MSEG-WEMPF, " Goods Receiptent
MBLNR TYPE MSEG-MBLNR, " Material Do Number
end of ty_mseg.
Internal tables and work areas
DATA:
IT_MSEG type table of TY_MSEG,
GV_TITLE type LVC_TITLE.
DATA: gt_events type slis_t_event,
gd_prntparams type slis_print_alv.
r_alv_template type ref to ZCL_BT_ALV_TEMPLATE.
Data declarations for the ALV grid
DATA: r_grid TYPE REF TO cl_gui_alv_grid.
DATA: alv_fieldcat TYPE slis_t_fieldcat_alv,
wa_alv_fieldcat TYPE slis_fieldcat_alv,
alv_layout TYPE slis_layout_alv,
gd_repid LIKE sy-repid.
Initialization.
select single max( ddtext ) from dd02t into TITLE01 where tabname = 'MSEG'
and ddlanguage = sy-langu."#EC *
D A T A S E L E C T I O N *
START-OF-SELECTION.
SET COUNTRY 'PK'.
" Getting data from MSEG
SELECT APS_PSP_PNR AWERKS AABLAD AWEMPF A~MBLNR
FROM mseg AS A
INTO table it_mseg
WHERE a~werks in so_plant.
A~PS_PSP_PNR IN SO_WBS.
*BREAK-POINT.
A L V P R O C E S S I N G *
END-OF-SELECTION.
PERFORM alv_setup.
PERFORM display_alv.
FORM alv_setup.
CLEAR wa_alv_fieldcat.
REFRESH alv_fieldcat.
wa_alv_fieldcat-key = ''.
wa_alv_fieldcat-fieldname = 'WBS'.
wa_alv_fieldcat-seltext_s = 'WBS'.
wa_alv_fieldcat-seltext_m = 'WBS Element'.
wa_alv_fieldcat-seltext_l = 'WBS Element'.
APPEND wa_alv_fieldcat TO alv_fieldcat.
wa_alv_fieldcat-key = ''.
wa_alv_fieldcat-fieldname = 'ABLAD'.
wa_alv_fieldcat-seltext_s = 'Un Ld Pnt'.
wa_alv_fieldcat-seltext_m = 'Un Lding Pnt'.
wa_alv_fieldcat-seltext_l = 'Un Loading Point'.
APPEND wa_alv_fieldcat TO alv_fieldcat.
wa_alv_fieldcat-key = ''.
wa_alv_fieldcat-fieldname = 'MSEG_WERKS'.
wa_alv_fieldcat-seltext_s = 'Plant'.
wa_alv_fieldcat-seltext_m = 'Plant'.
wa_alv_fieldcat-seltext_l = 'Plant'.
APPEND wa_alv_fieldcat TO alv_fieldcat.
wa_alv_fieldcat-key = ''.
wa_alv_fieldcat-fieldname = 'WEMPF'.
wa_alv_fieldcat-seltext_s = 'Good Rec'.
wa_alv_fieldcat-seltext_m = 'Good Rec'.
wa_alv_fieldcat-seltext_l = 'Good Receipt'.
APPEND wa_alv_fieldcat TO alv_fieldcat.
wa_alv_fieldcat-key = ''.
wa_alv_fieldcat-fieldname = 'MBLNR'.
wa_alv_fieldcat-seltext_s = 'Mat Doc'.
wa_alv_fieldcat-seltext_m = 'Mat Doc'.
wa_alv_fieldcat-seltext_l = 'Mat. Doc. No.'.
APPEND wa_alv_fieldcat TO alv_fieldcat.
ENDFORM. " alv_setup DMBTR
FORM display_alv.
gd_repid = sy-repid.
Configure layout of screen
alv_layout-colwidth_optimize = 'X'.
alv_layout-zebra = 'X'.
alv_layout-no_min_linesize = 'X'.
Now call display function
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP_OF_PAGE_SETUP' "Ref to form
is_layout = alv_layout
it_fieldcat = alv_fieldcat
i_grid_title = text-005
it_events = gt_events
is_print = gd_prntparams
i_save = 'X'
TABLES
t_outtab = IT_mseg
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
perform build_events.
perform build_print_params.
ENDFORM. " display_alv
FORM top_of_page_setup.
DATA: t_header TYPE slis_t_listheader,
wa_header TYPE slis_listheader.
wa_header-typ = 'H'.
wa_header-info = 'Test Report '.
APPEND wa_header TO t_header.
CLEAR wa_header.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = t_header.
ENDFORM. " top_of_page_setup
*& Form BUILD_EVENTS
Build events table
form build_events.
data: ls_event type slis_alv_event.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = gt_events[].
read table gt_events with key name =
slis_ev_end_of_page
into ls_event.
if sy-subrc = 0.
move 'END_OF_PAGE' to ls_event-form.
append ls_event to gt_events.
endif.
read table gt_events with key name =
slis_ev_end_of_list
into ls_event.
if sy-subrc = 0.
move 'END_OF_LIST' to ls_event-form.
append ls_event to gt_events.
endif.
endform. " BUILD_EVENTS
*& Form BUILD_PRINT_ PARAMS
Setup print parameters
form build_print_params.
gd_prntparams-reserve_lines = '3'. "Lines reserved for footer
gd_prntparams-no_coverpage = 'X'.
endform. " BUILD_PRINT_ PARAMS
*& Form END_OF_PAGE
form END_OF_PAGE.
data: listwidth type i,
ld_pagepos(10) type c,
ld_page(10) type c.
write: sy-uline(50) .
skip.
write:/40 'Page:', sy-pagno .
endform.
*& Form END_OF_LIST
form END_OF_LIST.
data: listwidth type i,
ld_pagepos(10) type c,
ld_page(10) type c.
skip.
write:/40 'Page:', sy-pagno .
endform.
Regards
Iftikhar Ali
IslamabadHi,
just populate ur eventcat like this , may be this can help u
form zf_eventcat using p_it_eventcat type slis_t_event.
data l_eventcat type slis_alv_event.
clear l_eventcat.
*Get all the events.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = p_it_eventcat
exceptions
list_type_wrong = 1
others = 2.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
TOP-OF-PAGE FORM
clear l_eventcat.
read table p_it_eventcat into l_eventcat with key
name = slis_ev_top_of_page.
if sy-subrc = 0.
move 'ZF_TOP_OF_PAGE' to l_eventcat-form.
modify p_it_eventcat from l_eventcat index sy-tabix
transporting form.
endif.
PF_STATUS_SET FORM
clear l_eventcat.
read table p_it_eventcat into l_eventcat with key
name = slis_ev_pf_status_set.
if sy-subrc = 0.
move 'ZF_PF_STATUS_SET' to l_eventcat-form.
modify p_it_eventcat from l_eventcat index sy-tabix
transporting form.
endif.
USER_COMMAND FORM
clear l_eventcat.
read table p_it_eventcat into l_eventcat with key
name = slis_ev_user_command.
if sy-subrc = 0.
move 'ZF_USER_COMMAND' to l_eventcat-form.
modify p_it_eventcat from l_eventcat index sy-tabix
transporting form.
endif.
endform. " zf_eventcat
reward if helpful -
ALV footer not displayed, column header icons missing.
Hi,
My simple application uses the ALV grid, but the footer (showing the page number, next page icon, etc) does not display, even though there are pages and pages of data. This is in both Internet Explorer (6) and Firefox (I was expecting it to be an IE problem !).
I have tried using the relevant method (though I think it should be visible by default):
l_table->if_salv_wd_table_settings~set_footer_visible( value = IF_SALV_WD_C_TABLE_SETTINGS=>FOOTER_VISIBLE_TRUE ).
but it still doesn't work. Other table settings methods do work (eg. setting the number of rows). Additionally, the icons for sorting columns do not appear in the column headers.
I've searched on this forum, and looked for relevant OSS notes, but can't find anything. Any thoughts anyone ?
Thanks,
Nick.Hi
Did u try with this code?
lr_config->if_salv_wd_table_settings~set_visible_row_count( '5' ).
lr_config->if_salv_wd_table_settings~SET_FOOTER_VISIBLE( '5' ).
Regards
Arun.P -
How to display page no in ALV Footer?
Hi
When I take print of long ALV List then footer and header is not repeat on each page. I want to repeat the footer on each page and also display the page no. there. How can I do this? please give me help.
Thanks
Iftikhar Ali
Islamabad.Refer the links -
http://www.sap-img.com/abap/test-alv-display-with-header-footer.htm
Alv page no 1 of 10 in footer
Regards,
Amit -
ALV tree - Displaying of footer
Hi Experts,
I have an ALV report which has a tree output.I want to display some text in the footer.How can I do that?
I searched a lot but I just got information on how to display the footer in an alv grid but nothing about alv tree.
Thanks in advance.
Regards,
Pujahii puja,
check below code where ALV footer is printed which will display the selection screen parameter at bottom of output ________________________________________________________________ SELECTION-SCREEN: BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001. "General Selections SELECT-OPTIONS: s_bukrs FOR gs_knb1-bukrs NO INTERVALS OBLIGATORY, "Company code s_grupp for gv_grupp no intervals no-extension. "Customer credit group SELECT-OPTIONS: s_kunnr FOR gs_kna1-kunnr . "Customer number SELECTION-SCREEN: END OF BLOCK blk1. "General Selections SELECTION-SCREEN: BEGIN OF BLOCK blk2 WITH FRAME . SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN COMMENT 1(41) text-002. PARAMETERS : p_tmoney(3) TYPE c . "Target money at risk SELECTION-SCREEN END OF LINE. SELECTION-SCREEN: END OF BLOCK blk2. _______________________________________________________________ CLASS lcl_event_receiver DEFINITION. PUBLIC SECTION. METHODS: end_of_list FOR EVENT end_of_list OF cl_gui_alv_grid IMPORTING e_dyndoc_id. ENDCLASS. "lcl_event_receiver DEFINITION &---- *& CLASS IMPLEMENTATION &---- &---- * CLASS lcl_event_receiver IMPLEMENTATION &---- * Class implementation for TOP-OF-PAGE &---- CLASS lcl_event_receiver IMPLEMENTATION. METHOD end_of_list. "implementation DATA : lv_text TYPE sdydo_text_element, lv_tbmar(15) TYPE c, " All Customers Base Money at Risk lv_tmr(15) TYPE c, " Total Money at Risk lv_emr(15) TYPE c, " Excess Money at Risk lv_mtemr(15) TYPE c, " Monthly Target Excess Money at Risk lv_var(15) TYPE c, " Variance lv_bukrs TYPE bukrs, lv_grupp TYPE grupp_cm, lv_kunnr TYPE kunnr, lv_kunnr1 TYPE kunnr, lv_tmoney(6) TYPE c. * To display all the parameters in selection screen *Company code CALL METHOD go_dyndoc_id->new_line. CALL METHOD go_dyndoc_id->new_line. MOVE s_bukrs-low TO lv_bukrs. CONCATENATE text-027 lv_bukrs INTO lv_text SEPARATED BY space. CALL METHOD go_dyndoc_id->add_text EXPORTING text = lv_text sap_style = cl_dd_area=>key. *Customer Credit Group CALL METHOD go_dyndoc_id->new_line. MOVE s_grupp-low TO lv_grupp. CONCATENATE text-028 lv_grupp INTO lv_text SEPARATED BY space. CALL METHOD go_dyndoc_id->add_text EXPORTING text = lv_text sap_style = cl_dd_area=>key. *Customer Number CALL METHOD go_dyndoc_id->new_line. MOVE s_kunnr-low TO lv_kunnr. MOVE s_kunnr-high TO lv_kunnr1. IF lv_kunnr1 IS INITIAL. CONCATENATE text-029 lv_kunnr INTO lv_text SEPARATED BY space. ELSE. CONCATENATE text-029 lv_kunnr ' TO ' lv_kunnr1 INTO lv_text SEPARATED BY space. ENDIF. CALL METHOD go_dyndoc_id->add_text EXPORTING text = lv_text sap_style = cl_dd_area=>key. *Target Excess Money at risk CALL METHOD go_dyndoc_id->new_line. MOVE p_tmoney TO lv_tmoney. CONCATENATE text-030 lv_tmoney INTO lv_text SEPARATED BY space. CALL METHOD go_dyndoc_id->add_text EXPORTING text = lv_text sap_style = cl_dd_area=>key. IF go_html_cntrl IS INITIAL. CREATE OBJECT go_html_cntrl EXPORTING parent = go_parent_html. ENDIF. DATA: lv_background_id TYPE sdydo_key VALUE space. CALL FUNCTION 'REUSE_ALV_GRID_COMMENTARY_SET' EXPORTING document = go_dyndoc_id bottom = space. CALL METHOD go_dyndoc_id->merge_document. CALL METHOD go_dyndoc_id->set_document_background EXPORTING picture_id = lv_background_id. go_dyndoc_id->html_control = go_html_cntrl. CALL METHOD e_dyndoc_id->display_document EXPORTING reuse_control = abap_true parent = go_parent_html EXCEPTIONS html_display_error = 1. IF sy-subrc 0. MESSAGE i014. ENDIF. ENDMETHOD. "END_OF_LIST ENDCLASS. "lcl_event_receiver IMPLEMENTATION _________________________________________________________ &---- *& Module mod_init_9000 OUTPUT &---- * Place the values from grid object to custom container for ALV display ---- MODULE mod_init_9000 OUTPUT. DATA: lo_event_receiver TYPE REF TO lcl_event_receiver."#EC * IF cl_gui_alv_grid=>offline( ) IS INITIAL. IF go_container IS INITIAL. * Create a custom container control for ALV control CREATE OBJECT go_container EXPORTING container_name = 'CN_GRID_CONTROL'. * Split Controls CREATE OBJECT go_splitter EXPORTING parent = go_container rows = 2 columns = 1. CALL METHOD go_splitter->set_row_height EXPORTING id = 1 height = 68. CALL METHOD go_splitter->get_container EXPORTING row = 2 column = 1 RECEIVING container = go_parent_html. CALL METHOD go_splitter->get_container EXPORTING row = 1 column = 1 RECEIVING container = go_parent_grid. * Create a ALV Control CREATE OBJECT go_grid EXPORTING i_parent = go_parent_grid. CREATE OBJECT go_dyndoc_id EXPORTING style = gc_style. "ALV_GRID PERFORM sub_fieldcat_layout. CREATE OBJECT lo_event_receiver. SET HANDLER lo_event_receiver->end_of_list FOR go_grid. CALL METHOD cl_gui_control=>set_focus EXPORTING control = go_grid. * Set Table for first display PERFORM sub_table_display. CALL METHOD go_dyndoc_id->initialize_document. CALL METHOD go_grid->list_processing_events EXPORTING i_event_name = gc_event "END_OF_LIST i_dyndoc_id = go_dyndoc_id. ENDIF. ENDIF. ENDMODULE. " mod_init_9000 OUTPUT _____________________________________________________ &---- *& Form SUB_TABLE_DISPLAY &---- * Display the output ---- FORM sub_table_display . DATA gs_layo TYPE lvc_s_layo. gs_layo-zebra = abap_true. gs_layo-sel_mode = gc_save. CALL METHOD go_grid->set_table_for_first_display EXPORTING i_save = gv_save i_default = gc_Default is_layout = gs_layo CHANGING it_outtab = gt_final[] it_fieldcatalog = gt_fcat. ENDFORM. " SUB_TABLE_DISPLAY
regards,
Shweta -
Hi everyone!
I have this ALV Tree report and need to implement the Footer on the end of the report.
Did you already have the same problem?
I am open for suggestions...
Thanks in advance,
Leandrocheck below code where ALV footer is printed which will display the selection screen parameter at bottom of output
SELECTION-SCREEN: BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
"General Selections
SELECT-OPTIONS: s_bukrs FOR gs_knb1-bukrs NO INTERVALS OBLIGATORY, "Company code
s_grupp for gv_grupp no intervals no-extension. "Customer credit group
SELECT-OPTIONS: s_kunnr FOR gs_kna1-kunnr . "Customer number
SELECTION-SCREEN: END OF BLOCK blk1. "General Selections
SELECTION-SCREEN: BEGIN OF BLOCK blk2 WITH FRAME .
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(41) text-002.
PARAMETERS : p_tmoney(3) TYPE c . "Target money at risk
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN: END OF BLOCK blk2.
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS: end_of_list
FOR EVENT end_of_list
OF cl_gui_alv_grid
IMPORTING e_dyndoc_id.
ENDCLASS. "lcl_event_receiver DEFINITION
*& CLASS IMPLEMENTATION
CLASS lcl_event_receiver IMPLEMENTATION
Class implementation for TOP-OF-PAGE
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD end_of_list. "implementation
DATA : lv_text TYPE sdydo_text_element,
lv_tbmar(15) TYPE c, " All Customers Base Money at Risk
lv_tmr(15) TYPE c, " Total Money at Risk
lv_emr(15) TYPE c, " Excess Money at Risk
lv_mtemr(15) TYPE c, " Monthly Target Excess Money at Risk
lv_var(15) TYPE c, " Variance
lv_bukrs TYPE bukrs,
lv_grupp TYPE grupp_cm,
lv_kunnr TYPE kunnr,
lv_kunnr1 TYPE kunnr,
lv_tmoney(6) TYPE c.
To display all the parameters in selection screen
*Company code
CALL METHOD go_dyndoc_id->new_line.
CALL METHOD go_dyndoc_id->new_line.
MOVE s_bukrs-low TO lv_bukrs.
CONCATENATE text-027 lv_bukrs INTO lv_text SEPARATED BY space.
CALL METHOD go_dyndoc_id->add_text
EXPORTING
text = lv_text
sap_style = cl_dd_area=>key.
*Customer Credit Group
CALL METHOD go_dyndoc_id->new_line.
MOVE s_grupp-low TO lv_grupp.
CONCATENATE text-028 lv_grupp INTO lv_text SEPARATED BY space.
CALL METHOD go_dyndoc_id->add_text
EXPORTING
text = lv_text
sap_style = cl_dd_area=>key.
*Customer Number
CALL METHOD go_dyndoc_id->new_line.
MOVE s_kunnr-low TO lv_kunnr.
MOVE s_kunnr-high TO lv_kunnr1.
IF lv_kunnr1 IS INITIAL.
CONCATENATE text-029 lv_kunnr INTO lv_text SEPARATED BY space.
ELSE.
CONCATENATE text-029 lv_kunnr ' TO ' lv_kunnr1 INTO lv_text SEPARATED BY space.
ENDIF.
CALL METHOD go_dyndoc_id->add_text
EXPORTING
text = lv_text
sap_style = cl_dd_area=>key.
*Target Excess Money at risk
CALL METHOD go_dyndoc_id->new_line.
MOVE p_tmoney TO lv_tmoney.
CONCATENATE text-030 lv_tmoney INTO lv_text SEPARATED BY space.
CALL METHOD go_dyndoc_id->add_text
EXPORTING
text = lv_text
sap_style = cl_dd_area=>key.
IF go_html_cntrl IS INITIAL.
CREATE OBJECT go_html_cntrl
EXPORTING
parent = go_parent_html.
ENDIF.
DATA: lv_background_id TYPE sdydo_key VALUE space.
CALL FUNCTION 'REUSE_ALV_GRID_COMMENTARY_SET'
EXPORTING
document = go_dyndoc_id
bottom = space.
CALL METHOD go_dyndoc_id->merge_document.
CALL METHOD go_dyndoc_id->set_document_background
EXPORTING
picture_id = lv_background_id.
go_dyndoc_id->html_control = go_html_cntrl.
CALL METHOD e_dyndoc_id->display_document
EXPORTING
reuse_control = abap_true
parent = go_parent_html
EXCEPTIONS
html_display_error = 1.
IF sy-subrc <> 0.
MESSAGE i014.
ENDIF.
ENDMETHOD. "END_OF_LIST
ENDCLASS. "lcl_event_receiver IMPLEMENTATION
*& Module mod_init_9000 OUTPUT
Place the values from grid object to custom container for ALV display
MODULE mod_init_9000 OUTPUT.
DATA: lo_event_receiver TYPE REF TO lcl_event_receiver."#EC *
IF cl_gui_alv_grid=>offline( ) IS INITIAL.
IF go_container IS INITIAL.
Create a custom container control for ALV control
CREATE OBJECT go_container
EXPORTING
container_name = 'CN_GRID_CONTROL'.
Split Controls
CREATE OBJECT go_splitter
EXPORTING
parent = go_container
rows = 2
columns = 1.
CALL METHOD go_splitter->set_row_height
EXPORTING
id = 1
height = 68.
CALL METHOD go_splitter->get_container
EXPORTING
row = 2
column = 1
RECEIVING
container = go_parent_html.
CALL METHOD go_splitter->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = go_parent_grid.
Create a ALV Control
CREATE OBJECT go_grid
EXPORTING
i_parent = go_parent_grid.
CREATE OBJECT go_dyndoc_id
EXPORTING
style = gc_style. "ALV_GRID
PERFORM sub_fieldcat_layout.
CREATE OBJECT lo_event_receiver.
SET HANDLER lo_event_receiver->end_of_list FOR go_grid.
CALL METHOD cl_gui_control=>set_focus
EXPORTING
control = go_grid.
Set Table for first display
PERFORM sub_table_display.
CALL METHOD go_dyndoc_id->initialize_document.
CALL METHOD go_grid->list_processing_events
EXPORTING
i_event_name = gc_event "END_OF_LIST
i_dyndoc_id = go_dyndoc_id.
ENDIF.
ENDIF.
ENDMODULE. " mod_init_9000 OUTPUT
*& Form SUB_TABLE_DISPLAY
Display the output
FORM sub_table_display .
DATA gs_layo TYPE lvc_s_layo.
gs_layo-zebra = abap_true.
gs_layo-sel_mode = gc_save.
CALL METHOD go_grid->set_table_for_first_display
EXPORTING
i_save = gv_save
i_default = gc_Default
is_layout = gs_layo
CHANGING
it_outtab = gt_final[]
it_fieldcatalog = gt_fcat.
ENDFORM. " SUB_TABLE_DISPLAY
Rewards if useful..........
Minal Nampalliwar -
Page Number - Total Page number in Blocked ALV
Hi Gurus,
I need to print the page numbers like 1 of 5 in the ALV footer. Am able to print the current page number but am unable to print the total page number in the footer of the Blocked ALV. Can any one guide me how to display the total number of pages.
Points will be awarded
Thanks
RaviHi,
Please refer to the link below :
http://www.sapdev.co.uk/reporting/alv/alvgrid_events.htm
Thanks,
Sri. -
How doi print Any variable at the end of page in ALV report?
Hi,
Anyone can tell me that How do i print Any variable at the end of page in ALV report?
Exmale: at the ende of alv report i want to print total no of employee who has taken house loan or education loan.Hi,
Go through these links
Thread in sdn regarding FOOTER IN ALV
[ALV FOOTER;
Wiki in sdn regarding HEADER AND FOOTER IN ALV
[https://wiki.sdn.sap.com/wiki/display/Snippets/ABAP%20Objects%20-%20ALV%20Model%20-%20Using%20Header%20and%20Footer]
Header and Footer in ALV
[http://www.sap-img.com/abap/test-alv-display-with-header-footer.htm]
Hope this helps.
Thank you,
Pavan. -
Hi gurus,
header must be populate on change of every new PO Number.
how do i do it in ALV.Hi
Look at the sample code.
TYPE-POOLS: abap,
col.
*& Dynamic Table
FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE,
<dyn_wa>,
<fs>.
DATA: gt_dyn TYPE REF TO data,
gw_dyn TYPE REF TO data,
r_table TYPE REF TO cl_salv_table,
r_header TYPE REF TO cl_salv_form_element,
r_footer TYPE REF TO cl_salv_form_element,
r_columns_table TYPE REF TO cl_salv_columns_table,
r_column_table TYPE REF TO cl_salv_column_table,
r_datadescr TYPE REF TO cl_abap_datadescr,
r_structdescr TYPE REF TO cl_abap_structdescr,
gw_component TYPE abap_componentdescr,
gt_component TYPE abap_component_tab.
START-OF-SELECTION.
PERFORM build_dynamic_table.
PERFORM get_data.
END-OF-SELECTION.
PERFORM display_report.
*& Form build_dynamic_table
FORM build_dynamic_table .
DATA: l_idx TYPE c,
l_desc TYPE char50,
l_hslxx TYPE p LENGTH 5 DECIMALS 2,
lt_color TYPE lvc_t_scol.
Column 1
r_datadescr ?= cl_abap_datadescr=>describe_by_data( l_desc ).
gw_component-name = 'COLUMN'.
gw_component-type = r_datadescr.
APPEND gw_component TO gt_component.
Column 2 - Types of color for each line
Do not display this column
r_datadescr ?= cl_abap_datadescr=>describe_by_data( lt_color ).
gw_component-name = 'COLOR'.
gw_component-type = r_datadescr.
APPEND gw_component TO gt_component.
DO 5 TIMES.
l_idx = sy-index.
r_datadescr ?= cl_abap_datadescr=>describe_by_data( l_hslxx ).
CONCATENATE 'COL' l_idx INTO gw_component-name.
gw_component-type = r_datadescr.
APPEND gw_component TO gt_component.
ENDDO.
TRY.
r_structdescr = cl_abap_structdescr=>create( p_components = gt_component ).
CATCH cx_sy_struct_creation .
WRITE: / 'CX_SY_STRUCT_CREATION ERROR'.
ENDTRY.
Fill the table with data from GT_DATA
CREATE DATA gw_dyn TYPE HANDLE r_structdescr.
ASSIGN gw_dyn->* TO <dyn_wa>.
CREATE DATA gt_dyn LIKE STANDARD TABLE OF <dyn_wa>.
ASSIGN gt_dyn->* TO <dyn_table>.
ENDFORM. " build_dynamic_table
*& Form get_data
FORM get_data .
select statement
ENDFORM. " get_data
*& Form display_report
FORM display_report .
PERFORM display_header. " Display ALV Header
PERFORM display_footer. " DIsplay ALV Footer
PERFORM fill_data. " Fill data
PERFORM set_color. " Set color
PERFORM display_list. " Display the ALV
ENDFORM. " display_report
*& Form display_header
FORM display_header .
DATA: lr_grid TYPE REF TO cl_salv_form_layout_grid.
CREATE OBJECT lr_grid.
lr_grid->create_text(
row = 1
column = 1
text = 'Header Line 1' ).
lr_grid->create_text(
row = 2
column = 1
text = 'Header Line 2' ).
r_header = lr_grid.
ENDFORM. " display_header
*& Form display_footer
FORM display_footer .
DATA: lr_grid TYPE REF TO cl_salv_form_layout_grid.
CREATE OBJECT lr_grid.
lr_grid->create_text(
row = 1
column = 1
text = text-266 ).
lr_grid->create_text(
row = 2
column = 1
text = text-267 ).
r_footer = lr_grid.
ENDFORM. " display_footer
*& Form set_color
FORM set_color.
DATA: lt_color TYPE lvc_t_scol,
ls_color LIKE LINE OF lt_color,
l_idx TYPE sy-tabix.
FIELD-SYMBOLS: <fs_color>.
LOOP AT <dyn_table> INTO <dyn_wa>.
l_idx = sy-tabix.
ASSIGN COMPONENT 'COLOR' OF STRUCTURE <dyn_wa> TO <fs_color>.
ls_color-color-col = col_total.
ls_color-color-col = col_normal.
ls_color-color-col = col_group.
APPEND ls_color TO lt_color.
<fs_color> = lt_color.
MODIFY <dyn_table> FROM <dyn_wa> INDEX l_idx.
UNASSIGN: <fs_color>.
ENDLOOP.
ENDFORM. " set_color
*& Form display_list
FORM display_list.
DATA: r_display TYPE REF TO cl_salv_display_settings.
Prepare the internal table for display
cl_salv_table=>factory(
EXPORTING
list_display = 'X'
IMPORTING
r_salv_table = r_table
CHANGING
t_table = <dyn_table> ).
Set report page title
r_table->set_top_of_list( r_header ).
Set report footer
r_table->set_end_of_list( r_footer ).
r_display = r_table->get_display_settings( ).
r_display->set_vertical_lines( ' ' ).
Assign all the column names
PERFORM set_column_attr.
Display the report
r_table->display( ).
ENDFORM. " display_list
*& Form set_column_attr
FORM set_column_attr.
DATA: l_idx TYPE c,
l_text(4) TYPE c,
colname TYPE lvc_fname,
outps TYPE scrtext_s,
outpm TYPE scrtext_m,
outpl TYPE scrtext_l.
r_columns_table = r_table->get_columns( ).
r_columns_table->set_headers_visible( abap_false ).
column 2
set color column
r_columns_table->set_color_column( 'COLOR' ).
DO 5 TIMES.
l_idx = sy-index.
CONCATENATE 'COL' l_idx INTO colname.
outps = colname.
outpm = colname.
outpl = colname.
r_column_table ?= r_columns_table->get_column( colname ).
r_column_table->set_optimized( value = abap_true ).
r_column_table->set_alignment( value = 1 ).
r_column_table->set_zero( value = space ).
r_column_table->set_short_text( outps ).
r_column_table->set_medium_text( outpm ).
r_column_table->set_long_text( outpl ).
ENDDO.
ENDFORM. "set_column_attr
*& Form fill_data
FORM fill_data .
DATA: l_idx TYPE c,
l_col TYPE string.
DO 5 TIMES.
l_idx = sy-index.
CONCATENATE 'COL' l_idx INTO l_col.
ASSIGN COMPONENT l_col OF STRUCTURE <dyn_wa> TO <fs>.
<fs> = 0.
UNASSIGN <fs>.
ENDDO.
DO 5 TIMES.
l_idx = sy-index.
ASSIGN COMPONENT 'COLUMN' OF STRUCTURE <dyn_wa> TO <fs>.
CONCATENATE 'Row' l_idx INTO <fs> SEPARATED BY space.
UNASSIGN <fs>.
APPEND <dyn_wa> TO <dyn_table>.
ENDDO.
ENDFORM. " fill_data
Hope it helps. -
Hi friends,
I have created one program with alv list, but i am unable to add one header and footer, also i have to add one logo to the program. Plese some one tell me a easy procedure to add a header, footer and also a logo. If you can show me one with example that would be very helpful.
This is my program, plz add the necessary parts.
*& Report Y_BOM2_ALV
REPORT y_bom2_alv LINE-SIZE 350 LINE-COUNT 350.
*& Include YINCLUDE1
TABLES : mast, stko, stpo.
TYPE-POOLS : slis.
DATA : BEGIN OF iall OCCURS 10,
matnr LIKE mast-matnr,
werks LIKE mast-werks,
stlan LIKE mast-stlan,
stlal LIKE mast-stlal,
stlst LIKE stko-stlst,
posnr LIKE stpo-posnr,
idnrk LIKE stpo-idnrk,
menge LIKE stpo-menge,
meins LIKE stpo-meins,
ausch LIKE stpo-ausch,
lgort LIKE stpo-lgort,
END OF iall.
DATA : i_repid LIKE sy-repid,
i_lines LIKE sy-tabix.
DATA : int_fcat TYPE slis_t_fieldcat_alv.
SELECTION-SCREEN BEGIN OF BLOCK a1 WITH FRAME TITLE title1.
PARAMETER : p_werks LIKE mast-werks.
SELECT-OPTIONS : s_matnr FOR mast-matnr.
SELECTION-SCREEN END OF BLOCK a1.
INITIALIZATION.
title1(50) = ' Bill Of Material Input Screen '.
*& Include YINCLUDE2
START-OF-SELECTION.
SELECT mastmatnr mastwerks maststlan maststlal stko~stlst
stpoposnr stpoidnrk stpomenge stpomeins stpo~ausch
stpo~lgort INTO TABLE iall FROM stpo INNER JOIN stko ON
stpostlnr = stkostlnr INNER JOIN mast ON
stpostlnr = maststlnr WHERE mast~werks EQ
p_werks AND mast~matnr IN s_matnr.
IF sy-subrc <> 0 OR p_werks EQ ' ' OR s_matnr EQ ' '.
CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
EXPORTING
titel = 'ERROR MESSAGE ( INPUT ERROR / WRONG INPUT ) '
textline1 = ' PLANT / MATERIAL Invalid or Empty '
textline2 = ' Plese enter plant no / material no again '
start_column = 20
start_row = 5.
EXIT.
ENDIF.
CLEAR i_lines.
DESCRIBE TABLE iall LINES i_lines.
IF i_lines LT 1.
WRITE: /
'No materials found.'.
EXIT.
ENDIF.
END-OF-SELECTION.
i_repid = sy-repid.
*& Include YINCLUDE3
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = i_repid
i_internal_tabname = 'IALL'
i_inclname = i_repid
CHANGING
ct_fieldcat = int_fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
WRITE: /
'Returncode',
sy-subrc,
'from FUNCTION REUSE_ALV_FIELDCATALOG_MERGE'.
ENDIF.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = i_repid
it_fieldcat = int_fcat
i_save = 'A'
TABLES
t_outtab = iall
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
WRITE: /
'Returncode',
sy-subrc,
'from FUNCTION REUSE_ALV_LIST_DISPLAY'.
ENDIF.Hi Tapodipta,
See below example and modify ur code according to ur requirement..
REPORT ZTEST_ALV_CHECK .
TYPE-POOLS: SLIS.
DATA: X_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
L_LAYOUT type slis_layout_alv,
x_events type slis_alv_event,
it_events type SLIS_T_EVENT.
DATA: BEGIN OF ITAB OCCURS 0,
VBELN LIKE VBAK-VBELN,
POSNR LIKE VBAP-POSNR,
END OF ITAB.
SELECT VBELN
POSNR
FROM VBAP
UP TO 20 ROWS
INTO TABLE ITAB.
X_FIELDCAT-FIELDNAME = 'VBELN'.
X_FIELDCAT-SELTEXT_L = 'VBELN'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = 1.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
X_FIELDCAT-FIELDNAME = 'POSNR'.
X_FIELDCAT-SELTEXT_L = 'POSNR'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = 2.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
x_events-NAME = SLIS_EV_END_OF_PAGE.
x_events-FORM = 'END_OF_PAGE'.
APPEND x_events TO iT_EVENTS.
CLEAR x_events .
x_events-NAME = SLIS_EV_TOP_OF_PAGE.
x_events-FORM = 'TOP_OF_PAGE'.
APPEND x_events TO iT_EVENTS.
CLEAR x_events .
x_events-NAME = slis_ev_end_of_list.
x_events-FORM = 'END_OF_LIST'.
APPEND x_events TO iT_EVENTS.
CLEAR x_events .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT = L_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
it_events = it_events
TABLES
T_OUTTAB = ITAB
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
FORM TOP_OF_PAGE.
* BREAK-POINT.
WRITE: / 'TOP_OF_PAGE'.
ENDFORM.
FORM END_OF_LIST.
* BREAK-POINT.
"here you can use this for footer
WRITE: / 'FOR FOOTER'.
ENDFORM.
FORM END_OF_PAGE.
* BREAK-POINT.
WRITE: / 'END_OF_PAGE'.
ENDFORM.
Go through the link as well..
Re: ALV Footer
Hope it will solve ur problem..
<b>Reward points if useful..</b>
Thanks & Regards
ilesh 24x7 -
Hi,
I want to display a message on the status bar along with the output . That is output and message should appear on the same screen together. Neither before the output nor after the the output.
Best Regards,Hi,
One option is to use ALV Container. Create a screen with ALV container & keep some blank lines at the footer of the screen. Use classes to call the ALV footer for populating the message.
Thanks,
Best regards,
Prashant -
Hi all,
When i take ALV report print the data was not very as we see in the screen , so is there anyother way so that we can adjust width of the rows, make font size adjustable , remove background color etc ....
i dont want download into excel and do modifications ?
Thanks,
SivaHi,
check below links/
Re: ALV Footer
/people/vijaybabu.dudla/blog/2006/07/21/topofpage-in-alv-using-clguialvgrid
Regards,
Madhu
Maybe you are looking for
-
I have three itunes accounts and want to merge them
I have three iTunes accounts and have found that at times we have purchased multiple of the same items as a result. Can I merge two of the lesser accounts by gifting or otherwise migrating the songs, apps, videos etc to one master account?
-
Animated GIF in MIAW not so animated
My stage has a handler that executes a shell Ping command which unfortunately is not asynchronous, this means the stage has to wait for a response back from the remote computer before it can proceed and that response could take as long as 30 seconds.
-
Using Multiple iMovie files in iDVD
After how quickly I learned to use iMovie, I'm quite upset with how difficult it is to do what I want in iDVD. Here's the issue: My parents went on a trip last year and took a lot of video (over 9 hours). Over the past few months, I've pared this dow
-
Hello All, I have a requirement where the user would change the delivery date for Sales Order or for purchase order. Whenever the delivery date is changed I need send an email to the user and some other people. What would be a starting point for this
-
Is it possible to make a playlist of particular material and then delete them from the Music list and just keep them in the play list? than you. first time user/.