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: 

Help regarding search help in SAP

Former Member
0 Kudos

Hello folks,

i want to create search help in SAP.but i want only particular values of the field.like if i create search on MARA-MATNR i dont want all values which are there MATNR but only few values of matnr.How can i do this.is there any other method to do this.

8 REPLIES 8

Former Member
0 Kudos

Hi nirad,

1. For that create one VIEW

which will filter out the un-wanted values.

2. Then in search help,

use that view in place of the table name.

regards,

amit m.

former_member188685
Active Contributor
0 Kudos

Hi,

you can use the FM <b>F4IF_INT_TABLE_VALUE_REQUEST</b>, show your own F4 help values for MATNR with few values based on some condition from MARA table.

Regards

vijay

Former Member
0 Kudos

Hai Nirad

Check the following Code

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

  • DDIC_STRUCTURE = ldf_tabname " Structure of VALUE_TAB

RETFIELD = LDF_FLDNAME "Name of return field in FIELD_TAB

  • PVALKEY = ' '

  • DYNPPROG = ' '

  • DYNPNR = ' '

  • DYNPROFIELD = ' '

  • STEPL = 0

  • WINDOW_TITLE =

  • VALUE = ' '

VALUE_ORG = LCF_VAL "Value return

  • MULTIPLE_CHOICE = ' '

  • DISPLAY = ' '

  • CALLBACK_PROGRAM = ' '

  • CALLBACK_FORM = ' '

  • MARK_TAB =

  • IMPORTING

  • USER_RESET =

TABLES

VALUE_TAB = TAB_TEMP " Table of Values

FIELD_TAB = LDT_FLDTAB " Fileds of the Hit list

RETURN_TAB = LDT_RETTAB " return the selected value

  • DYNPFLD_MAPPING =

EXCEPTIONS

PARAMETER_ERROR = 1

NO_VALUES_FOUND = 2

OTHERS = 3.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

READ TABLE LDT_RETTAB INDEX 1.

DATA: LDT_DFIES LIKE DFIES OCCURS 0 WITH HEADER LINE.

CLEAR LDT_DFIES.

CALL FUNCTION 'DDIF_FIELDINFO_GET'

EXPORTING

TABNAME = LDF_TABNANME

FIELDNAME = LDF_FLDNAME

  • LANGU = SY-LANGU

  • LFIELDNAME = ' '

  • ALL_TYPES = ' '

  • GROUP_NAMES = ' '

  • UCLEN =

  • IMPORTING

  • X030L_WA =

  • DDOBJTYPE =

  • DFIES_WA =

  • LINES_DESCR =

TABLES

DFIES_TAB = LDT_DFIES " Field List

  • FIXED_VALUES =

EXCEPTIONS

NOT_FOUND = 1

INTERNAL_ERROR = 2

OTHERS = 3.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Thanks & regards

Sreenivasulu P

Thanks & Regards

Sreenivasulu P

venkat_o
Active Contributor
0 Kudos

Hello Nirad,

You can do this in two ways.

<b>1</b>.As Amit said create View and use that instead of table

<b>2</b>.u can use 'F4IF_INT_TABLE_VALUE_REQUEST' this FM.

I am giving sample code for this.

data: w_progname like sy-repid,

w_scr_num like sy-dynnr .

data: return_values like ddshretval occurs 0 with header line.

data: itab_dynpfields like dynpread occurs 0 with header line,

t_dynpfields like dynpread.

data: t_dyname like d020s-prog,

t_dynumb like d020s-dnum.

select abstyp absart b~batxt

from t161 as a inner join t161t as b on abstyp = bbstyp

and absart = bbsart

into table i_t161

where a~bstyp = 'F'

and b~spras = sy-langu.

if sy-subrc = 0.

call function <b>'F4IF_INT_TABLE_VALUE_REQUEST'</b>

exporting

retfield = 'BSART'

dynpprog = w_progname

dynpnr = w_scr_num

dynprofield = 'EKPO-BSART'

value_org = 'S'

tables

value_tab = i_t161

return_tab = return_values

exceptions

