Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

how to enable the back button and write the code for the same

Former Member
0 Likes
1,405

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 .

4 REPLIES 4
Read only

Former Member
0 Likes
692

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

Read only

Former Member
0 Likes
692

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.

Read only

Former Member
0 Likes
692

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.

Read only

Former Member
0 Likes
692

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.