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: 

Search help on screen

Former Member
0 Kudos

hi all,

I have two screen fields to which i have attached search helps dynamically (using function module F4IF_INT_TABLE_VALUE_REQUEST. The scenario is that i want to select the first field and depending on the value entered, i want to restrict the search help on the second field. eg: i select material (mara-matnr) and depending on the material, i want to show only the related plants (marc-werks for the material).

The issue is that when i write a select to populate the fields in the value_tab internal table(returned by the function module F4IF_INT_TABLE_VALUE_REQUEST, i write the following...

select werks from marc into (l_werks)

where matnr eq i_matnr.

where i_matnr is the screen field.

the selected material is not populated in i_matnr. However, while executing the PAI, the value can be seen.

What i rather want is this to be available in POV. since the module containing the above code is written in POV.

is there something i m missing?

if not then what could be the possible ways to get around this.?

I hope the problem is clear. Awaiting answers...

regards,

PJ

1 ACCEPTED SOLUTION

athavanraja
Active Contributor
0 Kudos

define <b>i_matnr</b> as a global variable (define it in the top include), after the first F4 is used pass the value (matnr) to this variable and then fill the itab for the second F4 based on this value.

Since you have decrated this variable in the top include the value passed to i_matnr will be available in all events.

Regards

Raja

6 REPLIES 6

Former Member
0 Kudos

Hey,

Create an elementary search help with EXIT. And write your query in that exit. It will work fine.

Regs,

Venkat

Former Member
0 Kudos

Hi,

Check this sample code

F4IF_INT_TABLE_VALUE_REQUEST F4 help that returns the values selected in an internal table. Very handy when programming your very own F4 help for a field. 
 

Example:

  data:
    begin of t_values occurs 2,
      value like kna1-begru,
    end of t_values,

    t_return like ddshretval occurs 0 with header line.

  t_values = 'PAR*'.
  append t_values.

  t_values = 'UGG'.
  append t_values.

  call function 'F4IF_INT_TABLE_VALUE_REQUEST'
       exporting
            retfield        = 'BEGRU'
            value_org       = 'S'
       tables
            value_tab       = t_values
            return_tab      = t_return
       exceptions
            parameter_error = 1
            no_values_found = 2
            others          = 3.

  if sy-subrc = 0.
    read table t_return index 1.

    o_begru-low = t_return-fieldval.

    if o_begru-low = 'PAR*'.
      o_begru-option = 'CP'.
    else.
      o_begru-option = 'EQ'.
    endif.

    o_begru-sign = 'I'.

    append o_begru to s_begru.
  else.
    o_begru = i_begru.
  endif.

F4IP_INT_TABLE_VALUE_REQUEST This function does not exist in 4.6 and above. Use F4IF_INT_TABLE_VALUE_REQUEST instead.

Hope this helps.

athavanraja
Active Contributor
0 Kudos

define <b>i_matnr</b> as a global variable (define it in the top include), after the first F4 is used pass the value (matnr) to this variable and then fill the itab for the second F4 based on this value.

Since you have decrated this variable in the top include the value passed to i_matnr will be available in all events.

Regards

Raja

0 Kudos

hi Raja,

i have indeed declared i_matnr as a global variable in a top include. but i m not populating it separately. what i m doing is to populate it using the dynprofield parameter of the function module.

the following is how i have called the function....

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'MATNR'

dynpprog = sy-repid

dynpnr = '9001'

dynprofield = 'i_matnr'

value_org = 'S'

TABLES

value_tab = t_f4_matnr.

isn't this equivalent to what you have said? or do i need to use the return_tab-fieldval table to get the value explicitly.

i have worked out that using return_tab-fieldval, the problem will be solved. but still plz let me know whether specifying i_matnr in the function call for dynprofield is equivalent or not.

regards,

PJ

0 Kudos

as you said you need to use return_tab-fieldval.

also "dynprofield = 'i_matnr'"

specify the screen field name in upper case, otherwise it gives problem somtimes.

dynprofield = 'I_MATNR'

Regards

Raja

Former Member
0 Kudos

There is no field transport from DYNP to ABAP in event POV. Only the F4-field value is transported. If you need values entered by the user into other fields, you may use function module DYNP_VALUES_READ within your POV module.

Hoewever, creating a searchhelp might be a better solution.

Oliver.