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

Clear the selection screen

Former Member
0 Likes
9,842

Hi,

i am created a Z program with 20 fields as selection screen. after execution of the program i am getting the output. if i press F3 (Back) all the selection screen values exist. I want to clear the selection screen values once the output is generated and if i press F3.

Thanks in advance.

Regards,

Bala Subramanyam Reddy K

23 REPLIES 23
Read only

Former Member
0 Likes
6,458

Hi,

Write code to clear your selections fields in the event at selection-screen output.

Sample code


At selection-screen output.
clear : p_matnr,
           s_ebeln.

At selection-screen output event is similar to the PBO in module pool programming. It will be called always before the selection screen is called. So when you click on the back button, this event is called and and all you selection fields are cleared.

Hope this helps.

Regards,

Sachin

Read only

Former Member
0 Likes
6,458

Hi,

In the Event INITIALIZATION....clear all the selection screen variables....

Regards,

Vimal.

Read only

0 Likes
6,458

Hi

you have to clear the parameters and select options in the event

AT SELECTION-SCREEN OUTPUT,

Please see the sample code below.

REPORT z709_test.

*

PARAMETERS: name(10) type c ,

add(20) type C .

INITIALIZATION .

AT SELECTION-SCREEN output.

clear : name ,add.

START-OF-SELECTION.

write: name, add.

.

Hope it will help.

Thanks,

Deepanker Dwivedi

Read only

0 Likes
6,458

hi all,

thanks for your response.

but, already some validations are going in AT SELECTION-SCREEN OUTPUT.

whenever i press enter all the values are cleared. with out exectuing...

so my problem is.... .once the output is generated then if i press F3 then only values should be clear.

thanks

balu

Read only

0 Likes
6,458

Hello,

Initilization event executes only once where program is executed.

AT SELECTION-SCREEN output is the correct event to clear all the values.

Thanks,

Anand.

Read only

0 Likes
6,458

Hello Redy,

Check the sy-ucomm value when ur pressing BACK button of the list. Now clear all the selection-screen parameters and select-options in AT SELECTION_SCREEN OUTPUT EVENT only if sy-ucomm matches the sy-ucomm of F3. else go ahead with your validations.

Regards,

Shafivullah Mohammad

Read only

0 Likes
6,458

>

> Hello,

> Initilization event executes only once where program is executed.

> AT SELECTION-SCREEN output is the correct event to clear all the values.

quote}

@Anand:

please write your code in at selection screen output and press enter and then see the output . and what is link of initialization with at-selection-screen output?

@reddy:

i have tried this and telling you the solution. go with it and let me know what problem you are facing

by the way what is your next screen of the selection screen? are you calling a screen or are you using some FM only to display ALV or what?

Read only

Former Member
0 Likes
6,458

Hi,

Clear all the fields in AT SELECTION-SCREEN OUTPUT event.

But you need to set a flag variable during this process and clear the fields

like

at selection-screen output.

if sy-ucomm = 'ONLI'.

clear fields

endif.

Regards

Sarves

Read only

Former Member
0 Likes
6,458

Hi,

Write your code in the AT SELECTION-SCREEN OUTPUT. event. Clear the selection screen variables in this event.

Read only

knitinkumarsethy
Explorer
0 Likes
6,458

HI,

You could clear all your fields in AT SELECTION-SCREEN OUTPUT event.

regards,

Nitin

Read only

0 Likes
6,458

Do not do it it at selection screen output.

Because: lets say u fill the values and press enter . first at-selection screen will be triggered and then at selection-screen output will be triggered which will clear the fields.

the better method is.

lets say you are getting ALV output in the next scrren. so u must have called a FM to show the ALV. after the FM call. u clear the selection screen variables.

like

call function 'reuse_alv_grid_display'.
............
.......
.........
...................

" and now call a perform for clear_all.
perform sub_clear_all.
.


form sub_clear_all.
clear: p_abc, p_def, s_abc,s_def. .....
endform.

so when you press back the FM will exit and the next perform for clear all will be called and it will clear all the screen elements.

Read only

Former Member
0 Likes
6,458

Hi

Try this,,,

set a flag after execute and thn check it with back.

Case sy-ucomm.

when execute.

flag = 'X'.

when back.

if flag = 'X'.

clear variables.

clear flag.

endif.

endcase.

you can also write the same code in AT SELECTION-SCREEN OUTPUT

if flag = 'X'.

clear variables.

clear flag.

endif.

this should wrk,

Hope this helps.

Read only

Former Member
0 Likes
6,458

HI all,

i am trying all the solutionss.. but nothing is working.

so, please test from your end and give the solution.

enter the values and press enter and execute and press F3. if it is working for you then give the solutions.

thanks for all

Read only

Former Member
0 Likes
6,458

Hi,

