2006 Apr 24 7:38 AM
Dear Friends,
I am developing one ALV report in PP moule for calculating Shelf Life. The output is coming properly in ALV.
But my additional requirement is ADD coustomise buttons in ALV Reports.
Please give me an idea how can I insert buttons in my alv report?
Thanks & Regards
Vasu
2006 Apr 24 7:46 AM
2006 Apr 24 7:48 AM
U NEED TO SET ur PF STATUS,
example
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = 'ZFI_REP_ORDERTYPE'
I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS1'
I_CALLBACK_USER_COMMAND = 'ACTION'
IS_LAYOUT = LAYOUT
IT_FIELDCAT = FIELDCAT[]
IT_SORT = SORT[]
IT_EVENTS = events[]
TABLES
T_OUTTAB = T_ITAB.
&----
*& Form set_pf_status1
&----
text
----
-->RT_EXTAB text
----
FORM set_pf_status1 USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'STANDARD'.
ENDFORM. "SET_PF_STATUS1
2006 Apr 24 7:48 AM
Take a look at
BCALV_TEST_FULLSCREEN_EVENTS
BCALV_TEST_GRID_EVENTS
BCALV_TEST_HIERSEQ_LIST_EVENTS
Regards,
Ravi
2006 Apr 24 7:49 AM
HI Vasu,
a sample using OO ALV..
FORM modify_toolbar USING
p_object TYPE REF TO cl_alv_event_toolbar_set.
DATA: wl_toolbar TYPE stb_button.
wl_toolbar-function = 'IROW'.
wl_toolbar-icon = icon_create.
wl_toolbar-text = 'Create Row'.
wl_toolbar-quickinfo = 'Create Row'.
wl_toolbar-butn_type = 0.
wl_toolbar-disabled = space.
INSERT wl_toolbar INTO p_object->mt_toolbar INDEX 1.
wl_toolbar-function = 'DROW'.
wl_toolbar-icon = icon_delete.
wl_toolbar-text = 'Delete Row'.
wl_toolbar-quickinfo = 'Delete Row'.
wl_toolbar-butn_type = 0.
wl_toolbar-disabled = space.
INSERT wl_toolbar INTO p_object->mt_toolbar INDEX 2.
ENDFORM. " MODIFY_TOOLBAR
regards
satesh
2006 Apr 25 10:12 AM
Hi vasu,
consider the code given below.
----
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.
The PF status is an exact copy of the PF status 'STANDARD' of program
SAPLSALV but with command 'CHNG' added to it.
SET PF-STATUS 'ZSOM_STANDARD' EXCLUDING i_extab.
ENDFORM.
&----
*& 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
&----
*& Form f4300_user_command
&----
FORM f4300_user_command USING ucomm LIKE sy-ucomm
selfield TYPE slis_selfield.
CASE ucomm.
WHEN '&IC1'. "Double Click line Item
READ TABLE i_data INDEX selfield-tabindex.
IF i_data-qmnum NE space.
SET PARAMETER ID 'IQM' FIELD i_data-qmnum.
CALL TRANSACTION 'IW52' AND SKIP FIRST SCREEN.
CLEAR ucomm.
ENDIF.
WHEN 'CHNG'. " Change Notification Icon
READ TABLE i_data INDEX selfield-tabindex.
IF i_data-qmnum NE space.
SET PARAMETER ID 'IQM' FIELD i_data-qmnum.
CALL TRANSACTION 'IW52' AND SKIP FIRST SCREEN.
CLEAR ucomm.
ENDIF.
ENDCASE.
CLEAR ucomm.
ENDFORM. " f4300_user_command
EXPLANATION
In this program, first we created a PF status (ZSOM_STANDARD), which was an exact copy of STANDARD of program SAPLSALV through transaction SE41 (Menu Painter). Then we added another button to it,with a new fcode called CHNG. After this this we set this PF status instead of STANADRD.
We initialize a third event USER_COMMAND and associate a form with it. In this form we can capture the function codes and write any functionality under it. If we write functionality for an existing fcode, then this gets precedence over the default functionality that might be associated with it.
In this example, we capture a standard fcode &IC1 that is nothing but double clicking a line of the report. We are capturing the notification number of that line and calling transaction IW52 with it. We are also doing the same when a user clicks on the new Change Notification button.
When the user clicks the Back button in IW52, it comes back to the report.
Please reward for the same.
Message was edited by: Prakhar Saxena
2006 Apr 25 10:20 AM
Hi,
using
call function 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = sy-repid
<b> I_CALLBACK_PF_STATUS_SET = 'STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'</b>
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 STATUS USING P_EXTAB TYPE SLIS_T_EXTAB.
*- Pf status double click and add your own buttons
SET PF-STATUS 'STATUS' excluding p_extab.<<<<<<
ENDFORM. " STATUS
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
"handling of okcodes here...<<<<<<<<<<<
case r_ucomm.
when 'BUTTONCODE'.
"do some thing...
endcase.
ENDFORM.
Regards
vijay
2006 Apr 25 10:39 AM
Hi,
If you are using Object Oriented techniques, you can get a nice document on adding user-defined buttons on ALV from this link.
http://www.esnips.com/doc/2d953590-e8c5-490c-a607-d1ab7cf517d7/ALV.pdf
Regards,
SP.