2008 May 30 3:43 PM
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!!!
2008 May 30 4:04 PM
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.
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!!!
2008 May 30 3:53 PM
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
2008 May 30 4:04 PM
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.
2008 May 30 4:04 PM
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.
2008 May 30 5:25 PM
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!!!
2008 May 30 5:43 PM
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.
2008 Jun 06 9:24 PM
2008 May 30 4:40 PM
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
2008 May 30 5:43 PM
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
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |