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
1,232

Hi all,

When we execute a program and again come back to the selection screen the values which we input should disappear. That is the select option or parameter should be empty again.

points will be rewarded.

Thanks.

17 REPLIES 17
Read only

Former Member
0 Likes
1,208

CLear the select options and parameters in the Intialization event of the report. This will work like a charm.

Regards,

Ankur Bhandari

Read only

Former Member
0 Likes
1,208

Hi,

Clear the parameters and select options in at selection screen. and exit.

some thing like this..


at selection-screen.

clear p_matnr.
clear s_vbeln[].
if p_matnr is intitial and s_vbeln[] is initial.
exit.
endif.

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,208

Here is one way, it requires you to move the value of the parameter to another field.




report  zrich_0003.

tables sscrfields.


parameters: p_check type c.
data: x_check type c.

at selection-screen.

  if sscrfields-ucomm eq 'ONLI'.
    move p_check to x_check.
    clear p_check.
  endif.

start-of-selection.

  write:/ x_check.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
1,208

Hi Ankur,

I tried it before but it did not work.

Read only

0 Likes
1,208

Try this,

REPORT Z_ABB_1.

SELECTION-SCREEN BEGIN OF BLOCK B1.

PARAMETERS: P_MATNR LIKE MARA-MATNR.

SELECT-OPTIONS: S_DATE FOR SY-DATUM.

SELECTION-SCREEN END OF BLOCK B1.

AT SELECTION-SCREEN.

REFRESH S_DATE[].

clear P_MATNR.

START-OF-SELECTION.

WRITE : P_MATNR ,

S_DATE-LOW,

S_DATE-HIGH.

END-OF-SELECTION.

REFRESH S_DATE[].

clear P_MATNR.

Read only

0 Likes
1,208

How was your code in INITIALIZATION?

Read only

0 Likes
1,208

do this.

AT SELECTION-SCREEN output.

clear so_project[] .

clear p_proejct.

Read only

0 Likes
1,208

All AT SELECTION-SCREEN events will not achieve what is asked here. Remember these AT SELECTION-SCREEN events will trigger even the first time user executes the program and if you are clearing out the parameters in these events, such as in AT SELECTION-SCREEN OUTPUT, then there won't be any values carried to the START-OF-SELECTION.

AT SELECTION-SCREEN OUTPUT is triggered every time the selection screen has to be shown. So if the user enters some values and presses 'ENTER' key, even then the values will be cleared. But if the user enters the values and immediately executes, then this will work. But that is asking too much from the user and it is too difficult to control.

Srinivas

Read only

0 Likes
1,208

Hi ,

Thanks Srinivas for the information.

I don't know about this.

One possible solution to this can be having a flag in the report i.e.

When the report is executed the flag is set and check the status of the flag in At-selection output and clear the select options and parameters depending upon the value of flag.

i.e.

AT SELECTION-SCREEN output.

IF flag_execute = 1.

clear so_project[] .

clear p_project[] .

flag_execute = 0.

endif.

Read only

0 Likes
1,208

Anyone run thru my example above. I thought that it works pretty good. It does exactly what the original poster is asking for.

Regards,

Rich Heilman

Read only

0 Likes
1,208

Yours should work Rich, except for the burden of redundant data declarations. For every field on the selection screen we have to declare an equivalent variable or range and do all the moves. But if this is a feature that has to be there no matter what, then I guess your approach seems to be the most plausible one at this point. Anyone tried using FREE MEMORY at the end of list output in the END-OF-SELECTION and see if this erases the values in the memory?

Srinivas

Read only

0 Likes
1,208

Richs example works fine, Rich but this one doesnt have any select options. You mind modifying the same.

Read only

0 Likes
1,208

Srinvas, you are without a doubt, an ABAP genius. Yes it works. Awesome. Good work.



report  zrich_0003.

parameters: p_check type c.
select-options: s_datum for sy-datum.


start-of-selection.

  write:/ p_check.
  write:/ s_datum-low.

<b> 
end-of-selection.

 free memory.</b>

Regards,

Rich Heilman

Read only

0 Likes
1,208

Hi Asit,

The flag setting doesnt work. cos when the program execution returns it resets the all the flags. So need to go with Rich's example.

Regards,

Ankur Bhandari

Read only

0 Likes
1,208

To extend Rich's example to select-options you have to use ranges.

ranges: r_matnr for mara-matnr.

at selection-screen.

if sscrfields-ucomm = 'ONLI'.

r_matnr[] = s_matnr[].<-- select-option on the screen

clear: s_matnr, s_matnr[].

endif.

Read only

0 Likes
1,208

Thanks Rich for trying it out. I am not in front of the system so I was not sure. Never used it for this purpose.

So FREE MEMORY does the trick!!!

Srinivas

Read only

0 Likes
1,208

All points to Srinivas your solution of freeing memory works. Thanks .

Regards,

Ankur Bhandari