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: 

How to know the previous screen number..?

Former Member
0 Kudos
791

Hi Expert..

Is it possible to know the previous screen number? From which screen this present screen has called ? just similar to u201CLEAVE TO SCREEN 0u201D. I want to know the last screen number.

Could you please suggest how I will able to get that screen number ?

Thanks in advance.

Regards

Satrajit.

1 ACCEPTED SOLUTION

I355602
Product and Topic Expert
Product and Topic Expert
0 Kudos
412

Hi

An alternative is to take a variable of type sy-dynnr.

And when you leave from screen1 to screen2 at any user command, then assign the current screen number to this variable and control moves to the next screen.

Now you can use this variable on the next screen (presently current screen) to access the previous screen number (from which the present screen was called).


DATA : v_prev_screen TYPE sy-dynnr.

At any user command:-


v_prev_screen = sy-dynnr.
CALL SCREEN 8002. " or LEAVE TO SCREEN 8002

Now on the next screen 8002, you can access the variable v_prev_screen to the previous screen number.

Hope this solves your problem.

Thanks & Regards,

Tarun Gambhir

2 REPLIES 2

I355602
Product and Topic Expert
Product and Topic Expert
0 Kudos
413

Hi

An alternative is to take a variable of type sy-dynnr.

And when you leave from screen1 to screen2 at any user command, then assign the current screen number to this variable and control moves to the next screen.

Now you can use this variable on the next screen (presently current screen) to access the previous screen number (from which the present screen was called).


DATA : v_prev_screen TYPE sy-dynnr.

At any user command:-


v_prev_screen = sy-dynnr.
CALL SCREEN 8002. " or LEAVE TO SCREEN 8002

Now on the next screen 8002, you can access the variable v_prev_screen to the previous screen number.

Hope this solves your problem.

Thanks & Regards,

Tarun Gambhir

Former Member
0 Kudos
412

Hi Tarun Gambhir,

Thanks for your opinion to this problem. But here I have to declare a new global variable to access the screen number from the next screen. Without using a global variable, how can I do this ? Please suggest ..

Anyway thanks a lot for your solution.

Regards

Satrajit.