2007 Oct 19 8:05 AM
Hi All,
I am using a search help H_WERKS_MATNR in the selection screen.This shows all the plants in which the material enterd by the user is present.I want to know how to pass this material no to the search help as input parameter.
Thanks,
Rakesh.
Hi All,
I am using a search help H_WERKS_MATNR in the selection screen.This shows all the plants in which the material enterd by the user is present.I want to know how to pass this material no to the search help as input parameter.
Thanks,
Rakesh.
2007 Oct 19 9:03 AM
You have to use a CALLBACK FORM in the call of function F4IF_FIELD_VALUE_REQUEST to filter the saerch help used :
REPORT zrgstst NO STANDARD PAGE HEADING.
TYPE-POOLS shlp.
TABLES marc.
DATA: return_tab TYPE TABLE OF ddshretval WITH HEADER LINE,
l_repid TYPE syrepid,
l_dynnr TYPE sydynnr.
DATA x TYPE RANGE OF marc-matnr.
PARAMETERS: matnr LIKE marc-matnr,
werks LIKE marc-werks.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR werks.
l_repid = sy-repid.
l_dynnr = sy-dynnr.
CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
EXPORTING
tabname = 'MARC'
fieldname = 'WERKS'
searchhelp = 'H_WERKS_MATNR'
dynpprog = l_repid
dynpnr = l_dynnr
dynprofield = 'WERKS'
stepl = 0
callback_program = l_repid
callback_form = 'F4CALLBACK'
TABLES
return_tab = return_tab
EXCEPTIONS
field_not_found = 1
no_help_for_field = 2
inconsistent_help = 3
no_values_found = 4
OTHERS = 5.
START-OF-SELECTION.
*&---------------------------------------------------------------------*
*& Form F4_form
*&---------------------------------------------------------------------*
*----------------------------------------------------------------------*
FORM f4callback
TABLES record_tab STRUCTURE seahlpres
CHANGING shlp TYPE shlp_descr_t
callcontrol LIKE ddshf4ctrl.
* Local data
DATA: aux_struc TYPE ddshselopt,
dynpfields TYPE TABLE OF dynpread WITH HEADER LINE,
w_matnr LIKE marc-matnr.
* Read MATNR from Dynpro
REFRESH dynpfields.
CLEAR dynpfields.
MOVE 'MATNR' TO dynpfields-fieldname.
APPEND dynpfields.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = l_repid
dynumb = l_dynnr
TABLES
dynpfields = dynpfields
EXCEPTIONS
OTHERS = 1.
* MATNR is filled ?
CHECK sy-subrc = 0.
READ TABLE dynpfields INDEX 1.
CHECK sy-subrc = 0.
CHECK NOT dynpfields-fieldvalue IS INITIAL.
* Conversion Exit
CALL FUNCTION 'CONVERSION_EXIT_MATN2_INPUT'
EXPORTING
input = dynpfields-fieldvalue
IMPORTING
output = w_matnr
EXCEPTIONS
OTHERS = 1.
CHECK sy-subrc = 0.
* Append filter
MOVE: 'H_WERKS_MATNR' TO aux_struc-shlpname,
'MATNR' TO aux_struc-shlpfield,
'I' TO aux_struc-sign,
'EQ' TO aux_struc-option,
w_matnr TO aux_struc-low.
APPEND aux_struc TO shlp-selopt.
ENDFORM. "F4_formRegards
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |