Application Development 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: 

Problem with the selection screen

Former Member
0 Kudos

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

37 REPLIES 37

Former Member
0 Kudos

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.

0 Kudos

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.

0 Kudos

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.

0 Kudos

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.

0 Kudos

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.

0 Kudos

check the above message... by the way.. welcome to SDN

0 Kudos

You can do leave to tramsaction simplest way or call transaction

Nabheet

0 Kudos

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

0 Kudos

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.

0 Kudos

why are you doing validations in start of selection? do it in at slection-screen.

0 Kudos

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.

0 Kudos

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.

0 Kudos

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.

0 Kudos

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

0 Kudos

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.

0 Kudos

Hi for using SUBMIT statement don't use AND RETURN statement.

I also mentioned this in my previous reply also.

0 Kudos

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

rajesh_paruchuru
Active Participant
0 Kudos

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.

Former Member
0 Kudos

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.

0 Kudos

@santhoshi,

try once

0 Kudos

Hi Santhoshi,

Thats also not coming correctly.Already i used this one.

0 Kudos

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'

0 Kudos

Hi Soumya,

Sorry in my case TCODE is not available.

0 Kudos

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..

0 Kudos

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

0 Kudos

> I hope its clear now

> Nabheet

nabheet, it wont..

0 Kudos

Why it wont:):)

Nabheet

0 Kudos

Why it wont:):)

>

> Nabheet

just try.. i tried ..

0 Kudos

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.

0 Kudos

@santhoshi,

try again.. i just copy pasted ur code. .and executed.. nothing happens

0 Kudos

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

0 Kudos

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.

0 Kudos

Correct Vishnu idea was to just show the way:):) no probs

Nabheet

0 Kudos

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.

Harsh_Bansal
Contributor
0 Kudos

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

sjeevan
Active Contributor
0 Kudos

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".

former_member634686
Discoverer
0 Kudos

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.