‎2007 May 22 12:45 PM
Hi all ,
I am displaying the alv grid report and on that iam putting a button say 'XYZ' on the application tool bar .
When 'XYZ' .
leave to list-processing .
loop at itab
endloop .
This way Iam displaying the classical report in the second list .
Now what I want is : I want to go back by clicking the back button
so as to go back to alv list
or I want to exit by clicking on the exit button .
Pls do the needful .
regards
santosh .
‎2007 May 22 12:48 PM
Refer this code
In order to add user command functioality to the ALV grid you need to perform the following steps:
1. Update 'REUSE_ALV_GRID_DISPLAY' FM call to include 'USER_COMMAND' FORM
2. Create 'USER_COMMAND' FORM
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE'
I_callback_user_command = 'USER_COMMAND' "see FORM
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
i_save = 'X'
tables
t_outtab = it_ekko
exceptions
program_error = 1
others = 2.
----
FORM USER_COMMAND *
----
--> R_UCOMM *
--> RS_SELFIELD *
----
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
Check function code
CASE r_ucomm.
WHEN '&IC1'.
Check field clicked on within ALVgrid report
IF rs_selfield-fieldname = 'EBELN'.
Read data table, using index of row user clicked on
READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
Set parameter ID for transaction screen field
SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
Sxecute transaction ME23N, and skip initial data entry screen
CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
ENDFORM.
http://www.sapdevelopment.co.uk/reporting/alv/alvgrid.htm
Reward points if this helps.
-Gaurang
‎2007 May 22 12:48 PM
Hi,
Define the BACK button in the PF status and in the USER-COMMAND
code as
if ok_code eq 'BACK'.
EXIT.
or
leave screen.
endif.
‎2007 May 22 12:51 PM
declare PF-STATUS for second list and specify a field button within the PF-STATUS and write code at user-command.... when 'BACK'... leave to list processing. if u want to display the first ALV then u have to call the list processing once again.
‎2007 May 22 12:53 PM
hi,
Define the BACK button in the PF status and in the USER-COMMAND
code as
if ok_code eq 'BACK'.
EXIT.
or
leave to screen 0.
endif.
if helpful reward some points.
with regards,
suresh babu aluri.