01-11-2012 2:07 PM
Hi All,
In my program i have given the input in selection screen , Its process something and a msg was displayed , and user confirm it to continue , the program take us back to the selection screen - in this case i have to clear all the values from the selection parameters.
I tried lot , but i didn't get this result.
I know this is the standard functionality , But anything is there to clear the selection parameters.
Regards,
S.C.K
01-11-2012 2:19 PM
HI friend,
You can clear the selection parameters after displaying the message.
For example you have created a parameter p1.
Just give the statement clear p1.
Also it should be mentioned at AT SELECTION SCREEN OUTPUT or AT INITIALIZATION.
because AT SELECTION SCREEN OUTPUT is just like PBO it process the selection screen values and again displays the selection screen based on new condition.
So try clearing values there it will work.
If you face any issues please revert back to me i will help you.
Thanks,
Sri Hari.
01-11-2012 2:25 PM
Hi Hari,
Already i have tried , But its not correct, reason after enter the values in input then you press ENTER key automatically value will clear without process the code.
01-11-2012 2:55 PM
Hi Chandra,
Can you please little bit clear , How exactly you are calling the user interaction popup and what you are expecting later.
Typically , initialization event to clear the initialize values.
if you want to update selection screen values you may try using the function module
CALL FUNCTION 'DYNP_VALUES_UPDATE'
EXPORTING
DYNAME = V_SY_CPROG
DYNUMB = V_SY_DYNNR
TABLES
DYNPFIELDS = I_DYNFIELDS.
Hope it helps you.
01-11-2012 3:06 PM
write the validation in AT SELECTION SCREEN. .
display a warming message. then clear all the values
PARAMETERS p1 TYPE i.
at SELECTION-SCREEN.
if p1 > 10.
MESSAGE 'Warning' type 'W'.
clear p1.
endif.
START-OF-selection.
write p1.
01-11-2012 3:07 PM
Hi ,
I have written the message 'xxxx' type 'I' with in the start-of-selection.Before the message comes i do some validation.
Message will display then we press the continue means its go to the selection input screen , here i want to clear all the parameters.
01-11-2012 3:09 PM
01-11-2012 3:15 PM
You can do leave to tramsaction simplest way or call transaction
Nabheet
01-11-2012 3:16 PM
Hi Chandra,
As Soumya said..you need to do your validation in AT SELECTION SCREEN event not in Start-of-Selection.
after that when user enters data, you can process that data in START-OF-SELECTION.
Regards,
Harsh Bansal
01-11-2012 3:20 PM
Hi Harish,
I didn't do the validation for seletion screen. After my code process in the start-of-selection thier i have to raise the Information Message.
01-11-2012 3:29 PM
why are you doing validations in start of selection? do it in at slection-screen.
01-11-2012 3:37 PM
Hi Soumya,
Thats not validation , In my case i am checking some conditions in multiple table and record is not found then i display the message.
01-11-2012 3:49 PM
yo may get better answers. wait for that..for time being use this 😛
DATA: gv_p1 TYPE i.
PARAMETERS p1 TYPE i.
AT SELECTION-SCREEN.
gv_p1 = p1.
CLEAR p1.
START-OF-SELECTION.
IF gv_p1 > 10.
MESSAGE 'Warning' TYPE 'I' DISPLAY LIKE 'W'.
EXIT.
ENDIF.
WRITE gv_p1.
01-11-2012 4:36 PM
One more thing you can do is after your message has been displayed .
Just call your report using
SUBMIT your_report VIA SELECTION SCREEN
.
And don't use AND RETURN.
01-11-2012 5:49 PM
Hi,
Already i used SUBMIT statement. Its coming cleared Input screen. This i am expecting correct. But from that screen i entered BACK button its coming to the previous same screen with the values.How i rectify from this.
Regards,
S.C.K
01-11-2012 6:03 PM
Hi,
>
> Already i used SUBMIT statement. Its coming cleared Input screen. This i am expecting correct. But from that screen i entered BACK button its coming to the previous same screen with the values.How i rectify from this.
>
> Regards,
> S.C.K
This is the expected behaviour if you are using the SUBMIT statement with the 'AND RETURN' addition, just remove the 'AND RETURN' addition as already suggested by someone....
-Rajesh.
01-11-2012 11:06 PM
Hi for using SUBMIT statement don't use AND RETURN statement.
I also mentioned this in my previous reply also.
01-12-2012 4:28 AM
Hi friend,
Make a sy-ucomm check. And then do the process.
Or else after message set and flag variable and check that variable for clearing the values.
I think you can handle this in these ways.
Thanks,
Sri Hari
01-11-2012 4:10 PM
Hi All,
>
> In my program i have given the input in selection screen , Its process something and a msg was displayed , and user confirm it to continue , the program take us back to the selection screen - in this case i have to clear all the values from the selection parameters.
>
> I tried lot , but i didn't get this result.
> I know this is the standard functionality , But anything is there to clear the selection parameters.
>
>
>
> Regards,
> S.C.K
There are a couple ways to achieve this, one is by leaving the transaction all together as someone has already suggested, this can be done either via LEAVE TO TRANSACTION <tcode> or SUBMIT <program name> VIA SELECTION-SCREEN, using this technique you won't be able to clear any 'DEFAULT' values set for the selection screen fields, the second is by using IMPORT/EXPORT techniques, EXPORT a flag variable in START OF SELECTION and IMPORT the same in AT SELECTION SCREEN OUTPUT and clear all the selections screen fields...
-Rajesh.
01-11-2012 4:43 PM
Welcome to SDN.
You can clear selection screen values, just before writing the Message statement in start-of-selection event.
Clear P_par1.
Message XXXXXX.
01-11-2012 4:49 PM
01-11-2012 5:51 PM
Hi Santhoshi,
Thats also not coming correctly.Already i used this one.
01-11-2012 5:56 PM
Chandra,
you tried the one which i shown as example to you.??
by the way leave to transaction works fine.
lets say
report name is ZREPORT and tcode for this is ZTCODE.
now after the message statement write:
LEAVE TO TRANSACTION 'ZTCODE'
01-11-2012 6:04 PM
01-11-2012 6:06 PM
then use the code which i wrote... working as gold...
that is.. pass the parameters to global variables in the at-selection screen event and clear the parameters there itself.
and in the code, use the global variables..
01-11-2012 6:11 PM
Try this
At selection-screen output
If lc_flag eq x
Clear all parameters.
Clear flag also.
Endif..
Set this flag in start of selection
I hope its clear now
Nabheet
01-11-2012 6:15 PM
01-11-2012 11:30 PM
01-12-2012 2:23 AM
01-12-2012 8:37 AM
You were right Soumya...My Bad..
I was not infront of the system when replied the aswer with an assumption and completly forgot the values are exported to ABAP Memory and are imported back when selection screen event is triggered.
However following solution would work.
DATA: fl_flag TYPE c.
PARAMETERS p1 TYPE i.
AT SELECTION-SCREEN OUTPUT.
IF fl_flag = 'X.
CLEAR p1.
ENDIF.
START-OF-SELECTION.
IF p1 > 10.
MOVE 'X' to fl_flag
MESSAGE 'Warning' TYPE 'I' DISPLAY LIKE 'W'.
EXIT.
ENDIF.
WRITE p1.
01-12-2012 8:48 AM
@santhoshi,
try again.. i just copy pasted ur code. .and executed.. nothing happens
01-12-2012 9:15 AM
Try this:)
DATA: fl_flag TYPE c.
PARAMETERS p1 TYPE i.
AT SELECTION-SCREEN OUTPUT.
import fl_flag to fl_flag from memory id 'TEST'.
IF fl_flag = 'X'.
CLEAR p1.
ENDIF.
START-OF-SELECTION.
IF p1 > 10.
MOVE 'X' to fl_flag.
export fl_flag from fl_flag to memory id 'TEST'.
MESSAGE 'Warning' TYPE 'I' DISPLAY LIKE 'W'.
return.
ENDIF.
WRITE p1.
Nabheet
01-12-2012 9:42 AM
Nabheet your logic will clear the parameter even when user presses enter (as you are not clearing the MEMORY ID before IMPORT). The requirement is to let the clearing happen only on execute after showing the warning message
The below should work...
DATA: lv_clear_flag TYPE c.
PARAMETERS p1 TYPE i.
AT SELECTION-SCREEN OUTPUT.
CLEAR lv_clear_flag.
IMPORT lv_clear_flag FROM MEMORY ID 'LV_CLEAR_FLAG'.
DELETE FROM MEMORY ID 'LV_CLEAR_FLAG'.
IF lv_clear_flag = 'X'.
CLEAR p1.
ENDIF.
START-OF-SELECTION.
IF p1 > 10.
MOVE 'X' TO lv_clear_flag.
EXPORT lv_clear_flag TO MEMORY ID 'LV_CLEAR_FLAG'.
MESSAGE 'Warning' TYPE 'I' DISPLAY LIKE 'W'.
EXIT.
ELSE.
CLEAR lv_clear_flag.
ENDIF.
01-12-2012 9:51 AM
01-12-2012 3:09 PM
Having a clear statement in At selection screen output should clear the fields in selection screen.
Flag was the concept which i incorporated for additional check. I did not try with flag variable, but without flag variable it works fine. would update you once i try with flag variable.
It was an additional check which i incorporated assuming, if report has to be displayed and back button is pressed then they may want to see the original values given on selection screen.
If fl_flag is not updated in PBO of selection screen, then as suggested by Vishnu we can export and import the updated value.
Anyways would give a try once again on updating fl_flag variable without export and import statements.
01-11-2012 5:06 PM
Hi Chandra,
Well try doing something out of box..Instead of displaying normal information message, use FM -
POPUP_TO_CONFIRM
In it you can display your required message. User needs to press OK.
Then after FM executes, you can code that..
IF answer EQ 1.
CLEAR: p_field1, p_field2.
Try this once.
Regards,
Harsh Bansal
01-11-2012 7:24 PM
Hi All,
In my program i have given the input in selection screen , Its process something and a msg was displayed , and user confirm it to continue , the program take us back to the selection screen - in this case i have to clear all the values from the selection parameters.
I tried lot , but i didn't get this result.
I know this is the standard functionality , But anything is there to clear the selection parameters.
Regards,
S.C.K
I didn't go through the long list of replies nor I don't know if you gave it a thought, but you can try this,
create a [system variant|http://help.sap.com/saphelp_nw04/helpdata/en/c0/980389e58611d194cc00a0c94260a5/content.htm] (variant name starts with CUS& eg: CUS&BLANK) with the entire selection screen fields blanks and use the following function module to call that variant after msg is displayed.
CALL FUNCTION 'RS_SUPPORT_SELECTIONS'
EXPORTING
report = sy-repid
variant = 'CUS&BLANK'
EXCEPTIONS
variant_not_existent = 01
variant_obsolete = 02.
You can hide the variant by checking the box "Only display in catalog".
01-12-2012 5:47 AM
Hi,
Try this:
parameters : p_werks type werks_d.
AT SELECTION-SCREEN.
*/.. Validate plant.
SELECT SINGLE werks
INTO lv_werks
FROM t001w
WHERE werks EQ p_werks.
IF sy-subrc NE 0.
CLEAR : p_werks.
SET CURSOR FIELD 'P_WERKS'.
*/.. Error stating invalid plant
MESSAGE 'Please enter a valid Plant.'
TYPE 'E'.
ENDIF.
This will help you.