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

Select option data recovery

Former Member
0 Likes
1,187

Hi,

I have developed a selection screen. There's a button that lauches an action to perform when the selection screen fields are filled. When the user inputs bad data, the program warn the user that the filled entries have an error and clear the screen inputs.

How can I manage to display back the data that was previously filled ? Should I use the INITIALIZATION key word ?

Thanks in advance for your help.

Thibault

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,152

Formal way to pre-populate select-options is like this:


INITIALIZATION.
  S1-sign = 'I'.
  S1-option = 'BT'.
  S1-low = '888'.
  S1-high = '889'.

  APPEND S1. 

* To avoid extended program check complaint, you might want to do APPEND S1 TO S1.

Proper way to catch user errors is to wait until they execute the program. Pushing a button to validate the user entries is not a common practice in SAP. First of all, none of the SAP's standard programs do that. Secondly, there is no guarantee that users push that button. I understand that it is some times necessary to catch the errors before they submit a background job. However, according to my past experience, it causes other problems. I don't remember the details, though.

Formal way to pre-populate select-options is like this:


INITIALIZATION.
  S1-sign = 'I'.
  S1-option = 'BT'.
  S1-low = '888'.
  S1-high = '889'.

  APPEND S1. 

* To avoid extended program check complaint, you might want to do APPEND S1 TO S1.

Proper way to catch user errors is to wait until they execute the program. Pushing a button to validate the user entries is not a common practice in SAP. First of all, none of the SAP's standard programs do that. Secondly, there is no guarantee that users push that button. I understand that it is some times necessary to catch the errors before they submit a background job. However, according to my past experience, it causes other problems. I don't remember the details, though.

9 REPLIES 9
Read only

Former Member
0 Likes
1,152

Hi,

Put your validation code inside AT SELECTION-SCREEN.

Regds,

Senthil

Read only

0 Likes
1,152

Here is a point,

I am at least trying to initialize the select option range value, so that the user does not have to type in a value (I am trying to do that for test purpose only):

selection-screen begin of screen 1 as subscreen.
select-options  S1        for
     VBAP-VGBEL
     modif id  001.
selection-screen end of screen 1 .

INITIALIZATION.

DATA: lv_s1Low TYPE VGBEL,
      lv_s1High TYPE VGBEL.

lv_s1Low = '888'.
lv_s1High = '889'.

MOVE: 'BT' TO  S1,
      lv_s1Low TO S1-LOW,
      lv_s1High TO S1-HIGH.
APPEND S1.

When executing the program, nothing happens, the input fields are still empy !!When this will be working, I will be able to get back the previously typed in values.

Thanks in advance for your help.

Thibault

Read only

0 Likes
1,152

I even tried in the PBO with the screen definition above....

AT SELECTION-SCREEN OUTPUT.

INITIALIZATION.

DATA: lv_s1Low TYPE VGBEL,
      lv_s1High TYPE VGBEL.

lv_s1Low = '888'.
lv_s1High = '889'.

MOVE: 'BT' TO  S1,
      lv_s1Low TO S1-LOW,
      lv_s1High TO S1-HIGH.
APPEND S1.

Read only

0 Likes
1,152

Did you forget your 'I'-include ? IBT888 889

But, why clear the screen inputs? If you validate the data entered in AT SELECTION-SCREEN event (when SSCRFIELDS-UCOMM eq 'PRIN' or 'ONLI' or 'SJOB, meaning user is executing the program), and isse an Error message, they're not going anywhere until they pass validation.

Read only

0 Likes
1,152

I am not sure what you talking about.

Why would I need an include ? The syntax control does not return any error.

I am declaring select option, then initializing them, but the result can't be seen when executing the program....

Read only

0 Likes
1,152

I think I miss explained the initial problem. If nothing is found, it does not go anywhere.

If it finds something to display, and the user wants to get back to make a new search, then I want the filter parameters to be restored. I hope it sounds clearer now...

Read only

0 Likes
1,152

Your loading of the table should be I, BT, 888, 889....

Suggestion: try reading the tables from the selection-options index 1, at the end of processing or during initialization, to put the data values back into the select-options tables header rows.... this might put them back into the fields on the screen, if your using the old select-options statements and not declaring data...type range of ... etc.

Read only

Former Member
0 Likes
1,153

Formal way to pre-populate select-options is like this:


INITIALIZATION.
  S1-sign = 'I'.
  S1-option = 'BT'.
  S1-low = '888'.
  S1-high = '889'.

  APPEND S1. 

* To avoid extended program check complaint, you might want to do APPEND S1 TO S1.

Proper way to catch user errors is to wait until they execute the program. Pushing a button to validate the user entries is not a common practice in SAP. First of all, none of the SAP's standard programs do that. Secondly, there is no guarantee that users push that button. I understand that it is some times necessary to catch the errors before they submit a background job. However, according to my past experience, it causes other problems. I don't remember the details, though.

Read only

0 Likes
1,152

Thank you for this very helpful answer

Thibault