‎2005 Mar 18 4:33 PM
Hi,
I issue a error message in my report when the user enters a wrong file name in p_file, but when the error message is display the status of my selection screen disappears and I don't have other option but to end my program manually ( /n ) and restart it again.
Is there and way to recall my screen and restart the process (like when you use chain....endchain in dynpros)
thanks in advanced,
Fidel.
‎2005 Mar 18 4:58 PM
Looks like you are issuing this message in the START-OF-SELECTION event. Try AT SELECTION-SCREEN ON P_FILE instead. Validate the filename here and issue the message there. This will allow you to stay in the selection screen.
Srinivas
‎2005 Mar 18 5:29 PM
You can also do the validation in the AT SELECTION-SCREEN event. That will allow the user to change all the fields and not just the p_file field. Before you issue the message, set the cursor:
SET CURSOR FIELD 'P_FILE'.
MESSAGE E001.Make sure that the field name is all caps.
Let us know how it goes.
‎2005 Mar 18 6:45 PM
Thanks guys, but the only way that I can't tell that the user entered a wrong file name is after the open dataset command (since the file could be anywhere and the user is the one that knows where it is) and from there I control what happens. Here is the code:
FORM initialization .
OPEN DATASET p_file FOR INPUT IN BINARY MODE.
IF sy-subrc <> 0. " error when file can't be open.
MESSAGE e005(zmsgfide).
ENDIF.
ENDFORM. " initialization
after that error I can't do nothing.
Regards,
Fidel
‎2005 Mar 18 6:59 PM
‎2005 Mar 18 7:09 PM
Rich....You solved my problem.
Thank you guys for helping me out, specially you Rich.
Regards,
Fidel Peralta.
‎2005 Mar 18 7:09 PM
The initialization event happens before the selection screen is presented so the user has no access to the p_file parameter. Use the AT SELECTION SCREEN event as Rich has described. If the user hits ENTER several times, you will be opening the file over and over again. Instead you can check the value of SY-UCOMM and see if it is 'ONLI' indicating that the user has hit the Execute button.
CORRECTION: I failed to notice that your initialization was a FORM and not the event INITIALIZATION. Sorry for the confusion.
Message was edited by: Charles Folwell
‎2005 Mar 19 5:21 PM