Application Development 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: 

Getting back to screen 1000

Former Member
0 Kudos

Hi All,

I have a slight problem with trying to get my program to return to the initial selection screen.

What I have is:

A selection screen that once all data is input and executed, a SALV is displayed.

I have created two buttons on the screen one called SIMULATE and the other APPLY.

If APPLY is pressed work is carried out and the screen then reverts to the initial selection screen so more choices can be made (This is perfect)

If SIMULATE is pressed this calls another screen (0100), This displays a subset of data from the first SALV in anohter SALV (This is basically so the user can see what they are about to update.......)

This screen also has two buttons APPLY and SAVE TO FILE.

When the SAVE TO FILE button is pressed, the SALV data is written to a file (This is perfect) and the screen does not change (Again this is fine, incase so the user can APPLY the change from here).

The problem I am having is that when the APPLY button is pressed from this screen, once the processing is done I would like the program to go back to the initial selection screen, the best I can get is back to the screen that has the SIMULATE and APPLY buttons, with the data displayed from the current selection..

I have tried the CALL_SELECTION_SCREEN 1000 and this does appear to work, until you press the back button, instead of the program exiting as it would normally you are take back to the screen with the APPLY and SAVE TO FILE button and the data that you have already 'applied'.......

Any help would be great, if you need more information please ask.

I have been scratching my head on this one for a while

(For those who have helped on my last few questions, yes this is still my first ABAP program)

Thanking you in advance

Ian

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor

Try something like

SELECTIOn-SCREEN
...
CALL SCREEN <first>.

in dynpro  <first> logic
WHEN 'APPLY'.
  ...
  set screen 0. " back to selection-screen
WHEN 'SIMULATE'
  ...
  call screen <second>.
  set screen 0. " back to selection-screen
ENDCASE.

in dynpro <second> logic
WHEN 'SAVE_TO_FILE'.
  ...
WHEN 'APPLY'.
  ...
  set screen 0. " continue after call screen <second>
ENDCASE.

or

SELECTIOn-SCREEN
...
CALL SCREEN <first>.

in dynpro  <first> logic
WHEN 'APPLY'.
  ...
  set screen 0. " back to selection-screen
WHEN 'SIMULATE'
  ...
  leave to screen <second>.
ENDCASE.

in dynpro <second> logic
WHEN 'SAVE_TO_FILE'.
  ...
WHEN 'APPLY'.
  ...
  set screen 0. " back to selection-screen
ENDCASE.

Use the first solution if you want to enable a BACK button on screen <second> else you can use second solution.

Try to think to dynpro as a stack, "screen stack". SET SCREEN or explicit LEAVE TO SCREEN nnn replaces the current screen in stack with nnn if not zero, else removes the topmost element of the stack

Regards,

Raymond

11 REPLIES 11

Former Member
0 Kudos

Hi,

Try LEAVE TO SCREEN '1000'.

Make sure that the screen number with SIMULATE and APPLY buttons is 1000. Else provide the correct screen number.

Regards,

Harish

Former Member
0 Kudos

Hi Ian,

You can use the statement 'Leave to screen 1000'.

Thanking you,

Jerry

SuhaSaha
Advisor
Advisor
0 Kudos

Hello Ian,

Try:

LEAVE TO SCREEN 0.

For those who have helped on my last few questions, yes this is still my first ABAP program

Surprised to know your first ABAP experience is not the ubiquitous "Hello World" program. I hope you enjoy the world of ABAP

Cheers,

Suhas

Former Member
0 Kudos

Hi All,

I tried LEAVE TO SCREEN 1000 and that gave an error saying that screen 1000 was not called with CALL START OF SELECTION (or something like that) and then dumped me out of se80

LEAVE TO SCREEN 0. Is doing what SET SCREEN 0 does, and returns me to the previous screen, which still displays the SALV data, I need to go back one further to the selection screen. I think the problem is the selection and the first SALV are in the same screen if that makes sence.

