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: 
Read only

Selection Screen

Former Member
0 Likes
566

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.

7 REPLIES 7
Read only

Former Member
0 Likes
538

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

Read only

Former Member
0 Likes
538

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.

Read only

0 Likes
538

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

Read only

0 Likes
538

put the following code inside the AT SELECTION-SCREEN event.



if not p_file is initial.
OPEN DATASET p_file FOR INPUT IN BINARY MODE.
IF sy-subrc <> 0. " error when file can't be open.
MESSAGE e005(zmsgfide).
ENDIF.
endif.

Regards,

Rich Heilman

Message was edited by: Rich Heilman

Read only

0 Likes
538

Rich....You solved my problem.

Thank you guys for helping me out, specially you Rich.

Regards,

Fidel Peralta.

Read only

0 Likes
538

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

Read only

0 Likes
538

No problem Charles.

Thanks for the help.