2010 Sep 08 9:14 PM
Hi,
I have a report with parameters, few being input fields, and check boxes. After report is executed when user selects the back button, the selection screen is displayed again but with the old selection values. I want to clear them.
So in the Initialization even I added the code to clear all these parameters;
CLEAR: p_aaa, p_bbb, p_ccc.
I debugged and control passes through this code but still the fields are not cleared and they retain the old input values.
How to clear them ?
thnks
2010 Sep 08 9:22 PM
can you just try
SET HOLD DATA OFF.
or you can try placing your code in at selection-screen output event, make sure this doesnt happen when you hit the execute button, check it with sy-ucomm = ONLI
Hi,
I have a report with parameters, few being input fields, and check boxes. After report is executed when user selects the back button, the selection screen is displayed again but with the old selection values. I want to clear them.
So in the Initialization even I added the code to clear all these parameters;
CLEAR: p_aaa, p_bbb, p_ccc.
I debugged and control passes through this code but still the fields are not cleared and they retain the old input values.
How to clear them ?
thnks
2010 Sep 08 9:22 PM
can you just try
SET HOLD DATA OFF.
or you can try placing your code in at selection-screen output event, make sure this doesnt happen when you hit the execute button, check it with sy-ucomm = ONLI
2010 Sep 08 9:29 PM
Thanks. Where should I place SET HOLD DATA OFF ? I tried before Initialization event, and under that , but did not work !!
And I have already tried clearing the parameters under At selection screen output event. It so happens that after I enter value in one of the fields and press ENTER, the screen is cleared So that way I will never be able to proceed with report execution.
any other ideas ?
2010 Sep 08 9:34 PM
You should try placing it in the begining.
or
Check what is the sy-ucomm value of back button in debugging mode, in the event check if the sy-ucomm = BACK ( for example) & sy-pfkey = f2 .... Only then clear
the values.
2010 Sep 08 9:45 PM
Thanks Keshav, tried but did not help.
It so happens that sy-ucomm is '&F03' but it gets cleared by the time the control comes to AT selection screen output and it is blank !! So my check fails there.
Any other ideas ?
2010 Sep 08 9:56 PM
Or else you can do it like in
at selection-screen event move the selection screen values to new variables and clear the screen inputs.
Later in the program make your logic using the new variables & ranges. This must only happen if sy-ucomm = ONLI. This is not a best approach. But will solve your problem.
at selection-screen.
if sy-ucomm = 'ONLI'.
lf_dat = p_dat.
clear p_dat.
endif.
2010 Sep 08 10:02 PM
Hmm..Before trying this, a simple question, Why does not SAP clear the values when I use CLEAR: p_aaa, p_bbb, p_ccc.
under Initialization ? This event is definetely triggered when I click the back button, so why is not the code effective ?
thnks
2010 Sep 08 10:31 PM
>
> Hmm..Before trying this, a simple question, Why does not SAP clear the values when I use CLEAR: p_aaa, p_bbb, p_ccc.
> under Initialization ? This event is definetely triggered when I click the back button, so why is not the code effective ?
>
> thnks
This blog answers your question
http://www.s[ABAP Geek 4 u2013 The Mystery of SUBMIT Unveiled|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/970] [original link is broken] [original link is broken] [original link is broken];
Check the concluding senteces in the blog
So if you ever wondered, why the heck values, that you have assigned to input fields of the
selection screen during LOAD-OF-PROGRAM or INITIALIZATION, are superseded by other values
u2013 the above program flow tells you why!*
*If you definitely want to fill selection screen fields with your own values, you must do so
during the event AT SELECTION-SCREEN OUTPUT, i.e. during PBO of the
selection screen, of course.-Rajesh
Moderator message - Please do not use code tags to format text Edited by: Rob Burbank on Sep 8, 2010 5:42 PM
Edited by: Rajesh Paruchuru on Sep 9, 2010 3:17 AM
Removed the code tags
Actually, you removed the re-formatting that I did!
Edited by: Rajesh Paruchuru on Sep 9, 2010 3:29 AM
Is the formatting fine now?
2010 Sep 09 5:55 PM
I did what Keshav said and it worked.. Thanks
at selection-screen.
if sy-ucomm = 'ONLI'.
lf_dat = p_dat.
clear p_dat.
endif.
2010 Sep 08 9:26 PM
Use AT SELECTION-SCREEN OUTPUT.
clear all the parameters and select option table.
2010 Sep 08 10:52 PM
Yes - did you even try the solution proposed by abhilasha gupta?
Rob
2010 Sep 08 10:56 PM
>
> Yes - did you even try the solution proposed by abhilasha gupta?
>
> Rob
I believe the OP has already tried the proposed solution and published the results as well
"And I have already tried clearing the parameters under At selection screen output event. It so happens that after I enter value in one of the fields and press ENTER, the screen is cleared So that way I will never be able to proceed with report execution.
"
-Rajesh.
2010 Sep 08 10:59 PM
Yes he did. My mistake.
But isn't this what he wants? To clear the Selection screen so that something has to be entered?
Rob
2010 Sep 08 11:07 PM
>
> Yes he did. My mistake.
>
> But isn't this what he wants? To clear the Selection screen so that something has to be entered?
>
> Rob
IMO, he only wants to clear the selection screen parameters on the click of 'BACK' button
in the list screen. If the OP clears the selection screen variables in AT SELECTION-SCREEN OUTPUT
even, the values assinged to the selection parameters in the INITIALIZATION and with the DEFAULT addition of the PARAMETERS and SELECTION-OPTIONS statements will also be overwritten even when the report is executed for the
first time.
-Rajesh.
2010 Sep 08 11:20 PM
Well, they are over-written after the program executes. If filled in manually, they are still there at START-OF-SELECTION.
AT SELECTION-SCREEN ON EXIT-COMMAND doesn't seem to do the trick either.
Rob
2010 Sep 09 12:05 AM
>
> Well, they are over-written after the program executes. If filled in manually, they are still there at START-OF-SELECTION.
I'm not sure if I have understood your comment the way it was intended to be, could you please elucidate?
-Rajesh.
2010 Sep 08 11:15 PM
PARAMETERS:
p_pernr TYPE pernr_d.
DATA:
first_time TYPE char1 VALUE 'X'.
INITIALIZATION.
p_pernr = '456'.
AT SELECTION-SCREEN OUTPUT.
IMPORT first_time FROM MEMORY ID 'MEMID'.
IF first_time = 'N'.
CLEAR p_pernr.
ENDIF.
START-OF-SELECTION.
first_time = 'N'.
EXPORT first_time TO MEMORY ID 'MEMID'.
WRITE : p_pernr.
This could be a possible solution, not sure if it works in all possible scenarios.
-Rajesh
.
Edited by: Rajesh Paruchuru on Sep 9, 2010 3:47 AM
re-formatting of coge tags
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |