2008 Apr 01 1:40 PM
Hi all,
my requirement is to remove buttons in left side of grid output
in existing alv grid report ,
i am sending sample code of pls revert me with modification
pls do needful
TYPE-POOLS: slis.
DATA: BEGIN OF i_data OCCURS 0,
MATNR LIKE mara-MATNR,
MTART LIKE mara-MTART,
MATKL LIKE mara-MATKL,
ws_row TYPE i,
ws_char(5) TYPE c,
chk,
END OF i_data.
DATA: report_id LIKE sy-repid.
DATA: ws_title TYPE lvc_title VALUE 'An ALV Report'.
DATA: i_layout TYPE slis_layout_alv.
DATA: i_fieldcat TYPE slis_t_fieldcat_alv.
DATA: i_events TYPE slis_t_event.
DATA: i_header TYPE slis_t_listheader.
DATA: i_extab TYPE slis_t_extab.
SELECT MATNR MTART MATKL
INTO TABLE i_data
FROM mara up to 10 rows.
*WHERE qmnum <= '00030000010'.
LOOP AT i_data.
i_data-ws_row = sy-tabix.
i_data-ws_char = 'AAAAA'.
MODIFY i_data.
ENDLOOP.
report_id = sy-repid.
PERFORM f1000_layout_init CHANGING i_layout.
PERFORM f2000_fieldcat_init CHANGING i_fieldcat.
PERFORM f3000_build_header CHANGING i_header.
PERFORM f4000_events_init CHANGING i_events.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = 'X'
I_BUFFER_ACTIVE = ' '
i_callback_program = report_id
*I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_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 = ws_title
I_GRID_SETTINGS =
is_layout = i_layout
it_fieldcat = i_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
i_save = 'U'
IS_VARIANT = sy-repid
it_events = i_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_ADD_FIELDCAT =
IT_HYPERLINK =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = i_data
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 F1000_Layout_Init
&----
FORM f1000_layout_init USING i_layout TYPE slis_layout_alv.
CLEAR i_layout.
i_layout-colwidth_optimize = 'X'.
i_layout-edit = 'X'.
i_layout-zebra = 'X'.
ENDFORM. " F1000_Layout_Init
&----
*& Form f2000_fieldcat_init
&----
FORM f2000_fieldcat_init CHANGING i_fieldcat TYPE slis_t_fieldcat_alv.
DATA: line_fieldcat TYPE slis_fieldcat_alv.
CLEAR line_fieldcat.
line_fieldcat-fieldname = 'MATNR'. " The field name and the table
line_fieldcat-tabname = 'I_DATA'. " name are the two minimum req.
line_fieldcat-key = 'X'. " Specifies the column as a key (Blue)
line_fieldcat-seltext_m = 'Notification No.'. " Column Header
APPEND line_fieldcat TO i_fieldcat.
CLEAR line_fieldcat.
line_fieldcat-fieldname = 'MTART'.
line_fieldcat-ref_tabname = 'I_DATA'.
line_fieldcat-hotspot = 'X'. " Shows the field as a hotspot.
line_fieldcat-seltext_m = 'Notif Type'.
APPEND line_fieldcat TO i_fieldcat.
CLEAR line_fieldcat.
line_fieldcat-fieldname = 'MATKL'.
line_fieldcat-tabname = 'I_DATA'.
line_fieldcat-seltext_m = 'Description'.
APPEND line_fieldcat TO i_fieldcat.
CLEAR line_fieldcat.
line_fieldcat-fieldname = 'WS_ROW'.
line_fieldcat-tabname = 'I_DATA'.
line_fieldcat-seltext_m = 'Row Number'.
APPEND line_fieldcat TO i_fieldcat.
CLEAR line_fieldcat.
line_fieldcat-fieldname = 'WS_CHAR'.
line_fieldcat-tabname = 'I_DATA'.
line_fieldcat-seltext_l = 'Test Character Field'.
line_fieldcat-datatype = 'CHAR'.
line_fieldcat-outputlen = '15'. " You can specify the width of a
APPEND line_fieldcat TO i_fieldcat. " column.
CLEAR line_fieldcat.
line_fieldcat-fieldname = 'CHK'.
line_fieldcat-tabname = 'I_DATA'.
line_fieldcat-seltext_l = 'Checkbox'.
line_fieldcat-checkbox = 'X'. " Display this field as a checkbox
line_fieldcat-edit = 'X'. " This option ensures that you can
" edit the checkbox. Else it will
" be protected.
APPEND line_fieldcat TO i_fieldcat.
ENDFORM. " f2000_fieldcat_init
&----
*& Form f3000_build_header
&----
FORM f3000_build_header USING i_header TYPE slis_t_listheader.
DATA: gs_line TYPE slis_listheader.
CLEAR gs_line.
gs_line-typ = 'H'.
gs_line-info = 'This is line of type HEADER'.
APPEND gs_line TO i_header.
CLEAR gs_line.
gs_line-typ = 'S'.
gs_line-key = 'STATUS 1'.
gs_line-info = 'This is line of type STATUS'.
APPEND gs_line TO i_header.
gs_line-key = 'STATUS 2'.
gs_line-info = 'This is also line of type STATUS'.
APPEND gs_line TO i_header.
CLEAR gs_line.
gs_line-typ = 'A'.
gs_line-info = 'This is line of type ACTION'.
APPEND gs_line TO i_header.
ENDFORM. " f3000_build_header
&----
*& Form f4000_events_init
&----
FORM f4000_events_init CHANGING i_events TYPE slis_t_event.
DATA: line_event TYPE slis_alv_event.
CLEAR line_event.
line_event-name = 'TOP_OF_PAGE'.
line_event-form = 'F4100_TOP_OF_PAGE'.
APPEND line_event TO i_events.
CLEAR line_event.
line_event-name = 'PF_STATUS_SET'.
line_event-form = 'F4200_PF_STATUS_SET'.
APPEND line_event TO i_events.
ENDFORM. " f3000_events_init
----
FORM F4100_TOP_OF_PAGE *
----
FORM f4100_top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = i_header.
ENDFORM. "f4100_top_of_page
----
FORM F4200_PF_STATUS_SET *
----
FORM f4200_pf_status_set USING i_extab TYPE slis_t_extab.
REFRESH i_extab.
PERFORM f4210_exclude_fcodes CHANGING i_extab.
SET PF-STATUS 'STANDARD' OF PROGRAM 'SAPLSALV'." EXCLUDING i_extab.
ENDFORM. "f4200_pf_status_set
&----
*& Form f4210_exclude_fcodes
&----
FORM f4210_exclude_fcodes USING i_extab TYPE slis_t_extab.
DATA: ws_fcode TYPE slis_extab.
CLEAR ws_fcode.
ws_fcode = '&EB9'. " Call up Report.
APPEND ws_fcode TO i_extab.
ws_fcode = '&ABC'. " ABC Analysis.
APPEND ws_fcode TO i_extab.
ws_fcode = '&NFO'. " Info Select.
APPEND ws_fcode TO i_extab.
ws_fcode = '&LFO'. " Information.
APPEND ws_fcode TO i_extab.
ENDFORM. " f4210_exclude_fcodes
2008 Apr 03 10:18 AM
Nagendra k,
Instead of doing the way u are doing just try this way.
Define excluding function codes table
Build the table with function codes for which buttons u dont wat.
data:
i_EXTAB TYPE SLIS_T_EXTAB OCCURS 0 WITH HEADER LINE.
Pass that table through FM REUSE_ALV_GRID_DISPLAY.
i_extab-fcode = '&EB9'.
APPEND i_extab.
CLEAR i_extab.
i_extab-fcode = '&ABC'.
APPEND i_extab.
CLEAR i_extab.
i_extab-fcode = '&NFO'.
APPEND i_extab.
CLEAR i_extab.
i_extab-fcode = '&LFO'.
APPEND i_extab.
CLEAR i_extab.
I hope that it helps u .
Regards,
Venkat.O
DATA :l_program TYPE sy-repid.
l_program = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = l_program
* i_callback_top_of_page = 'TOP_OF_PAGE'
i_callback_html_top_of_page = 'TOP_OF_PAGE'
IT_EXCLUDING = i_extab
is_layout = w_layout
it_events = i_events
it_fieldcat = i_fieldcat
TABLES
t_outtab = i_pa0001.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
2008 Apr 01 2:08 PM
Hi,
In Form f4200_pf_status_set, uncomment the EXLUDING clause:
FORM f4200_pf_status_set USING i_extab TYPE slis_t_extab.
REFRESH i_extab.
PERFORM f4210_exclude_fcodes CHANGING i_extab.
SET PF-STATUS 'STANDARD' OF PROGRAM 'SAPLSALV' EXCLUDING i_extab.
ENDFORM. "f4200_pf_status_set
OR use the i_extab from f4200_pf_status_set as a parameter for REUSE_ALV_GRID_DISPLAY:
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
IT_EXCLUDING = i_extab
Hope it helps,
Peter Glas
2008 Apr 03 10:18 AM
Nagendra k,
Instead of doing the way u are doing just try this way.
Define excluding function codes table
Build the table with function codes for which buttons u dont wat.
data:
i_EXTAB TYPE SLIS_T_EXTAB OCCURS 0 WITH HEADER LINE.
Pass that table through FM REUSE_ALV_GRID_DISPLAY.
i_extab-fcode = '&EB9'.
APPEND i_extab.
CLEAR i_extab.
i_extab-fcode = '&ABC'.
APPEND i_extab.
CLEAR i_extab.
i_extab-fcode = '&NFO'.
APPEND i_extab.
CLEAR i_extab.
i_extab-fcode = '&LFO'.
APPEND i_extab.
CLEAR i_extab.
I hope that it helps u .
Regards,
Venkat.O
DATA :l_program TYPE sy-repid.
l_program = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = l_program
* i_callback_top_of_page = 'TOP_OF_PAGE'
i_callback_html_top_of_page = 'TOP_OF_PAGE'
IT_EXCLUDING = i_extab
is_layout = w_layout
it_events = i_events
it_fieldcat = i_fieldcat
TABLES
t_outtab = i_pa0001.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
2008 Apr 03 10:36 AM
Hi,
U do some modificatios Like This
1. Go to SE41
2. Give Program Name as SAPLKKBL and Status As STANDARD
3.Press The Copy Status Button.
4. Change The Program name give your Program name and Press Copy.
5 Go inside The Status and from Application toolbar delete the button u want.
6.Then save and Activate
After That Go to program
And write
FORM pf_status "#EC *
USING p_extab TYPE slis_t_extab.
SET PF-STATUS 'STANDARD' EXCLUDING p_extab.
ENDFORM.
And In FM 'REUSE_ALV_GRID_DISPLAY'
pass
i_callback_pf_status_set = 'PF_STATUS'
Regards
Sandipan
2008 Apr 03 11:25 AM
Just for reference here's a list of all the icons on the ALV Grid
----
Form exclude_icons
----
FORM exclude_icons.
APPEND '&ETA' TO g_exclude. "Details
APPEND '&OUP' TO g_exclude. "Sort Up
APPEND '&ODN' TO g_exclude. "Sort Down
APPEND '&ILT' TO g_exclude. "Set Filter
APPEND '&UMC' TO g_exclude. "Sum
APPEND '&RNT_PREV' TO g_exclude. "Print preview
APPEND '&VEXCEL' TO g_exclude. "Excel
APPEND '&RNT_PREV' TO g_exclude. "Word processing
APPEND '%PC' TO g_exclude. "Local File
APPEND '%SL' TO g_exclude. "Mail recepient
APPEND '&ABC' TO g_exclude. "ABC Analysis
APPEND '&GRAPH' TO g_exclude. "Graphic
APPEND '&OL0' TO g_exclude. "Change layout
APPEND '&OAD' TO g_exclude. "Select layout
APPEND '&AVE' TO g_exclude. "Save Layout
APPEND '&AVE' TO g_exclude. "Information
ENDFORM.