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

Dynamic Search help

Former Member
0 Likes
519

Dear All,

I have got one requirement. I have 3 fields on selection screen. Based on the values entered by user in first 2 fields, I want o provide the search help in third field.

for example.

The fields are plant , storage location and material.

Then only for the entered plant and entered storage location , the material numbers should be displayed in the F4 help of the third field.

pls help.

Thanks ,

Supriya.

4 REPLIES 4
Read only

Former Member
0 Likes
412

Hi,

This can be done using the function modules DYNP_VALUES_READ (for reading the values from the screen) and then use the function module F4IF_INT_TABLE_VALUE_REQUEST to display the values for the third field.

Sample Code:-

DATA: l_lifnr TYPE lifnr.

PARAMETERS: p_werks LIKE mard-werks,

p_lgort LIKE mard-lgort,

p_matnr LIKE mard-matnr.

TYPES : BEGIN OF ty_mard,

matnr TYPE matnr,

werks TYPE werks_d,

lgort TYPE lgort_d,

END OF ty_mard.

DATA : gt_help TYPE TABLE OF ty_mard.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_matnr.

DATA : it_dynp TYPE STANDARD TABLE OF dynpread WITH HEADER LINE.

REFRESH it_dynp.

it_dynp-fieldname = 'P_WERKS'.

APPEND it_dynp.

it_dynp-fieldname = 'P_LGORT'.

APPEND it_dynp.

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

dyname = sy-cprog

dynumb = sy-dynnr

TABLES

dynpfields = it_dynp

EXCEPTIONS

invalid_abapworkarea = 0

invalid_dynprofield = 0

invalid_dynproname = 0

invalid_dynpronummer = 0

invalid_request = 0

no_fielddescription = 0

invalid_parameter = 0

undefind_error = 0

double_conversion = 0

OTHERS = 0.

READ TABLE it_dynp WITH KEY fieldname = 'P_WERKS'.

IF sy-subrc EQ 0.

p_werks = it_dynp-FIELDVALUE.

ENDIF.

READ TABLE it_dynp WITH KEY fieldname = 'P_LGORT'.

IF sy-subrc EQ 0.

p_lgort = it_dynp-FIELDVALUE.

ENDIF.

SELECT * FROM mard

INTO CORRESPONDING FIELDS OF TABLE gt_help

WHERE werks = p_werks

AND lgort = p_lgort.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'P_MATNR'

dynpprog = sy-repid

dynpnr = sy-dynnr

dynprofield = 'P_MATNR'

value_org = 'S'

TABLES

value_tab = gt_help

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.

Edited by: Krishna Adabala on Jan 14, 2009 11:05 AM

Read only

Former Member
0 Likes
412

Hi Supriya,

Please [search|] the SCN before you post the question. There are lot of threads avaliable with this subject.

Read only

Former Member
0 Likes
412

hi

when user presses F$ for third field ..read other two field using table index and acccordingly select the data for third field from table and put that in value table and use in

FM :

F4IF_INT_TABLE_VALUE_REQUEST

regards

vivek

Read only

Former Member
0 Likes
412

Hi,

On third field use AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_matnr.

Then write a select query for fetching materials into internal table based on plant n storage location from required table. Then pass this internal table to F4IF_INT_TABLE_VALUE_REQUEST'

Thanks,

Srilakshmi.