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: 

Search Help parameters

former_member193337
Participant
0 Kudos

Hello Experts!

I've created an elementary search help where some of my parameters is a set of dates.

I want the search help to read this parameters as a range. When the date fields are populated the search help shows immediately the "equal" sign.

Do you know if there is a way where I can set the ">="  and "<="  signs for the range without having to code them in an exit?

Thanks in advance!!

Frineé

1 ACCEPTED SOLUTION

former_member193337
Participant
0 Kudos

Hello!

I found the solution

I had to implement a search help exit (I was trying to avoid)

DATA: ls_selopt LIKE LINE OF shlp-selopt

.

IF callcontrol-step = 'PRESEL'. "in this step is where you have to do the change!


     READ TABLE shlp-selopt INTO  ls_selopt WITH KEY shlpfield = 'BEGDA'.

     IF sy-subrc EQ 0.

       ls_selopt-option = 'GE'.

       MODIFY shlp-selopt FROM ls_selopt INDEX sy-tabix TRANSPORTING option.

     ENDIF.

     READ TABLE shlp-selopt INTO  ls_selopt WITH KEY shlpfield = 'ENDDA'.

     IF sy-subrc EQ 0.

       ls_selopt-option = 'LE'.

       MODIFY shlp-selopt FROM ls_selopt INDEX sy-tabix TRANSPORTING option.

     ENDIF.

     EXIT.


   ENDIF.

I could change the = sign of the selection for the <= and >= in the search help.

7 REPLIES 7

guilherme_frisoni
Contributor
0 Kudos

Frinee,

when the = sign appears, you can click on it and it will open the multiple options popup.

Or, you can click on Multiple Option button, between Ok and Cancel buttons on the bottom of screen popup.

Thats the only way to use "ranges" in this search helps.

Regards,

Frisoni

0 Kudos

Thanks for your answer Guilherme!

The requirement is the list to appear immediately with no user action to change this options.

Do you know if there's another way to fulfill this task?

Thanks again!

Kind regards,

Frineé

0 Kudos

Ok, I'm not sure if is a very good solution, but you could try the following:

Create a Search Help Exit to define default values when open your search help.

You could follow this document for this: http://scn.sap.com/community/abap/blog/2015/06/03/definindo-valores-de-par%C3%A2metro-usando-o-searc...

But, instead of define directly in FM code, you call RSEC_POPUP_SELECT_OPTIONS FM (or any other similar) passing your search help name and field to open a popup, and then you get FM result to define default values.

Give a try.

Regards,

Frisoni

0 Kudos

Thanks a lot Guilhereme,

I can't open the link you provided, I guess I don't have authorization

I'll take a look at the FM you suggested!
Thanks again!

Former Member
0 Kudos

Hi Frinee,

You will like this FM 'SELECT_OPTIONS_RESTRICT' to restrice the selection option only can be a range.

INITIALIZATION.

DATA ls_restrict TYPE sscr_restrict.

* Auxiliary objects for filling RESTRICT

   DATA : ls_optlist TYPE sscr_opt_list,

          ls_ass TYPE sscr_ass.

* Restricting the create date selection to only EQ and 'BT'.

   ls_optlist-name = 'OBJECTKEY1'.

   ls_optlist-options-bt = 'X'.

   APPEND ls_optlist TO ls_restrict-opt_list_tab.

   ls_ass-kind = 'S'.

   ls_ass-name = 'S_DATE'.

   ls_ass-sg_main = 'I'.

   ls_ass-sg_addy = space.

   ls_ass-op_main = 'OBJECTKEY1'.

   APPEND ls_ass TO ls_restrict-ass_tab.

   CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'

    EXPORTING

     restriction                  = ls_restrict

    EXCEPTIONS

      TOO_LATE                     = 1

      REPEATED                     = 2

      SELOPT_WITHOUT_OPTIONS       = 3

      SELOPT_WITHOUT_SIGNS         = 4

      INVALID_SIGN                 = 5

      EMPTY_OPTION_LIST            = 6

      INVALID_KIND                 = 7

      REPEATED_KIND_A              = 8

      OTHERS                       = 9

             .

   IF sy-subrc <> 0.

      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

   ENDIF.


regards,

Archer

0 Kudos

Hello Dengyong!

Thanks a lot for your answer.

I'm trying to implement the FM you suggested, I can't make it work.

I changed the ls_optlist-options-bt = 'X' by ls_optlist-options-gt = 'X'.

I'll study it a bit more.

Thanks again!
Frineé

former_member193337
Participant
0 Kudos

Hello!

I found the solution

I had to implement a search help exit (I was trying to avoid)

DATA: ls_selopt LIKE LINE OF shlp-selopt

.

IF callcontrol-step = 'PRESEL'. "in this step is where you have to do the change!


     READ TABLE shlp-selopt INTO  ls_selopt WITH KEY shlpfield = 'BEGDA'.

     IF sy-subrc EQ 0.

       ls_selopt-option = 'GE'.

       MODIFY shlp-selopt FROM ls_selopt INDEX sy-tabix TRANSPORTING option.

     ENDIF.

     READ TABLE shlp-selopt INTO  ls_selopt WITH KEY shlpfield = 'ENDDA'.

     IF sy-subrc EQ 0.

       ls_selopt-option = 'LE'.

       MODIFY shlp-selopt FROM ls_selopt INDEX sy-tabix TRANSPORTING option.

     ENDIF.

     EXIT.


   ENDIF.

I could change the = sign of the selection for the <= and >= in the search help.