Application Development and Automation 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: 
Read only

search help parameters

Former Member
0 Likes
636

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.

1 REPLY 1
Read only

RaymondGiuseppi
Active Contributor
0 Likes
370

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_form

Regards