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 - Help!!!!

Former Member
0 Kudos

People,

I have a very basic question about Search Helps.

In an screen, I have two fields: Criteria and Subcriteria. Each one has a search help defined.

For Criteria field all criteria are displayed.

For SubCriteria SearchHelp, I would like to show only subcriterias related to the Criteria selected on the screen.

We already have this Subcriteria SearchHelp defined in SE11, and it imports a criteria and exports subcriteria.

What I have to put in ABAP code?

Thanks a lot!!!

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Hope following code will help you.

Below porgram will have search help for S_AUFNR field based on S_WERKS value in selection screen.


report ztestsdn_test.

tables: resb.
data: begin of df occurs 2.
        include structure dynpread.
  data: end of df.

ranges: r_werks for resb-werks.
select-options: s_werks for resb-werks,
                s_aufnr for resb-aufnr.

at selection-screen on value-request for s_aufnr-low.

  data: begin of ihelp_proc_ord occurs 0,
        aufnr like resb-aufnr,
        werks  like aufk-werks,
        end of ihelp_proc_ord.
data: l_prog like d020s-prog,
         l_dnum like d020s-dnum.
 move: sy-dynnr to l_dnum,
        sy-repid to l_prog.

  loop at s_werks.
  append s_werks to r_werks.
  endloop.

 call function 'DYNP_VALUES_READ'
       exporting
            dyname     = l_prog
            dynumb     = l_dnum
            request    = 'A'
       tables
            dynpfields = df.

 read table df with key fieldname = s_werks.
 if df-fieldvalue <> space.



  select distinct aufnr werks
  into corresponding fields of table ihelp_proc_ord
  from resb
  where werks = s_werks-low.

  call function 'F4IF_INT_TABLE_VALUE_REQUEST'
    exporting
      retfield    = 'AUFNR'
      dynprofield = 'S_AUFNR'
      dynpprog    = sy-cprog
      dynpnr      = sy-dynnr
      value_org   = 'S'
    tables
      value_tab   = ihelp_proc_ord.
  endif.

8 REPLIES 8

Former Member
0 Kudos

Hi

U should use the event AT SELECTION-SCREEN ON VALUE-REQUEST in order to call the search help and transfer the values to filter the result.

Ih the event u can use the fm F4IF_FIELD_VALUE_REQUEST in order to call the search help

Max

Former Member
0 Kudos

Hello,

If you're in a selection-screen (report) :


PARAMETERS p_carrid TYPE s_carr_id  MATCHCODE OBJECT <SEARCH HELP>.
SELECT-OPTIONS s_carrid FOR sflight-carrid MATCHCODE OBJECT <SEARCH HELP>.

But if you're in a module pool, go to SE51 double click the field and set the search help in the attributes screen.

Regards.

Former Member
0 Kudos

Hi,

Hope following code will help you.

Below porgram will have search help for S_AUFNR field based on S_WERKS value in selection screen.


report ztestsdn_test.

tables: resb.
data: begin of df occurs 2.
        include structure dynpread.
  data: end of df.

ranges: r_werks for resb-werks.
select-options: s_werks for resb-werks,
                s_aufnr for resb-aufnr.

at selection-screen on value-request for s_aufnr-low.

  data: begin of ihelp_proc_ord occurs 0,
        aufnr like resb-aufnr,
        werks  like aufk-werks,
        end of ihelp_proc_ord.
data: l_prog like d020s-prog,
         l_dnum like d020s-dnum.
 move: sy-dynnr to l_dnum,
        sy-repid to l_prog.

  loop at s_werks.
  append s_werks to r_werks.
  endloop.

 call function 'DYNP_VALUES_READ'
       exporting
            dyname     = l_prog
            dynumb     = l_dnum
            request    = 'A'
       tables
            dynpfields = df.

 read table df with key fieldname = s_werks.
 if df-fieldvalue <> space.



  select distinct aufnr werks
  into corresponding fields of table ihelp_proc_ord
  from resb
  where werks = s_werks-low.

  call function 'F4IF_INT_TABLE_VALUE_REQUEST'
    exporting
      retfield    = 'AUFNR'
      dynprofield = 'S_AUFNR'
      dynpprog    = sy-cprog
      dynpnr      = sy-dynnr
      value_org   = 'S'
    tables
      value_tab   = ihelp_proc_ord.
  endif.

0 Kudos

Hi Vikram (and all)!

Thanks for the answers!

Our code is like we don´t have a pre-defined search help for field S_AUFNR.

In my case, I already have a defined search help in SE11 for this field. I just want to pass for it, the value in S_WERKS, so that the search help can work normally. (Without this SELECT in the code). It is possible?

Thanks a lot!!!

0 Kudos

Hello,

It's possible. Just define in the search help an parameter id in the data element of the two fields (SET/GET PARAMETER ID).

Then the values that you selected in the first search help will be automatically transferred to the field with the same parameter id in the second search help.

Regards.

0 Kudos

David, it worked!

Thanks!!!!

Former Member
0 Kudos

hi check this example for the search help..

REPORT ztest.

tables:pa0002 .

parameters:p_pernr like pa0002-pernr .

parameters:p_pernr1 like pa0002-pernr matchcode object PREM .<-----here i used the standard search help

regards,

venkat

Former Member
0 Kudos

Hi,

See that you have defined match id code for first field in selection screen.

Check that match id code for first field is given in the Default value of that field in the search help for second field.

Suppose i have 2 fields

BUKRS and ANLN1 (Asset #)

then selection screen is to be defined as :


SELECT-OPTIONS:    BUKRS     FOR ANLAV-BUKRS MEMORY ID BUK.
SELECT-OPTIONS:    ANLAGE    FOR ANLAV-ANLN1.

Now BUK should be in the default value for BUKRS in the search help.

Hope that helps!

Cheers,

Vikram