‎2011 Feb 11 12:08 PM
Hello,
I've a program 'A' that call with SUBMIT and RETURN to program B.
In program B (it's a report), i need show a message when the user press the key 'BACK' 'END' or 'CANC' and not allowed to return to program A.
The code are in event at user-comand for program B, however it debug don't stop. I don't debugging this buttons, when i press this buttons the program go back to program A
any idea?
Thank you,
Silvia
‎2011 Feb 11 6:29 PM
Use Sumbit instead of submit and return.
in the event at user command.... when 'BACK' check for your condition and stop there....
when you want to go back to your previous program..... use leave to screen 0 or leave to program (Read help on it)
if they dont work as you expected....
Why dont you create a function module/Class and method for Program B and call this from Program A.... You can have screen in function module and do the screen validations.
‎2011 Feb 13 12:48 AM
Hi Silvia,
If you do not want to return to program A then use SUBMIT instead of SUBMIT and RETURN.
If you want to show message if user clicks back, end or cancel button then you can do so provided program B is a Z program. Change the function code of these buttons from E (i.e. Exit) to space (i.e. normal application). Next in the 'AT User Command' event you can handle each buttons and display error message on screen like below:
At User-Command.
Case sy-ucomm (or okcode):
when 'BACK'.
message 'Cannot go Back' type 'E'.
... (handle the same for remaining buttons)
Endcase.
I think if you give error message then the processing will stop at program B and will not return to program A (if you are using SUBMIT and RETURN). You can try this and let us know if this or something else works. It will be beneficial for others too.
Hope that helps!
Regards,
Saba
‎2011 Feb 14 5:58 AM
Hi,
have a look at ABAP keyword help for AT with option USER-COMMAND! You can find there:
The function codes in the following table 2, likewise, do not cause the event AT USER-COMMAND, but are handled by the list processor.
In table 2 e.g. you can find function code BACK.
So you have to change the function code inthe user interface of program B from BACK to another value, if you want to catch it.
Regards,
Klaus
Edited by: Klaus Babl on Feb 14, 2011 6:59 AM
‎2011 Feb 23 4:51 PM