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

F4 search

Former Member
0 Likes
1,091

Hi

I have to search production version based on matnr and werks. The search result should come as standard search , but result based on matnr and werks.

I am able to achieve the search when i use F4IF_INT_TABLE_VALUE_REQUEST.

But it doesnt display in the standard way.

If i dont give the above, i get the standard search page, but the matnr and werks are not considered.

Can anyone suggest a solution.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
981

hi

A search help already exists for thi sfield in se11. H_MKAL

when i use mfbf transaction. give the material number and werks and go for f4 in production version, i get the verid s based on metnr and werks.and the display is also standard way.

I want to achieve similar functionality in a custom transaction.

in my transaction the matnr and werks are not considered. i want to correct this.

Edited by: Raghuram Chaluvadi on Apr 29, 2008 9:50 AM

9 REPLIES 9
Read only

Former Member
0 Likes
981

You would use SE11, create a Z* search help. Then attach your Z* search help to the SAP search.

Which search help do you want to change? What transaction are you running?

Read only

0 Likes
981

Hi,

You can either use search help exit for this or if you want to use this function -

SELECT * FROM <tablename> INTO TABLE it_tab where condition . " based on werks and matnr

SORT it_tab.

DELETE ADJACENT DUPLICATES FROM it_tab.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST' " This function helps returning F4 help value to be displayed in internal table

EXPORTING

retfield = 'PROCESS' " Table field

dynpprog = l_progname " Program Name

dynpnr = l_dynnum " Screen No

dynprofield = 'PROC_IO' " For which control to display the search help

window_title = 'Select Process' " Window Title

value_org = 'S' " Reading Structure wise

TABLES

value_tab = it_process " Values to be displayed

return_tab = it_return " Value selected

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.

READ TABLE it_return INDEX 1.

proc_io = it_return-fieldval. " pass field value into proc_io control

ENDIF.

Read only

Former Member
0 Likes
981

Hi Since you want to search on the basis of the two fields the best approach will be to create a new search help from se11.

For this create a new FM for use in the search help in se37, you can copy the FM "F4IF_SHLP_EXIT_EXAMPLE" say z_search_help. Call this FM in the search help exit in the search help created through se11.

Inside this z_search_help function module put your select statement after the line

IF CALLCONTROL-STEP = 'SELECT'.

the return values should be filled into RECORD_TAB.

Now you can proceed with creation of the search help as usual by defining the parameters, import and export parameters, etc.

Now when you run the search help you will get results based o the select querry.

Let me know if you need more details.

Thanks,

Barjinder Singh.

Read only

Former Member
0 Likes
982

hi

A search help already exists for thi sfield in se11. H_MKAL

when i use mfbf transaction. give the material number and werks and go for f4 in production version, i get the verid s based on metnr and werks.and the display is also standard way.

I want to achieve similar functionality in a custom transaction.

in my transaction the matnr and werks are not considered. i want to correct this.

Edited by: Raghuram Chaluvadi on Apr 29, 2008 9:50 AM

Read only

0 Likes
981

You should make sure that the other two fields you want considered in the F4 are "like" or "type" of the correct name for the searchhelp to pick up - the report example below should show you this in action:


report zlocal_jc_sdn_verid_f4.

parameters:
  p_field1     type mkal-verid,
  p_field2     type mkal-werks default 'JC',
  p_field3     type mkal-matnr.

start-of-selection.

.... if you change the values in field2 and field3 and then F4 on field1 to get the matchcode / searchhelp up you should see your values defaulted in.

Jonathan

Read only

Former Member
0 Likes
981

Thank you Jonathan. It solved the problem.

Hoes does this decalaration affect the process. Does the search help check for the type or something like that?

Read only

0 Likes
981

Glad it helped!... If you have the time to step through all the SAP code that fires when you select F4, I think you'll eventually find some code that looks at the data elements of the screen parameters and tries to match these against the input parameters for the searchhelp... also if you look in SE11 at the searchhelp and F1 on the Input Parameter checkbox and follow your nose a bit you can find a comment in the help about SAP using matching of field names... not sure how it copes if you have several fields all of the same data element - probably picks the first.

Jonathan

Read only

0 Likes
981

Hello,

I have also got the same requirement where i am have 3 fields in which if i select one field from the search help then it should display the other 2 fields automatically.

I have created the search help with import and export checkboxes have been selected. Can you give me solution for this.

Thks

Read only

0 Likes
981

Hello,

I have also got the same requirement where i am have 3 fields in which if i select one field from the search help then it should display the other 2 fields automatically.

I have created the search help with import and export checkboxes have been selected. Can you give me solution for this.

Thks