How to get a Footer text in alv grid?
Hi,
am using RESUE_ALV_COMMENTARy_write... it is getting only on top of page..
suggest me to get Footer text in ALV GRiD.
Regards,
sodanapalli
Moderator message: please do more research before asking, all points removed (both replies were copy/pasted anyway)
Edited by: Thomas Zloch on May 19, 2011 5:41 PM
Step1: Populate the ALV event table with 'END_OF_LIST' event
Step2: Populate the footer text in to an internal table which is of type
slis_t_listheader.
Step3: Create a subroutine with name 'END_OF_LIST' and with in this form we have to call the function module u2018REUSE_ALV_COMMENTARY_WRITEu2019.
Step4: Now call the function module REUSE_ALV_GRID_DISPLAYu2019 to display the ALV report. Whenever u2018END_OF_LIST' event is get fired it executes the subroutine END_OF_LIST and displays the text into the footer of the ALV GRID.
Code:
*& Report Z_TEST_ALV
REPORT z_test_alv.
TYPE-POOLS: slis.
DATA: i_mara TYPE STANDARD TABLE OF mara INITIAL SIZE 0,
i_events TYPE slis_t_event,
i_end_of_page TYPE slis_t_listheader,
w_events TYPE slis_alv_event,
v_repid LIKE sy-repid.
START-OF-SELECTION.
SELECT * FROM
mara INTO TABLE i_mara
UP TO 100 ROWS.
CHECK sy-subrc = 0.
PERFORM populate_alv_event.
PERFORM comment_build USING i_end_of_page[].
PERFORM display_grid.
*& Form POPULATE_ALV_EVENT
FORM populate_alv_event .
Populate event table
w_events-name = 'END_OF_LIST'.
w_events-form = 'END_OF_LIST'.
APPEND w_events TO i_events.
ENDFORM. " POPULATE_ALV_EVENT
*& Form COMMENT_BUILD
FORM comment_build USING p_i_end_of_page TYPE slis_t_listheader.
DATA: ls_line TYPE slis_listheader.
REFRESH p_i_end_of_page.
CLEAR ls_line.
ls_line-typ = 'H'.
ls_line-info = 'This is end of list'(001).
APPEND ls_line TO p_i_end_of_page.
ENDFORM. " COMMENT_BUILD
*& Form end_of_list
FORM end_of_list.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = i_end_of_page.
ENDFORM. "end_of_list
*& Form DISPLAY_GRID
FORM display_grid .
v_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_repid
i_structure_name = 'MARA'
it_events = i_events
TABLES
it_outtab = i_mara
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
ENDFORM. " DISPLAY_GRID
Check the output where footer will be displayed as 'THIS IS END OF LIST'
Similar Messages
-
How to get Grand Total Text in ALV GRID
Hi Folks,
I am able to get the SUBTOTAL TEXT .....But i need...
How to get Grand Total Text in ALV GRID Display...
Can any one give a Solution for this...Hi Surendar,
Check out this code.. this is showing Total Text in Toal line in the very first column.
REPORT zsales_ord_det_1 .
TABLES: ztable_10.
TYPE-POOLS: slis.
DATA: BEGIN OF it OCCURS 0,
srno(6) type c,
name LIKE ztable_10-name,
age LIKE ztable_10-age,
END OF it.
DATA : BEGIN OF it_temp OCCURS 0,
name LIKE ztable_10-name,
age LIKE ztable_10-age,
END OF it_temp.
DATA: i_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv.
DATA: v_repid LIKE sy-repid,
i_index TYPE STANDARD TABLE OF i WITH HEADER LINE,
gs_layout TYPE slis_layout_alv,
gd_layout TYPE slis_layout_alv,
i_sort TYPE STANDARD TABLE OF slis_sortinfo_alv,
wa_sort TYPE slis_sortinfo_alv.
START-OF-SELECTION.
v_repid = sy-repid.
SELECT * FROM ztable_10 INTO TABLE it_temp.
LOOP AT it_temp .
it-srno = 'Total'.
it-name = it_temp-name.
it-age = it_temp-age.
APPEND it.
ENDLOOP.
END-OF-SELECTION.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = v_repid
i_internal_tabname = 'IT'
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
i_inclname = v_repid
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
ct_fieldcat = i_fieldcat[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 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_fieldcat-row_pos = 1.
wa_fieldcat-col_pos = 1.
wa_fieldcat-fieldname = 'SRNO'.
wa_fieldcat-tabname = it.
append wa_fieldcat to i_fieldcat.
LOOP AT i_fieldcat INTO wa_fieldcat.
IF wa_fieldcat-fieldname = 'AGE'.
wa_fieldcat-do_sum = 'X'.
MODIFY i_fieldcat FROM wa_fieldcat.
ENDIF.
IF wa_fieldcat-fieldname = 'SRNO'.
Hide this field so that it can display it's content i.e.
Total text in Subtotal level
wa_fieldcat-tech = 'X'.
wa_fieldcat-no_out = 'X'.
MODIFY i_fieldcat FROM wa_fieldcat TRANSPORTING tech no_out.
ENDIF.
ENDLOOP.
wa_sort-spos = 1.
wa_sort-fieldname = 'SRNO'.
wa_sort-up = 'X'.
wa_sort-subtot = 'X'.
APPEND wa_sort TO i_sort.
gd_layout-no_totalline = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = v_repid
I_CALLBACK_PF_STATUS_SET = ' '
i_callback_user_command = 'USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
is_layout = gd_layout
it_fieldcat = i_fieldcat[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
it_sort = i_sort
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = it
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.
Regards,
Seema -
How to display sub total text in ALV grid display reporting
Hi,
I want to display a text 'SUB TOTAL' in Sub total row of an ALV report.
Presently I am getting the name of the field used in sorting to get sub totals. But I required to display own text. Could you please give me solution.
Thanks
Giridhar KarnamFor doing this u need to simply modify the layout properties, please award points if found helpful
DATA: L_LAYOUT TYPE SLIS_LAYOUT_ALV.
L_LAYOUT-SUBTOTALS_TEXT = 'GEN SUBTOT'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT = L_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
TABLES
T_OUTTAB = IT_FINAL
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2. -
How to get selected records from an ALV Grid in some other internal table
I am using a standard SAP program (RFKKMA02) in a Z program. Now i want to select some rows in ALV and after doing some modification, i want to store those records in some other internal table. I am not using OO concept.
Thanks in advance.u create first internal table of structur of fields that u want to copy and then move taht values to internal table
-
HI ALL,
could any one send me how to display the subtotal Text in ALV grid output with code sample.
with thanks.
kannanhi,
means u want to print some text instead of star ( coming in subtotal) ?
If so than try like,
*& Report ZALV_LIST
REPORT zalv_list.
TABLES : mseg.
TYPE-POOLS : slis.
DATA : BEGIN OF itab OCCURS 0,
mblnr LIKE mseg-mblnr,
matnr LIKE mseg-matnr,
werks LIKE mseg-werks,
menge LIKE mseg-menge,
line_color(4) TYPE c,
END OF itab.
DATA : BEGIN OF itab1 OCCURS 0,
mblnr LIKE mseg-mblnr,
matnr LIKE mseg-matnr,
werks LIKE mseg-werks,
menge LIKE mseg-menge,
line_color(4) TYPE c,
END OF itab1.
DATA : t_fcat TYPE slis_t_fieldcat_alv,
t_eve TYPE slis_t_event,
t_subtot TYPE slis_t_sortinfo_alv,
subtot LIKE LINE OF t_subtot,
wa_fcat LIKE LINE OF t_fcat,
gd_layout TYPE slis_layout_alv.
DATA : gt_menge LIKE mseg-menge,
st_menge LIKE mseg-menge.
SELECTION-SCREEN : BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : doc FOR mseg-mblnr.
SELECTION-SCREEN : END OF BLOCK blk1.
INITIALIZATION.
PERFORM build_cat USING t_fcat.
PERFORM build_eve.
PERFORM build_layout.
START-OF-SELECTION.
PERFORM get_data.
PERFORM display.
*& Form build_cat
text
-->TEMP_FCAT text
FORM build_cat USING temp_fcat TYPE slis_t_fieldcat_alv.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'MBLNR'.
wa_fcat-seltext_m = 'Material Doc.'.
APPEND wa_fcat TO temp_fcat.
CLEAR wa_fcat.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'MATNR'.
wa_fcat-seltext_m = 'Material'.
APPEND wa_fcat TO temp_fcat.
CLEAR wa_fcat.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'WERKS'.
wa_fcat-seltext_m = 'Plant'.
APPEND wa_fcat TO temp_fcat.
CLEAR wa_fcat.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'MENGE'.
wa_fcat-seltext_m = 'Quantity'.
wa_fcat-do_sum = 'Y'.
APPEND wa_fcat TO temp_fcat.
CLEAR wa_fcat.
subtot-spos = 1.
subtot-fieldname = 'MBLNR'.
subtot-tabname = 'ITAB'.
subtot-up = 'X'.
subtot-group = 'X'.
subtot-subtot = 'X'.
subtot-expa = 'X'.
APPEND subtot TO t_subtot.
ENDFORM. "build_cat
*& Form build_eve
text
FORM build_eve.
DATA : wa_eve TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = t_eve
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.
READ TABLE t_eve WITH KEY name = slis_ev_top_of_page
INTO wa_eve.
IF sy-subrc = 0.
MOVE 'TOP_OF_PAGE' TO wa_eve-form.
APPEND wa_eve TO t_eve.
ENDIF.
ENDFORM. "build_eve
*& Form build_layout
text
FORM build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-info_fieldname = 'LINE_COLOR'.
gd_layout-subtotals_text = 'Sub Total'.
ENDFORM. " BUILD_LAYOUT
*& Form get_data
text
FORM get_data.
SELECT mblnr matnr werks menge FROM mseg INTO CORRESPONDING FIELDS OF TABLE itab
WHERE mblnr IN doc.
SORT itab BY mblnr.
LOOP AT itab.
AT NEW mblnr.
LOOP AT itab WHERE mblnr = itab-mblnr.
st_menge = st_menge + itab-menge.
itab1-mblnr = itab-mblnr.
itab1-matnr = itab-matnr.
itab1-werks = itab-werks.
itab1-menge = itab-menge.
APPEND itab1.
ENDLOOP.
itab1-mblnr = 'Sub_Total'.
itab1-matnr = ''.
itab1-werks = ''.
itab1-menge = st_menge.
itab1-line_color = 'C710'.
APPEND itab1.
itab1-line_color = ''.
CLEAR st_menge.
ENDAT.
ENDLOOP.
LOOP AT itab.
gt_menge = gt_menge + itab-menge.
ENDLOOP.
itab1-mblnr = 'Total'.
itab1-matnr = ''.
itab1-werks = ''.
itab1-menge = gt_menge.
itab1-line_color = 'C310'.
APPEND itab1.
ENDFORM. "get_data
*& Form display
text
FORM display.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = 'ZALV_LIST'
is_layout = gd_layout
it_fieldcat = t_fcat
it_sort = t_subtot
it_events = t_eve
TABLES
t_outtab = itab1
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. "display
*& Form top_of_page
text
FORM top_of_page.
WRITE:/ 'Data'.
ENDFORM. "top_of_page
reward if useful....
Edited by: Dhwani shah on Dec 20, 2007 1:20 PM -
How we can get an interactive report in alv grid display?
Hi experts
Plz tell me how we can get an interactive report in alv grid disply pls send me one sample code to understand this
thanks in advancehi,
check this one
*& Report ZALV_FIELD_GRID1
REPORT ZALV_FIELD_GRID1
NO STANDARD PAGE HEADING.
TABLES MARA.
type-pools :slis.
TYPES : BEGIN OF TMARA ,
MATNR LIKE MARA-MATNR,
MEINS LIKE MARA-MEINS,
ERSDA LIKE MARA-ERSDA,
color(4) type c,
SEL type c,
LIGHT TYPE C,
END OF TMARA.
TYPES: BEGIN OF TMAKT,
MATNR LIKE MAKT-MATNR,
MAKTX LIKE MAKT-MAKTX,
MAKTG LIKE MAKT-MAKTG,
SEL TYPE C,
COLOR(4),
END OF TMAKT.
DATA: ITAB TYPE TMARA OCCURS 0 WITH HEADER LINE,
ITAB1 TYPE TMAKT OCCURS 0 WITH HEADER LINE,
wa_fieldcat type slis_fieldcat_alv,
fieldcat type slis_fieldcat_alv occurs 0,
i_layout type slis_layout_alv,
WA_LISTHEADER TYPE SLIS_LISTHEADER,
i_LISTHEADER TYPE SLIS_LISTHEADER OCCURS 0,
V_EVENTS TYPE SLIS_T_EVENT ,
WA_EVENT TYPE SLIS_ALV_EVENT,
I_TITLE_MARA TYPE LVC_TITLE VALUE 'FIRST LIST DISPLAYED',
I_TITLE_MAKT TYPE LVC_TITLE VALUE 'SECONDRY LIST DISPLAYED',
SORT TYPE slis_t_sortinfo_alv WITH HEADER LINE,
PRINT_CONT type slis_print_alv.
SELECTION SCREE
selection-screen begin of block screen1 with frame title TEXT-001.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN COMMENT /32(35) COMM1.
SELECTION-SCREEN ULINE /27(35).
SELECTION-SCREEN SKIP.
SELECT-OPTIONS MATNR FOR MARA-MATNR.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN ULINE.
SELECTION-SCREEN COMMENT /30(50) COMM2.
SELECTION-SCREEN ULINE /27(40).
SELECTION-SCREEN SKIP.
SELECT-OPTIONS ERSDA FOR MARA-ERSDA.
SELECTION-SCREEN SKIP.
selection-screen end of block screen1.
INITIALIZATION
INITIALIZATION.
MATNR-low = '23'.
MATNR-high = '1000'.
MATNR-option = 'BT'.
MATNR-sign = 'I'.
APPEND MATNR.
ERSDA-low = '20030124'.
ERSDA-high = '20050302' .
APPEND ERSDA.
PERFORM FILLFIELD.
PERFORM FILLLAYOUT.
PERFORM build_print_params.
PERFORM FILL_SORT.
PERFORM EVENT_CALL.
PERFORM POPULATE_EVENT.
SELECTION-SCREEN OUTPUT
AT SELECTION-SCREEN OUTPUT.
comm1 ='SELECT MATERIAL NUMBER RANGE'.
comm2 ='SELECT MATERIAL CREATION DATE'.
START-OF-SELECTION
START-OF-SELECTION.
PERFORM READDATA.
PERFORM POPDATA.
*& Form READDATA
text
FORM READDATA .
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = MATNR-LOW
IMPORTING
OUTPUT = MATNR-LOW.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = MATNR-HIGH
IMPORTING
OUTPUT = MATNR-HIGH.
SELECT MATNR
ERSDA
MEINS
FROM MARA
INTO CORRESPONDING FIELDS OF
TABLE ITAB
WHERE MATNR IN MATNR AND ERSDA IN ERSDA.
LOOP AT ITAB.
data id_color type i VALUE 1.
data id_colors(2) type c.
IF ITAB-MATNR < '000000000000000100'.
ITAB-LIGHT = '1'.
ELSEIF ITAB-MATNR < '000000000000000150' AND ITAB-MATNR >
'000000000000000100' .
ITAB-LIGHT = '2'.
ELSE.
ITAB-LIGHT = '3'.
ENDIF.
id_color = id_color + 1.
if id_color > 7.
id_color = 1.
endif.
id_colors = id_color.
concatenate 'C' id_colors '10' into itab-color.
modify itab.
CLEAR ITAB.
endloop.
ENDFORM. " READDATA
Form FILLFIELD
FORM FILLFIELD .
WA_FIELDCAT-FIELDNAME = 'MATNR'.
WA_FIELDCAT-KEY = 'X'.
WA_FIELDCAT-COL_POS = '1'.
WA_FIELDCAT-outputlen = 20.
WA_FIELDCAT-HOTSPOT = 'X'.
wa_fieldcat-seltext_m = 'MATERIAL NUMBER'.
*WA_FIELDCAT-EMPHASIZE = 'C210'.
APPEND WA_FIELDCAT TO FIELDCAT.
clear wa_fieldcat.
WA_FIELDCAT-FIELDNAME = 'MEINS'.
WA_FIELDCAT-COL_POS = '2'.
*WA_FIELDCAT-EMPHASIZE = 'C510'.
WA_FIELDCAT-outputlen = 10.
wa_fieldcat-seltext_m = 'UNIT'.
APPEND WA_FIELDCAT TO FIELDCAT.
clear wa_fieldcat.
WA_FIELDCAT-FIELDNAME = 'ERSDA'.
WA_FIELDCAT-COL_POS = '3'.
WA_FIELDCAT-outputlen = 15.
*WA_FIELDCAT-EDIT_MASK = 'DD.MM.YYYY'.
*WA_FIELDCAT-EMPHASIZE = 'C710'.
wa_fieldcat-seltext_m = 'CREAT DATE'.
APPEND WA_FIELDCAT TO FIELDCAT.
clear wa_fieldcat.
ENDFORM. "FILLFIELD
Setup print parameters
form build_print_params.
PRINT_CONT-reserve_lines = '3'. "Lines reserved for footer
PRINT_CONT-no_coverpage = 'X'.
endform. " BUILD_PRINT_PARAMS
Form POPDATA
FORM POPDATA .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = sy-repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'USER-COMMAND'
I_CALLBACK_TOP_OF_PAGE = 'TOPPAGE'
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE = I_TITLE_MARA
I_GRID_SETTINGS =
IS_LAYOUT = I_LAYOUT
IT_FIELDCAT = fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT = SORT[]
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = V_EVENTS
IT_EVENT_EXIT =
IS_PRINT = PRINT_CONT
TABLES
T_OUTTAB = ITAB
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
ENDFORM. " POPDATA
Form TOPPAGE
FORM TOPPAGE.
REFRESH I_LISTHEADER.
DATA: ld_lines type i,
ld_linesc(10) type c,
I_DATE(10) TYPE C,
I_INFO LIKE WA_LISTHEADER-INFO.
WA_LISTHEADER-TYP = 'H'.
WA_LISTHEADER-INFO = 'MATERIAL DETAIL'.
APPEND WA_LISTHEADER TO I_LISTHEADER.
CLEAR WA_LISTHEADER.
WA_LISTHEADER-TYP = 'S'.
WA_LISTHEADER-KEY = 'DATE :'.
CONCATENATE SY-DATUM+6(2) '.'
SY-DATUM+4(2) '.'
SY-DATUM(4) INTO I_DATE.
WA_LISTHEADER-INFO = I_datE.
APPEND WA_LISTHEADER TO I_LISTHEADER.
CLEAR WA_LISTHEADER.
describe table ITAB lines ld_lines.
ld_linesc = ld_lines.
concatenate 'TOTAL NUMBER OF RECORD SELECTED: ' ld_linesc
into I_INFO separated by space.
WA_LISTHEADER-TYP = 'A'.
WA_LISTHEADER-INFO = I_INFO.
append WA_LISTHEADER to I_LISTHEADER.
clear: WA_LISTHEADER , I_INFO.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = I_LISTHEADER
I_LOGO = 'ENJOYSAP_LOGO'.
ENDFORM. "TOPPAGE
Form FILLLAYOUT
FORM FILLLAYOUT .
i_layout-zebra = 'X'.
i_layout-info_fieldname = 'COLOR'.
i_layout-box_fieldname = 'SEL'.
I_LAYOUT-lights_fieldname = 'LIGHT'.
I_LAYOUT-EDIT ='X'.
I_LAYOUT-colwidth_optimize = 'X'.
I_LAYOUT-window_titlebar = 'EXAMPLE FOR ALV GRID'.
I_LAYOUT-no_totalline = 'X'.
ENDFORM. "FILLLAYOUT
Form FILL_SORT
FORM FILL_SORT .
SORT-DOWN = 'X'.
SORT-SPOS = 1.
SORT-FIELDNAME = 'MATNR'.
SORT-tabname = 'MARA'.
APPEND SORT.
ENDFORM. " FILL_SORT
Form EVENT_CALL
FORM EVENT_CALL .
DATA: I_EVENT LIKE V_EVENTS.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = V_EVENTS.
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. " EVENT_CALL
Form POPULATE_EVENT
FORM POPULATE_EVENT .
READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.
IF SY-SUBRC EQ 0.
WA_EVENT-FORM = 'USER_COMMAND'.
MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
WA_EVENT-NAME.
READ TABLE V_EVENTS WITH KEY NAME = SLIS_EV_END_OF_PAGE
INTO WA_EVENT.
IF SY-SUBRC = 0.
move 'END_OF_PAGE' to WA_EVENT-FORM.
MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
WA_EVENT-NAME.
endif.
ENDIF.
ENDFORM. "POPULATE_EVENT
FORM END_OF_PAGE.
write: sy-uline(50).
skip.
write:/40 'Page:', sy-pagno .
ENDFORM.
*& Form USER_COMMAND
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOMM.
WHEN '&IC1'.
CASE RS_SELFIELD-FIELDNAME.
when 'MATNR'.
read table itab with key matnr = RS_SELFIELD-VALUE.
if sy-subrc = 0.
PERFORM DATA_RETRIEVAL_MAKT USING RS_SELFIELD-VALUE.
PERFORM BUILD_FIELDCATLOG_MAKT.
PERFORM FILLLAYOUT_MAKT.
PERFORM DISPLAY_ALV_MAKT.
CLEAR RS_SELFIELD.
ENDIF.
ENDCASE.
ENDCASE.
ENDFORM. "user_command
Form DATA_RETRIEVAL_MAKT
FORM DATA_RETRIEVAL_MAKT USING TMATNR .
SELECT MATNR
MAKTX
MAKTG
UP TO 100 ROWS
FROM MAKT
INTO TABLE ITAB1
WHERE SPRAS = 'EN' AND MATNR = TMATNR.
LOOP AT ITAB1.
data id_color type i VALUE 1.
data id_colors(2) type c.
id_color = id_color + 1.
if id_color > 7.
id_color = 1.
endif.
id_colors = id_color.
concatenate 'C' id_colors '10' into itab1-color.
modify itab1.
CLEAR ITAB1.
ENDLOOP.
ENDFORM. "DATA_RETRIEVAL_MAKT
Form FILLLAYOUT_MAKT
FORM FILLLAYOUT_MAKT .
CLEAR I_LAYOUT.
i_layout-zebra = 'X'.
i_layout-info_fieldname = 'COLOR'.
i_layout-box_fieldname = 'SEL'.
I_LAYOUT-EDIT ='X'.
I_LAYOUT-colwidth_optimize = 'X'.
I_LAYOUT-window_titlebar = 'EXAMPLE FOR ALV GRID'.
ENDFORM. " LAYOUT_MAKT
Form BUILD_FIELDCATLOG_MAKT
FORM BUILD_FIELDCATLOG_MAKT .
REFRESH FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'MATNR'.
WA_FIELDCAT-KEY = 'X'.
WA_FIELDCAT-COL_POS = '1'.
*WA_FIELDCAT-EDIT_MASK = 'DD.MM.YYYY'.
WA_FIELDCAT-EMPHASIZE = 'C510'.
wa_fieldcat-seltext_m = 'MATERIAL NUMBER'.
APPEND WA_FIELDCAT TO FIELDCAT.
clear wa_fieldcat.
WA_FIELDCAT-FIELDNAME = 'MAKTX'.
WA_FIELDCAT-COL_POS = '2'.
WA_FIELDCAT-EMPHASIZE = 'C710'.
wa_fieldcat-seltext_m = 'MATERIAL DESCRIPTION'.
APPEND WA_FIELDCAT TO FIELDCAT.
clear wa_fieldcat.
WA_FIELDCAT-FIELDNAME = 'MAKTG'.
WA_FIELDCAT-COL_POS = '3'.
WA_FIELDCAT-EMPHASIZE = 'C210'.
wa_fieldcat-seltext_m = 'MATERIAL DESCRIPTION'.
APPEND WA_FIELDCAT TO FIELDCAT.
clear wa_fieldcat.
ENDFORM. " BUILD_FIELDCATLOG_MAKT
Form DISPLAY_ALV_MAKT
FORM TOP-OF-PAGE.
REFRESH I_LISTHEADER.
DATA: ld_lines type i,
ld_linesc(10) type c,
I_DATE(10) TYPE C,
I_INFO LIKE WA_LISTHEADER-INFO.
WA_LISTHEADER-TYP = 'H'.
WA_LISTHEADER-INFO = 'MATERIAL DESCRIPTION FOR SELECTED NUMBER'.
APPEND WA_LISTHEADER TO I_LISTHEADER.
CLEAR WA_LISTHEADER.
WA_LISTHEADER-TYP = 'S'.
WA_LISTHEADER-KEY = 'DATE :'.
CONCATENATE SY-DATUM+6(2) '.'
SY-DATUM+4(2) '.'
SY-DATUM(4) INTO I_DATE.
WA_LISTHEADER-INFO = I_datE.
APPEND WA_LISTHEADER TO I_LISTHEADER.
CLEAR WA_LISTHEADER.
describe table ITAB1 lines ld_lines.
ld_linesc = ld_lines.
concatenate 'TOTAL NUMBER OF RECORD SELECTED: ' ld_linesc
into I_INFO separated by space.
WA_LISTHEADER-TYP = 'A'.
WA_LISTHEADER-INFO = I_INFO.
append WA_LISTHEADER to I_LISTHEADER.
clear: WA_LISTHEADER , I_INFO.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = I_LISTHEADER
I_LOGO = 'ENJOYSAP_LOGO'.
I_END_OF_LIST_GRID =
I_ALV_FORM =
ENDFORM. "TOP-OF-PAGE
*& Form DISPLAY_ALV_MAKT
text
FORM DISPLAY_ALV_MAKT .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE'
I_GRID_TITLE = I_TITLE_MAKT
IS_LAYOUT = I_LAYOUT
IT_FIELDCAT = fieldcat
TABLES
T_OUTTAB = ITAB1
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. " DISPLAY_ALV_MAKT
Rewards points -
How to get the actual data in ALV report
I am doing some upgradation work in that i am using Submit & And return and also i am using some function modules like LIST FROM MEMORY , LIST TO TXT wnd WRITE LIST , it gives output in normal list format , But i need to print in ALV report .
With the use of set table for 1st display i got the ALV report but not with actual data, (some junk value is showing) , So can any 1 suggest me how to get the actual data in ALV report, With the use of Any Function Module or with Coding,
with regards,Hi Saravana
I am sure you must be getting the values in tables of table parameters from every FM.
consolidate the values from tables of all FMs in one table and built ALV for that table only.
I hope this way you can show the actual data in ALV.
thanks
Lalit -
How to get the total pages in ALV report?
Hi guys,
Since I used page breaks can somebody please help me on how to get the total pages in ALV report?sincerely please...thanks guys.automatic display total page.
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907
r -
How to get the short text in tcode "msc3n" -- Basic data 2 -- short text.
I have to display the short text in my report output.
How to get the short text in tcode "msc3n" ( msc3n --> Basic data 2 --> short text.)?
Is there any function module availble to get this short text or is this stored in any data base table ?
Please help me. Your help will be highly appreaciated.
THANKS.Hi,
Use FM 'READ_TEXT' to get this values.
Say for exampele my material is 1900001 and batch is 0000000517.
Then my parameters to the FM will be as follows:-
Text Name 000000000001900001 0000000517
Language EN
Text ID VERM
Text Object CHARGE
This information you can get as follows.
Open the short text window in the text editor.
Here you can enter the long text.
In the editor Go to Header and you will find the details.
Please note that the text name will comprise of
Material
Batch
Plant
Stor. Location
if all the details are given.
I hope this helps you.
Regards,
Ankur Parab -
How to get the bold texts in JTextPane?
How to get the bold texts in JTextPane?
I believe you need to look at the Elements of the Document. Use the Document.getDefaultRootElement() method to get the first root Element. From there you can iterate through all the Elements. You should then be able to check the attributes of the element to see if it contains the Bold attribute using something like:
AttributeSet attributes = element.getAttributes();
if ( attributes.containsAttribute(StyleConstants.Bold, Boolean.TRUE)
// do processing here -
How to wrap the heading text in alv.
HI all,
I need help, how to wrap the heading text in alv.
can any help ... plz..
Advanced Thanks
Regards
GUhapriyanHello GuhaPriyan,
I assume that you're referring to the ALV Grid's title. The maximum length for this title is 70 characters and this would generally fit in the one line.
Are you intending to wrap it because you purposefully want the text to come in two lines? In that case, I'm not sure that it's possible.
But otherwise, there's an option in the Layout called SMALLTITLE. You can set this attribute so that the title would be displayed in a amaller font and hopefully, all of your text shows up on the screen.
Regards,
Anand Mandalika. -
HOW CAN GET BACK MY TEXT MSG & PICTURES DELETED
HOW CAN GET BACK MY TEXT MSG & PICTURES DELETED I REALY NEED
lilsimms1228 wrote:
How can I get an overview of old text messages and phone call [personal detail removed]
If you are the account owner, you can access the last year of calls records and the last three months of message summary (date, time, number texted, there is no where to see the text context) through your online account. Click on the HOME Tab once logged in and choose PRINT BILLS and then click on the pull down menu to choose any invoice for the last twelve months to view. -
How to get PO header text in PO list
Hi All,
Please let me know how to get PO header text in PO list.
Thanks,
AmaCheck this link for answer
PO Header Text -
How to get the Arabic text to speech on N8 ?
How to get the Arabic text to speech on N8 ?
Unfortunately it is not currently an available option:http://www.nokia.com/global/support/text-to-speech-s60-32-downloads/
Happy to have helped forum with a Support Ratio = 42.5 -
Need to add Header and footer in an alv grid display output.
How can I add header and footer in an alv grid dispay output.
For the grid display, I am using the function module "REUSE_ALV_GRID_DISPLAY".HI,
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE'
i_callback_html_end_of_list = 'END_OF_LIST_HTML'
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
i_save = 'X'
tables
t_outtab = it_ekko
exceptions
program_error = 1
others = 2.
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'.
ls_text = 'Footer title'.
adds and icon (red triangle)
CALL METHOD end->add_icon
EXPORTING
sap_icon = 'IL'.
adds test (via variable)
CALL METHOD end->add_text
EXPORTING
text = ls_text
sap_emphasis = 'strong'.
adds new line (start new line)
CALL METHOD end->new_line.
display text(bold)
CALL METHOD end->add_text
EXPORTING
text = 'Bold text'
sap_emphasis = 'strong'.
adds new line (start new line)
CALL METHOD end->new_line.
display text(normal)
CALL METHOD end->add_text
EXPORTING
text = 'Nor'.
adds new line (start new line)
CALL METHOD end->new_line.
display text(bold)
CALL METHOD end->add_text
EXPORTING
text = 'Yellow '
sap_emphasis = 'str'.
adds and icon (yellow triangle)
CALL METHOD end->add_icon
EXPORTING
sap_icon = 'IC''.
display text(normal)
CALL METHOD end->add_text
EXPORTING
text = 'Mor'.
*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 = 14.
ENDFORM. "end_of_list_html.
This will solve it. Post if you need more help in this.
Regards,
Madhu.
Maybe you are looking for
-
I just got a new 256GB SSD drive for my mac, I want to import my data from time machine backup, but its larger than 256GB since it used to be on my old optical drive. How can I import my latest backup keeping out some big files on the external drive?
-
How to Upgrade from OS X 10.5.8?
I'm using an Intel MacBook running OS 10.5.8 and want to upgrade to Mountain Lion. I never bothered to upgrade the OS to 10.6 (Snow Leopard), however, and now I cannot for the life of me find it available anywhere. I understand 10.6 is stepping-sto
-
TS2529 why can't i activate my iphone 3gs?
my iphone 3gs couldn't be activated. help me.
-
I'm about to do a clean install of my system (Dell Precision T5400 64-bit system with 2 300GB drives setup in a RAID 1 mirror and 8GB of memory). I will be running XP Pro x64 Edition with Service Pack 2. I have had itunes running over the last year f
-
Updating a databse using jsp. Wierd problem
Can anyone help me with this wierd problem. I update a databse using: stmt.executeUpdate("UPDATE status_table SET " + updateString + " WHERE login = '" + userLogin + "'"); The updateString is: otrans_comments = 'Please submit certified true photocopi