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

Ho to back on selection screen using BACK button

Former Member
0 Likes
9,524

Salute.

I have a program which contains 3 screens:

1st -- selection screen.

2nd -- my screen, I called it 1002, When I press F8 button on I get on it. I am using cl_gui_alv_grid there with my own buttons. So when I press MY OWN the save button I get the 3d screen

3d -- my own screen with some labels (screen name 1001).

So when i press BACK button on the third screen I want to back on selection screen and skip second screen, but I can't, I think the problem is in the cl_gui_alv_grid because I use custom grid handler:

METHOD handle_user_command.

DATA :

ls_selected TYPE lvc_s_roid,

lt_selected TYPE lvc_t_roid.

CASE e_ucomm.

WHEN 'QSAVE'.

PERFORM save_data.

CALL SCREEN 1001.

WHEN OTHERS.

ENDCASE.

ENDMETHOD. "handle_user_command

Thank You.

Edited by: kernel.panic on Nov 24, 2009 6:31 AM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
5,791

Hi,

Did you program for the BACK button on the selection screen?

You can find the PBO and PAI for the selection screen.

Code for your button there.

19 REPLIES 19
Read only

Former Member
0 Likes
5,791

Save Our Environment. Save Yourself.

Hi Kernel,

Try writing code for BACK also, as calling the first screen directly, as you wrote the code for QSAVE.

- I'm not an environmentalist. I'm an Earth warrior.

Read only

Former Member
0 Likes
5,791

I tried the next:

SET SCREEN 0.

LEAVE SCREEN.

doesn't work

Read only

0 Likes
5,791

Save Our Environment. Save Yourself.

Hi Kernel,

Try giving

LEAVE TO SCREEN xxxx.

- I'm not an environmentalist. I'm an Earth warrior.

Read only

0 Likes
5,791

Hi,

Try this


IF SY-UCOMM EQ 'BACK'.
  CALL SELECTION-SCREEN 1000.
ENDIF.

Read only

Former Member
0 Likes
5,791

Hi Kernal,

To go back to the First Screen (Selection Scree) use

LEAVE TO SCREEN 0. " This makes the Program to go back from where it had started

or Create a Tcode for your program

CASE e_ucomm.
WHEN 'BACK'.
LEAVE TO TRANSACTION 'YOUR TCODE HERE' . " This will take you back to your Selection Screen
WHEN 'QSAVE'.
PERFORM save_data.
CALL SCREEN 1001.
WHEN OTHERS.
ENDCASE.

Cheerz

Ram

Read only

former_member217544
Active Contributor
0 Likes
5,791

Hi Kernel,

try this:

When 'BACK'.

CALL SELECTION-SCREEN <dynnr- ur selection-screen number>.

Regards,

Swarna Munukoti

Read only

Former Member
0 Likes
5,791

Thank you for your answers, but

LEAVE TO TRANSACTION 'YOUR TCODE HERE' works but selection screen values not retrieved.

CALL SELECTION-SCREEN 1000. works too, but when I get on the selection screen and press there BACK button it will returned me to the previous screen (1001 in my case)

There is interesting thing: if I use standart SAVE button in the screen 1001 and If I set SET SCREEN 0. in the 1002 screen initialization the BACK button will return me on the selection screen, Exactly what I wanted. But I use custom save button on the grid I think it rewrites the state or something like and operator SET SCREEN 0.doesn't work in that case.

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
5,791

Hi,

Try using:-


SET SCREEN 1000.
LEAVE SCREEN.

Hope this helps you.

Regards,

Tarun

Read only

0 Likes
5,791

Hi,


CALL SELECTION-SCREEN 1000. works too, but when I get on the selection screen and press there BACK button it will returned me to the previous screen (1001 in my case)

For the back button present in the scelection screen write


Leave Program.

Then it will come out of the screens.

Regards,

Swarna Munukoti

Read only

0 Likes
5,791

LEAVE PROGRAM. " exit from the program, it will not return me to the selection screen.

I think similar problem was discussed here:

but I didn't understand how to close the screen.

Read only

0 Likes
5,791

Hi Kernel,

What I mean to say is:

For teh BACK button on 3rd screen write:

CALL SELECTION-SCREEN <dynnr>.

For the BACK button on selection screen write:

LEAVE PROGRAM.

Regards,

Swarna Munukoti.

Edited by: Swarna Munukoti on Nov 24, 2009 8:02 AM

Edited by: Swarna Munukoti on Nov 24, 2009 8:06 AM

Read only

0 Likes
5,791

ok, got it. good workaround

Read only

0 Likes
5,791

BACK button doesn't work on the selection screen if I call selection screen programmatically

Read only

0 Likes
5,791

Hi,

Yes, when you called back button from selection screen, the PAI of thrid screen is getting called. So it is not wokring

Try this one:

Declare a flag globally: fg_selscrn.

Now in third screen PAI:

when 'BACK'.

if fg_selscrn is initial.

fg_selscrn = 'X'.

CALL SELECTION-SCREEN <dynnr> .

else.

clear fg_selscrn.

LEAVE PROGRAM.

endif.

Regards,

Swarna Munukoti.

Read only

Former Member
0 Likes
5,791

Tarun, it occurs an error, Must use CALL SELECTION-SCREEN.

Read only

Former Member
0 Likes
5,792

Hi,

Did you program for the BACK button on the selection screen?

You can find the PBO and PAI for the selection screen.

Code for your button there.

Read only

sreejithmohanm
Product and Topic Expert
Product and Topic Expert
0 Likes
5,791

Before displaying the second screen, you can try using the following statement:

LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0.

By doing this, the control will go back to your selection screen and the you can call the required screen for ALV.

So the sequence will be as follows:

1. Execute the Report

2. Call the screen or Do the Processing

3. Before calling the third screen leave back to list processing and return to screen 0.

4. Call the third screen.

now you press back button the control goes back into the first screen.

Read only

Former Member
0 Likes
5,791

Hi.

Just use

when 'BACK'.

leave to screen 0.

this will work fine.

Read only

0 Likes
5,791

1) To return to the selection screen use this:

LEAVE TO SCREEN 0.

2) To quit the selection screen via the back button:

For the selection screen you have a specific event to handle the quiting of your program.

Use this for exiting the selection screen.

----


AT SELECTION-SCREEN ON EXIT-COMMAND.

----


LEAVE PROGRAM.

The combination of these two did the trick for me.

Best regards,

Tom.