‎2006 Oct 06 6:36 PM
Hi,
i have created a elementary search help with two fields and both parameters are assigned as export.and i have assigned the search to the parameters as below.
PARAMETER p_nchmc LIKE pa0002-nchmc modif id xyz MATCHCODE OBJECT zecn.
PARAMETER p_vnamc LIKE pa0002-vnamc modif id xyz MATCHCODE OBJECT zecN.
but when i call the F4 help only one value is exported back to the screen.
Is their any problem in the declaration of the parameters ?
Thanks & Regards
Syed
‎2006 Oct 06 11:15 PM
Hello Syed
If your search help is displayed as control then you will see that only one column is marked blue meaning that only this value will be returned.
I assume that the reason that not both fields are returned (like in the SFLIGHT examples) due to missing foreign key relations.
However, you can solve the problem using the following search help exit:
FUNCTION z_f4if_shlp_exit .
*"----------------------------------------------------------------------
*"*"Local Interface:
*" TABLES
*" SHLP_TAB TYPE SHLP_DESCR_TAB_T
*" RECORD_TAB STRUCTURE SEAHLPRES
*" CHANGING
*" VALUE(SHLP) TYPE SHLP_DESCR_T
*" VALUE(CALLCONTROL) LIKE DDSHF4CTRL STRUCTURE DDSHF4CTRL
*"----------------------------------------------------------------------
DATA:
rc LIKE sy-subrc.
CALL FUNCTION 'F4UT_OPTIMIZE_COLWIDTH'
TABLES
shlp_tab = shlp_tab
record_tab = record_tab
CHANGING
shlp = shlp
callcontrol = callcontrol.
IF callcontrol-step <> 'SELECT'.
EXIT.
ENDIF.
*"----------------------------------------------------------------------
* STEP SELONE (Select one of the elementary searchhelps)
*"----------------------------------------------------------------------
* This step is only called for collective searchhelps. It may be used
* to reduce the amount of elementary searchhelps given in SHLP_TAB.
* The compound searchhelp is given in SHLP.
* If you do not change CALLCONTROL-STEP, the next step is the
* dialog, to select one of the elementary searchhelps.
* If you want to skip this dialog, you have to return the selected
* elementary searchhelp in SHLP and to change CALLCONTROL-STEP to
* either to 'PRESEL' or to 'SELECT'.
IF callcontrol-step = 'SELONE'.
* PERFORM SELONE .........
EXIT.
ENDIF.
*"----------------------------------------------------------------------
* STEP PRESEL (Enter selection conditions)
*"----------------------------------------------------------------------
* This step allows you, to influence the selection conditions either
* before they are displayed or in order to skip the dialog completely.
* If you want to skip the dialog, you should change CALLCONTROL-STEP
* to 'SELECT'.
* Normaly only SHLP-SELOPT should be changed in this step.
IF callcontrol-step = 'PRESEL'.
* PERFORM PRESEL ..........
EXIT.
ENDIF.
*"----------------------------------------------------------------------
* STEP SELECT (Select values)
*"----------------------------------------------------------------------
* This step may be used to overtake the data selection completely.
* To skip the standard seletion, you should return 'DISP' as following
* step in CALLCONTROL-STEP.
* Normally RECORD_TAB should be filled after this step.
* Standard function module F4UT_RESULTS_MAP may be very helpfull in this
* step.
IF callcontrol-step = 'SELECT'.
.
DATA:
lt_pa0002 TYPE STANDARD TABLE OF pa0002.
* Either select all data or restricted by conditions
SELECT * FROM pa0002 INTO TABLE lt_pa0002.
* WHERE nchmc = ___
* AND vnamc = ___.
*
* ENDSELECT.
CALL FUNCTION 'F4UT_RESULTS_MAP'
EXPORTING
source_structure = 'PA0002'
apply_restrictions = 'X' " use select parameter
TABLES
shlp_tab = shlp_tab
record_tab = record_tab
source_tab = lt_pa0002
CHANGING
shlp = shlp
callcontrol = callcontrol
EXCEPTIONS
illegal_structure = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
DATA:
ls_interface TYPE ddshiface,
ls_prop TYPE ddshfprop.
* Mark VNAMC again as output parameter
LOOP AT shlp-fieldprop INTO ls_prop
WHERE ( shlpoutput <> 'X').
ls_prop-shlpoutput = 'X'.
MODIFY shlp-fieldprop FROM ls_prop.
ENDLOOP.
* At the selection screen the search help for field NCHMC was pressed.
* Thus, this field will be found in the interface.
* We have to add the other fields.
READ TABLE shlp-interface INTO ls_interface INDEX 1.
IF ( ls_interface-shlpfield = 'NCHMC' ).
ls_interface-valfield = 'P_VNAMC'.
ls_interface-shlpfield = 'VNAMC'.
ELSE.
ls_interface-valfield = 'P_NCHMC'.
ls_interface-shlpfield = 'NCHMC'.
ENDIF.
APPEND ls_interface TO shlp-interface.
* IF rc = 0.
callcontrol-step = 'DISP'.
* ELSE.
* callcontrol-step = 'EXIT'.
* ENDIF.
EXIT. "Don't process STEP DISP additionally in this call.
ENDIF.
*"----------------------------------------------------------------------
* STEP DISP (Display values)
*"----------------------------------------------------------------------
* This step is called, before the selected data is displayed.
* You can e.g. modify or reduce the data in RECORD_TAB
* according to the users authority.
* If you want to get the standard display dialog afterwards, you
* should not change CALLCONTROL-STEP.
* If you want to overtake the dialog on you own, you must return
* the following values in CALLCONTROL-STEP:
* - "RETURN" if one line was selected. The selected line must be
* the only record left in RECORD_TAB. The corresponding fields of
* this line are entered into the screen.
* - "EXIT" if the values request should be aborted
* - "PRESEL" if you want to return to the selection dialog
* Standard function modules F4UT_PARAMETER_VALUE_GET and
* F4UT_PARAMETER_RESULTS_PUT may be very helpfull in this step.
IF callcontrol-step = 'DISP'.
* PERFORM AUTHORITY_CHECK TABLES RECORD_TAB SHLP_TAB
* CHANGING SHLP CALLCONTROL.
EXIT.
ENDIF.
ENDFUNCTION.However, there is a flaw in your coding. You cannot use the same search help for different parameters because if you call the search help for the first name the search help will select for the last name because last name is the first parameter in your search help (or vice versa).
Regards
Uwe
‎2006 Oct 09 9:23 AM
‎2006 Oct 09 9:25 AM
Check the below program,it may help u.
parameters: p_bukrs type t001-bukrs,
p_butxt type t001-butxt,
p_ort01 type t001-ort01,
p_land1 type t001-land1.
data: dynfields type table of dynpread with header line.
data: return type table of ddshretval with header line.
at selection-screen on value-request for p_bukrs.
call function 'F4IF_FIELD_VALUE_REQUEST'
exporting
tabname = 'T001'
fieldname = 'BUKRS'
dynpprog = sy-cprog
dynpnr = sy-dynnr
dynprofield = 'P_BUKRS'
tables
return_tab = return
exceptions
field_not_found = 1
no_help_for_field = 2
inconsistent_help = 3
no_values_found = 4
others = 5.
read table return with key fieldname = 'P_BUKRS'.
Add it back to the dynpro.
dynfields-fieldname = return-retfield.
dynfields-fieldvalue = return-fieldval.
append dynfields.
Get the company code from db and add to dynpro
data: xt001 type t001.
clear xt001.
select single * into xt001
from t001
where bukrs = return-fieldval.
dynfields-fieldname = 'P_BUTXT'.
dynfields-fieldvalue = xt001-butxt.
append dynfields.
dynfields-fieldname = 'P_ORT01'.
dynfields-fieldvalue = xt001-ort01.
append dynfields.
dynfields-fieldname = 'P_LAND1'.
dynfields-fieldvalue = xt001-land1.
append dynfields.
Update the dynpro values.
call function 'DYNP_VALUES_UPDATE'
exporting
dyname = sy-cprog
dynumb = sy-dynnr
tables
dynpfields = dynfields
exceptions
others = 8.
start-of-selection.
Regards
‎2006 Oct 09 9:42 AM
a dictionary search help will only work in tandem if the fields on the table are linked to the searchhelp. You obviously can't change table PA0002 to use your search help but you could create a ztable or structure with the same fields and link the fields in that structure with your search help. Then if your abap selection screen refers to the structure's fields instead of PA0002 it will automatically use the sh you sepcified in the dictionary and pull back more than one field at a time.