(The hello world program was done in one of the BC4xx courses, this is my 'real' project )

Cheers

Ian

Former Member
0 Kudos

Give LEAVE TO TRANSACTION Zxxxxx.

Zxxxx - Your report transaction.

Former Member
0 Kudos

LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0.

Use This statement

-With Regards.

Suman

Former Member
0 Kudos

Hi Ian,

Free the objects with free method and then use the statement leave to screen 1000.

Thanking you,

Jerry

Edited by: jerryabap on May 4, 2011 2:21 PM

raymond_giuseppi
Active Contributor

Try something like

SELECTIOn-SCREEN
...
CALL SCREEN <first>.

in dynpro  <first> logic
WHEN 'APPLY'.
  ...
  set screen 0. " back to selection-screen
WHEN 'SIMULATE'
  ...
  call screen <second>.
  set screen 0. " back to selection-screen
ENDCASE.

in dynpro <second> logic
WHEN 'SAVE_TO_FILE'.
  ...
WHEN 'APPLY'.
  ...
  set screen 0. " continue after call screen <second>
ENDCASE.

or

SELECTIOn-SCREEN
...
CALL SCREEN <first>.

in dynpro  <first> logic
WHEN 'APPLY'.
  ...
  set screen 0. " back to selection-screen
WHEN 'SIMULATE'
  ...
  leave to screen <second>.
ENDCASE.

in dynpro <second> logic
WHEN 'SAVE_TO_FILE'.
  ...
WHEN 'APPLY'.
  ...
  set screen 0. " back to selection-screen
ENDCASE.

Use the first solution if you want to enable a BACK button on screen <second> else you can use second solution.

Try to think to dynpro as a stack, "screen stack". SET SCREEN or explicit LEAVE TO SCREEN nnn replaces the current screen in stack with nnn if not zero, else removes the topmost element of the stack

Regards,

Raymond

0 Kudos

Hi Raymond,

That has basically done the job.

I think the real problem is that the first SAVL is not in dynpro as such, it just uses screen 1000, and I can not think how this was created.

This is a part of the contents of the screen 1000.


PROCESS BEFORE OUTPUT.

MODULE %_INIT_PBO.

MODULE %_PBO_REPORT.

MODULE %_PF_STATUS.

MODULE %_S_MATNR.

MODULE %_S_MMSTA.

MODULE %_S_MATKL.

MODULE %_S_MTART.

MODULE %_S_BWTAR.

MODULE %_S_BKLAS.

MODULE %_S_EKGRP.

MODULE %_S_DISPO.

MODULE %_S_D_1.

MODULE %_S_D_3.

MODULE %_END_OF_PBO.

PROCESS AFTER INPUT.

I am sure that I would remember entering that.

If someone could say where is came from that would be great...

The only problem now is that the back option also goes straight back to the selection screen and not to the output of the first SALV, this is not as big a problem and worst case it can stay like this (well until someone requests that the back should indeed display the contents of the first AVL)

Thanks again for everyones ideas.

Ian

0 Kudos

This is a SAP Standard selection screen. The screen 1000 is reserved for SAP Selection screen. To go back to this screen from anywhere your program say from screen 100, you would have to use CALL SELECTION-SCREEN 1000.

This calls the same program but skips any other screen and calls screen 1000 selection screen. Consider all other things carefully. This is just my opinion or one way of doing things. You read the documentation.

0 Kudos

I solved it as follows:

in PAI of the screen:

CASE sy-ucomm.

     WHEN 'DELETE'.

       gv_delete = 'X'.

     WHEN OTHERS.

       CLEAR gv_delete.

   ENDCASE.

   SET SCREEN 0. "continue at calling position in report


in your report:


CALL SCREEN 1100 STARTING AT 10 10.

   IF gv_delete IS INITIAL.

     MESSAGE 'Action canceled by user' TYPE 'I'.

     RETURN.

   ENDIF.


message returns to the original screen and also keeps the user input.


Regards,

Ilijana