parameter_error = 1

no_values_found = 2

others = 3.

if sy-subrc <> 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

else .

bsart = return_values-fieldval.

endif.

endif.

endform. " f4_values_restricted

I think this will help you.

<b>Thanks,

Venkat.O</b>

Former Member
0 Kudos

Here code is not geeting executed .please help.Specify the data which need to be declared.

0 Kudos

Hi again,

1. U can try this code also.

2. We can select from table and put that

data into internal table for display purpose.

3.

REPORT ABC.

*----


DATA : BEGIN OF ITAB OCCURS 0,

UNAME LIKE USR01-BNAME,

END OF ITAB.

data : RETURN_TAB LIKE DDSHRETVAL occurs 0 .

data : RETURN_wa LIKE DDSHRETVAL .

*----


PARAMETERS : A(12) TYPE C.

*----


AT SELECTION-SCREEN ON VALUE-REQUEST FOR A.

ITAB-UNAME = 'U01'. APPEND ITAB.

ITAB-UNAME = 'U02'. APPEND ITAB.

ITAB-UNAME = 'U03'. APPEND ITAB.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

  • DDIC_STRUCTURE = ' '

retfield = 'ITAB-UNAME'

  • PVALKEY = ' '

DYNPPROG = SY-REPID

DYNPNR = SY-DYNNR

DYNPROFIELD = 'A'

  • STEPL = 0

  • WINDOW_TITLE =

  • VALUE = ' '

VALUE_ORG = 'S'

  • MULTIPLE_CHOICE = ' '

  • DISPLAY = ' '

  • CALLBACK_PROGRAM = ' '

  • CALLBACK_FORM = ' '

  • MARK_TAB =

  • IMPORTING

  • USER_RESET =

tables

value_tab = ITAB

  • FIELD_TAB = FTAB

RETURN_TAB = return_tab

  • DYNPFLD_MAPPING =

  • EXCEPTIONS

  • PARAMETER_ERROR = 1

  • NO_VALUES_FOUND = 2

  • OTHERS = 3

.

break-point.

regards,

amit m.

0 Kudos

Hi Nirad,

check this code..

REPORT  ZTEST_F4HELP                              .

*---Report with selection screen and to display the list of
* possible entries for field 'B' as per the value in field 'A'.


parameters: p_vbeln type vbak-vbeln,
            p_posnr type vbap-posnr.

at selection-screen on value-request for p_posnr.


  data: begin of help_item occurs 0,
          posnr type vbap-posnr,
          matnr type vbap-matnr,
          arktx type vbap-arktx,
        end of help_item.

  data: dynfields type table of dynpread with header line.


  dynfields-fieldname = 'P_VBELN'.
  append dynfields.

  call function 'DYNP_VALUES_READ'
       exporting
            dyname               = sy-cprog
            dynumb               = sy-dynnr
            translate_to_upper   = 'X'
       tables
            dynpfields           = dynfields
       exceptions
            invalid_abapworkarea = 1
            invalid_dynprofield  = 2
            invalid_dynproname   = 3
            invalid_dynpronummer = 4
            invalid_request      = 5
            no_fielddescription  = 6
            invalid_parameter    = 7
            undefind_error       = 8
            double_conversion    = 9
            stepl_not_found      = 10
            others               = 11.


  read table dynfields with key fieldname = 'P_VBELN'.

  p_vbeln = dynfields-fieldvalue.


  call function 'CONVERSION_EXIT_ALPHA_INPUT'
       exporting
            input  = p_vbeln
       importing
            output = p_vbeln.

  select posnr matnr arktx into table help_item
                 from vbap
                      where vbeln = p_vbeln.



  call function 'F4IF_INT_TABLE_VALUE_REQUEST'
       exporting
            retfield    = 'POSNR'
            dynprofield = 'P_POSNR'
            dynpprog    = sy-cprog
            dynpnr      = sy-dynnr
            value_org   = 'S'
       tables
            value_tab   = help_item.

Regards

vijay

Former Member
0 Kudos

Thank you for your help guys imy problem is solved.