use a flag for this purpose. set the flag at END-OF-SELECTION. and in the event AT SELECTION-SCREEN OUTPUT clear the screen element if the flag is set.

thanks,

Renjith.

Edited by: Renjith Munnilath on Jul 20, 2009 1:50 PM

Read only

Former Member
0 Likes
6,458

PARAMETERS : P_MATNR TYPE MATNR.

AT SELECTION-SCREEN OUTPUT.

CLEAR : P_MATNR.

START-OF-SELECTION.

WRITE : P_MATNR.

try with this program and give me solution if it is working for anybody.

enter the material value and press enter and press execute and press F3. here the value should be clear in the selection screen when i press F3.

Read only

0 Likes
6,458

Hi ..

Put these line of code at the end of your report

FIELD-SYMBOLS : <fs>  .  
ASSIGN ('(RSDBRUNT)MEMKEY-INT_MODE') TO <fs> .  
IF sy-subrc = 0 .
    <FS> = '01' .
ENDIF.

remember these should be the last line to be executed in report . for example if you have ALV report the put this after the FM call..

PARAMETERS : p_matnr TYPE matnr.

START-OF-SELECTION.

  WRITE : p_matnr.

  FIELD-SYMBOLS : <fs>  .
  ASSIGN ('(RSDBRUNT)MEMKEY-INT_MODE') TO <fs> .
  IF sy-subrc = 0 .
    <fs> = '01' .
  ENDIF.

Read only

6,458

>

> PARAMETERS : P_MATNR TYPE MATNR.

>

> AT SELECTION-SCREEN OUTPUT.

> CLEAR : P_MATNR.

>

> START-OF-SELECTION.

>

> WRITE : P_MATNR.

>

> try with this program and give me solution if it is working for anybody.

>

> enter the material value and press enter and press execute and press F3. here the value should be clear in the selection screen when i press F3.

this will NOT solve your problem as i am 100% sure that your p_matnr will be cleared before you press execute.

Read only

Former Member
0 Likes
6,458

Hi Bala ,

You must Use Selection-Screen Output Event to clear the Parameters you want to free when you return back to your selection screen.

Apart from this You must also Specify the event End-Of-Selction in your Program.

If this doesnot work ,

Check if you have assigned any Memory ID to your Selction Screen Parameter ,

In that case free the Memory Id ,at the AT SELECTION-SCREEN OUTPUT event.

Another simple solution is to set the Default values for each of the parametres and select options as space.

Regards

Rajesh Kumar.

Read only

kurt_slater3
Explorer
0 Likes
6,458

Assuming you don't want to create a routine to clear your selection screen, here is an alternative solution that will work.

First, make sure you have a transaction code for your report. Next, create a new GUI status and assign a custom function code to the Back button. Now you can catch the command within the AT USER-COMMAND event. Here, you simply issue the command LEAVE TO TRANSACTION <report transaction code>.

Because this command deletes the current internal session from the stack and creates a new one, the current program data including the selection screen input fields will be initialised.

Obviously, this doesn't apply to any selection screen fields you are defaulting (e.g. with DEFAULT or GET/SET parameter Id) but I am assuming you would want to keep any default values, otherwise why would you set them in the first place?

Read only

0 Likes
6,458

it worked for me, thanks

Read only

venkat_o
Active Contributor
0 Likes
6,458

Hi Reddy, Here is the solution.


REPORT ztest_notepad.
DATA:ucomm TYPE sy-ucomm.
PARAMETERS : p_date TYPE datum.
"AT SELECTION-SCREEN OUTPUT
AT SELECTION-SCREEN OUTPUT.
  IMPORT ucomm FROM MEMORY ID 'VENK1'. "Import the Function code stored in the memory id VENK1
  CASE ucomm.
    WHEN 'BACK1'.
      CLEAR p_date.
  ENDCASE.
"START-OF-SELECTION
START-OF-SELECTION.
  SET PF-STATUS 'STATUS'.  "Set your own pf-status STATUS. Give Function codes to BACK, EXIT, CANCEL.
  WRITE p_date.
"AT USER-COMMAND
AT USER-COMMAND.
  CASE sy-ucomm.
    WHEN 'BACK1'.
      ucomm = sy-ucomm.
      EXPORT ucomm TO MEMORY ID 'VENK1'. "Export Function code BACK to memory id VENK1
      LEAVE SCREEN.
  ENDCASE.
<li><font color=red>Note: Do not use BACK function code to Back button and same way to exit, cancel buttons also. Do not use standard function codes to those 3 buttons.</font> I hope that it solves your problem. Thanks Venkat.O

Read only

Former Member
0 Likes
6,458

did u try with clearing variables in initilisation?

Read only

Former Member
0 Likes
6,458

did u try with clearing variables in initilisation?