cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass parameter to search help

Former Member
0 Kudos

Hi,

I have created a search help( zv_region) for a screen field(region) and assigned that search help( zv_region) to screen attributes of screen field (region). But i have two fields in my screen. These two fields i am not taking from table or structure. I declared in my module pool program as global fields.

1. Country

2. Region.

I want to filter "region" based on "country". For example if they enter "US" in country field, then they click on search help for region field it needs to populate only all us states.

Please advice me how to do that.

Thanks in advance.

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi Sankar,

I have implemented a functionality similar to yours. Here I have made use of fm F4IF_INT_TABLE_VALUE_REQUEST to populate the values. You first copy this program and run it. You will get the idea.

&----


*& Report ZKun_F4HELP1 *

*& *

&----


*& *

*& *

&----


REPORT ZKUN_F4HELP1 .

DATA: BEGIN OF VALUES,

MATNR TYPE MARA-MATNR,

MTART TYPE MARA-MTART,

END OF VALUES.

DATA: PROGNAME LIKE SY-REPID,

DYNNUM LIKE SY-DYNNR,

DYNPRO_VALUES TYPE TABLE OF DYNPREAD,

FIELD_VALUE LIKE LINE OF DYNPRO_VALUES,

VALUES_TAB LIKE TABLE OF VALUES WITH HEADER LINE.

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-008.

PARAMETERS : MATNR_N LIKE MARA-MATNR OBLIGATORY,

MTART_N LIKE MARA-MTART.

SELECTION-SCREEN END OF BLOCK B1.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR MATNR_N.

CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'

EXPORTING

tabname = 'MARA'

fieldname = 'MATNR'

  • SEARCHHELP = ' '

  • SHLPPARAM = ' '

DYNPPROG = PROGNAME

DYNPNR = DYNNUM

DYNPROFIELD = 'MATNR_N'

  • STEPL = 0

  • VALUE = ' '

  • MULTIPLE_CHOICE = ' '

  • DISPLAY = ' '

  • SUPPRESS_RECORDLIST = ' '

  • CALLBACK_PROGRAM = ' '

  • CALLBACK_FORM = ' '

  • SELECTION_SCREEN = ' '

  • IMPORTING

  • USER_RESET =

  • TABLES

  • RETURN_TAB = VALUES_TAB

EXCEPTIONS

FIELD_NOT_FOUND = 1

NO_HELP_FOR_FIELD = 2

INCONSISTENT_HELP = 3

NO_VALUES_FOUND = 4

OTHERS = 5

.

IF sy-subrc <> 0.

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

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

ENDIF.

AT SELECTION-SCREEN OUTPUT.

PROGNAME = SY-REPID.

DYNNUM = SY-DYNNR.

CLEAR: FIELD_VALUE, DYNPRO_VALUES.

FIELD_VALUE-FIELDNAME = 'MATNR_N'.

APPEND FIELD_VALUE TO DYNPRO_VALUES.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR MTART_N.

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

dyname = PROGNAME

dynumb = DYNNUM

TRANSLATE_TO_UPPER = 'X'

  • REQUEST = ' '

  • PERFORM_CONVERSION_EXITS = ' '

  • PERFORM_INPUT_CONVERSION = ' '

  • DETERMINE_LOOP_INDEX = ' '

tables

dynpfields = dynpro_values

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

.

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 DYNPRO_VALUES INDEX 1 INTO FIELD_VALUE.

select matnr mtart from mara into table values_tab where matnr =

FIELD_VALUE-FIELDVALUE.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

  • DDIC_STRUCTURE = ' '

retfield = 'MTART'

  • PVALKEY = ' '

DYNPPROG = PROGNAME

DYNPNR = DYNNUM

DYNPROFIELD = 'MTART_N'

  • STEPL = 0

  • WINDOW_TITLE =

  • VALUE = ' '

VALUE_ORG = 'S'

  • MULTIPLE_CHOICE = ' '

  • DISPLAY = ' '

  • CALLBACK_PROGRAM = ' '

  • CALLBACK_FORM = ' '

  • MARK_TAB =

  • IMPORTING

  • USER_RESET =

tables

value_tab = VALUES_TAB

    • FIELD_TAB =

  • RETURN_TAB =

  • 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.

Regards,

Kunal.

<b>Note : you just have to modify this program for country and region fields instead of matnr and mtart.</b>

Message was edited by: Kunal Kumar

Former Member
0 Kudos

Hi Sankar,

My suggestion would be u don't need search help(zv_region) over here.

You can do this instead:

(I guess it is module-pool reporting)

In the flow logic of the screen,

at the end use this code ...

PROCESS ON VALUE-REQUEST.

FIELD region MODULE f4_region.

then in module f4_region.

First select the region according to country in a table.

then use the FM

F4_FIELD_ON_VALUE_REQUEST

****Hope this serves ur purpose.

****Please reward the useful replies

sbhutani1
Contributor
0 Kudos

Hi sankar,

You can try at selection screen on value request for event, in this event you can use select statement to get the region based on country and then use that value. or alternatively you can use FM f4if_field_value_request. this function is used for avoiding standard F4 help to be shown and will show your custom F4 help.

Hope this will help you

Regards

Sumit Bhutani

Former Member
0 Kudos

HI sankar,

1. want to filter "region" based on "country".

2. IMPORT (In search help)

3. When we create search help,

there is one CHECKBOX for IMPORT.

4. In your search help, there should be both fields,

a) country

b) region

5. TICK import for country

6. It means that, if , on screen,

there is Country field,

then its value will get imported in search help,

and then IT WILL FILTER and show values

only for that country.

7. But this concept works, if

the screen field for country,

is same name (table-fieldname) as that of

country fieldname in search help.

regards,

amit m.

hymavathi_oruganti
Active Contributor
0 Kudos

build an itab with these two fields,

and

at <b>POV</b> EVENT.

select region from dbtab where country = country (entered value)

into table itab.

CALL FN MODULE

POPUP_WITH_TABLE_DISPLAY