10-22-2006 9:28 AM
Hi,
I'm wondering what's the right code to put into cancel or exit button when we're designing a screen.
Until I know, 'back' button gives you to the last screen, 'exit' button leaves the transaction, and 'cancel' button do the same and avoid screen checks such as obligatory fields.
But, how can I implement this behaviour with abap source code?
thanks in advance
10-22-2006 9:45 AM
Hello Javier..
In the program the first thing to do is to create a screen.
CALL SCREEN 100. " Double Click here to create the screen.
Then you will see 2 parts, PBO (proceess before output) and PAI Process after input.
In the PBO you should create the status like this...
Uncomment the module status_0100 and double click to create it.
uncomment SET PF-STATUS 'yourStatus'. (double click)-> here is were you create the buttons actions. Display the sreen until you see the regular buttons (exit,cancel,back) and write 'BACK' for each one.
Save and activte....and go back.
Go to the PAI, and uncomment the MODULE USER_COMMAND_0100 and double click again...
You must do this case:
CASE sy-ucomm.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
Hope this helps...if you need anything else ask.
Gabriel.
10-22-2006 9:45 AM
Hello Javier..
In the program the first thing to do is to create a screen.
CALL SCREEN 100. " Double Click here to create the screen.
Then you will see 2 parts, PBO (proceess before output) and PAI Process after input.
In the PBO you should create the status like this...
Uncomment the module status_0100 and double click to create it.
uncomment SET PF-STATUS 'yourStatus'. (double click)-> here is were you create the buttons actions. Display the sreen until you see the regular buttons (exit,cancel,back) and write 'BACK' for each one.
Save and activte....and go back.
Go to the PAI, and uncomment the MODULE USER_COMMAND_0100 and double click again...
You must do this case:
CASE sy-ucomm.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
Hope this helps...if you need anything else ask.
Gabriel.
10-22-2006 10:28 AM
OK, thanks but I already knew how to create a screen, and I'm not very sure this solution works in the way you say
As far as I know, "leave to screen 0" gives you to previous screen where the user stayed. It's similar to "set screen 0" and then "leave screen". In this case, the first statement stablishes that there isn't next screen and "leave screen" tell the program to leave the screen, but as it doesn't have next screen it gives you to the previous screen.
Looking at the internet, I've found that a possibility for 'canc' button would be "leave program", but unfortunately I can't test this solution until tomorrow.
Anyway thanks for the answer and the interest, tomorrow I'll test the solution you've proposed me.
10-22-2006 11:17 AM
Hi
If you use some validations to raise some error message, you should implement an EXIT module to skipm that validations.
PROCESS PAI.
MODULE EXIT AT EXIT-COMMAND.
MODULE USER_COMMAND.
In EXIT module yuo should manage the command CANC and EXIT, in the USER_COMMAND the BACK.
In the status you have to assign the EXIT-COMMAND option
to the functional code you need they trigger module EXIT.
You're right, the stataments LEAVE TO SCREEN 0 or SET SCREEN 0. lEAVE SCREEN back to the calling point, so it'll leave the program if no screens has called.
But for the screens it's true only if the call is made by statament CALL SCREEN.
The statament CALL opens a new internal mode and the system builds a chain with all internal modes, the statament LEAVE TO SCREEN 0 automatically back to previous node of this chain.
The problem can be the system can manage only a certain number of internal modes, then a dump'll occur.
If your module pool has a large number fo screens, It should be better you always the command LEAVE TO SCREEN <NNNN> to call a new screen. This command doesn't open a new internal mode, so It can't use LEAVE TO SCREEN 0 to back, but It has to indicate the calling screen: LEAVE TO SCREEN <....>.
Max
10-23-2006 11:52 AM