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

Screen : F4 help

Former Member
0 Likes
1,832

Hello All,

I am having one screen in my program. It is having 2 text fields(Dictionary strucure fields) and the first one is having search help.

My requirement is- When I select the F4 help in the first screen, I would like to get the matching value(from the table) in the second text field.

Please help me with the logic or Function Module(with description).

Thanks in Advance,

Regards,

Lijo

Hello All,

I am having one screen in my program. It is having 2 text fields(Dictionary strucure fields) and the first one is having search help.

My requirement is- When I select the F4 help in the first screen, I would like to get the matching value(from the table) in the second text field.

Please help me with the logic or Function Module(with description).

Thanks in Advance,

Regards,

Lijo

10 REPLIES 10
Read only

geetha_k
Active Participant
0 Likes
1,525

Hi,

u will declare like this in the section screen ...

SELECT-OPTIONS: KD_LIFNR FOR LFA1-LIFNR MATCHCODE OBJECT KRED.

BEGIN_OF_BLOCK 0.

SELECT-OPTIONS: KD_BUKRS FOR LFB1-BUKRS.

here vendor number will select only on the company code in the search help.

I think it will helpful for u.

Read only

Former Member
0 Likes
1,525

Hello, Gita,

Thanks for your Quick reply

This is not a selection screen .

>>>Module Pool Screen

Regards,

LIJO

Read only

0 Likes
1,525

hi,

1. First go to SE11 and create your own search help( if you dont know how to create a search help please feel free to ask me, it is very easy).

2. Now in your module pool program program go to the layout of your screen.

3. Now when you see the attributes of this field in the Dict tab you will find the field Search Help. Now here you can specify the name of the search help you created in SE11.

There is also another mehtod to create the dynamic search help. eg:- in a posted document data get the Document nos related to that company code.

The sample code is like this:-

First of all declare the module below in the flow logic of your screen then create it in your main program.

You declare the module in the PROCESS ON VALUE-REQUEST.

PROCESS ON VALUE-REQUEST.

FIELD TXT_DOCNO MODULE VALUE_BELNR.

You also need to create an internal table where you wil store results of the select query fired below in the module.

here you will get a F4 help on the filed Document Number(TXT_DOCNO) based on the field Company code (TXT_CODCO)

MODULE VALUE_BELNR INPUT.

progname = sy-repid.

dynnum = sy-dynnr.

CLEAR: field_value, dynpro_values.

field_value-fieldname = 'TXT_CODCO'.

APPEND field_value TO dynpro_values.

CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'

EXPORTING

tabname = 'BKPF'

fieldname = 'BUKRS'

dynpprog = progname

dynpnr = dynnum

dynprofield = 'TXT_CODCO'.

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

dyname = progname

dynumb = dynnum

translate_to_upper = 'X'

TABLES

dynpfields = dynpro_values.

READ TABLE dynpro_values INDEX 1 INTO field_value.

SELECT BUKRS BELNR

FROM BKPF

INTO CORRESPONDING FIELDS OF TABLE it_doc1

WHERE BUKRS = field_value-fieldvalue.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'BELNR'

dynpprog = progname

dynpnr = dynnum

dynprofield = 'TXT_BELNR'

value_org = 'S'

TABLES

value_tab = it_doc1.

ENDMODULE. " VALUE_BELNR INPUT

regards

prasanth

Read only

Former Member
0 Likes
1,525

Hi,

Search Helps for Parameters

A search help is a ABAP Dictionary object used to define possible values (F4) help (see Input Help in the ABAP Dictionary). You can link a search help to a parameter as follows:

PARAMETERS p ... MATCHCODE OBJECT search_help.

The search help search_help must be defined in the ABAP Dictionary. The system now automatically displays the input help button for the field on the screen and activates the F4 key for it. When the user requests input help, the hit list of the search help appears, and when he or she selects an entry, the corresponding export parameter is placed in the input field.

The predecessors of search helps in the ABAP Dictionary were called matchcode objects, hence the name of the addition, MATCHCODE OBJECT in the PARAMETERS statement. Existing matchcode objects are still supported.

REPORT demo_sel_screen_parameters_mco.

PARAMETERS p_carrid TYPE s_carr_id

MATCHCODE OBJECT demo_f4_de.

The selection screen looks as follows:

The search help DEMO_F4_DE is defined in the ABAP Dictionary. The search help reads the columns CARRID and CARRNAME from the database table SCARR. Only CARRNAME is listed, but CARRID is flagged as an export parameter. When you choose a line, the airline code CARRID is placed in the input field

... AS MATCHCODE STRUCTURE

Effect

Creates the database-specific parameter p as a field string according to the Dictionary structure MCPARAMS with the fields MCID (matchcode ID ) and STRING (search string ).

Used for data selection through matchcode entry.

On the selection screen, both sub-fields are displayed in a box with the text "Matchcode selection".

You can get a list of possible entries for the matchcode ID and the search string by pressing F4 . If you choose a matchcode ID and press F4 in the field "Search string", you see a dialog box where you can enter a search criterion for each field of the matchcode ID. The system interprets what you enter generically for each sub-field.

Note

The addition AS MATCHCODE STRUCTURE only makes sense in a logical database access program and must therefore be used together with the addition FOR TABLE . It can also be combined with the addition MODIF ID , but not with any other additions. The matchcode object to which the matchcode ID and the search string refer is determined when you define the logical database.

Example

Input on the selection screen:

Matchcode ID: Customers Search string: Daniel

The effect of this is to select all customers whose names begin with "Daniel".

Note

Performance

Matchcode selection can improve program performance considerably. This is because specifying a search string often describes the required set of data records more accurately than the key fields of the table. For example, it is easier to select by name ("Daniel") than by customer number ("000043010") and far fewer records are read from the database.

Note

If a logical database (e.g. ldb ) contains a parameter p defined with AS MATCHCODE STRUCTURE , the system always creates an internal table ldb_MC which includes all the key fields of the selected records. The structure of ldb_MC is determined by the matchcode object and generated automatically. In the maintenance transaction for logical databases, the structure is displayed as a comment in the database program.

Example

Matchcode object for table T1 with key field T1-K1 . The table ldb_MC then has the following structure:

DATA: BEGIN OF ldb_MC OCCURS 100,

T1_K1 LIKE T1-K1,

END OF ldb_MC.

Note

If the user has entered values in the matchcode parameter fields, the program reads the selected data from the matchcode table after START-OF-SELECTION and makes it available to the logical database program in the internal table ldb_MC . Then, the database program processes the records in the subroutine PUT_ldb_MATCHCODE and, with the help of PUT , triggers the appropriate GET events in the report. Subsequent processing is exactly the same as that for data selection direct from the database.

Example

FORM PUT_ldb_MATCHCODE.

SELECT * FROM T1

WHERE K1 = ldb_MC-T1_K1

FOR ALL ENTRIES IN ldb_MC.

PUT T1.

ENDSELECT.

ENDFORM.

Note

In matchcode selection, the system flags all fields in the internal table MC_FIELDS which are filled with values by the matchcode (the field name is in MC_FIELDS-FIELDNAME and the flag is in MC_FIELDS-SUPPLIED ).

Example

A field F0 is supplied with a value by the matchcode if the following condition is satisfied:

IF MC_FIELDS-FIELDNAME EQ 'F0'

AND MC_FIELDS-SUPPLIED NE SPACE.

Note

Further documentation:

In the maintenance transaction for logical databases, select Help -> Extended help

In the editor: logical databases ( LDB )

Read only

Former Member
0 Likes
1,525

Hi John,

make a serch help with the two required fields and assign the search help to the fields in the selection screen using matchcode object addition.

reward points if helpful.

Read only

Former Member
0 Likes
1,525

hai,

this might help u

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

  • DDIC_STRUCTURE = ' '

RETFIELD = 'WERKS'

  • PVALKEY = ' '

DYNPPROG = progname

DYNPNR = dynnum

DYNPROFIELD = 'I_MAT-WERKS'

  • STEPL = 0

  • WINDOW_TITLE =

  • VALUE = ' '

VALUE_ORG = 'S'

  • MULTIPLE_CHOICE = ' '

  • DISPLAY = ' '

  • CALLBACK_PROGRAM = ' '

  • CALLBACK_FORM = ' '

  • MARK_TAB =

  • IMPORTING

  • USER_RESET =

TABLES

VALUE_TAB = I_M_TYPE

  • FIELD_TAB =

RETURN_TAB = v_return.

TEMP_PLANT = V_return-fieldval.

in temp_plant u get a value by which u can assign to next field

Regards,

vikram

Read only

geetha_k
Active Participant
0 Likes
1,525

Hi,

In ur module pool program u will create include program.

In that include program u will declare selection screen objects...

Read only

Former Member
0 Likes
1,525

hai ,

write this code in module pool screen in PAI

PROCESS ON VALUE-REQUEST.

FIELD I_MAT-WERKS MODULE WERKS_CHECK.

click on module and write a code shown below in your program

SELECT DISTINCT LOW FROM TVARV INTO CORRESPONDING FIELDS OF TABLE I_M_TYPE

WHERE LOW = '2148'

OR LOW = 'AU01'

OR LOW = 'AU10'.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

  • DDIC_STRUCTURE = ' '

RETFIELD = 'WERKS'

  • PVALKEY = ' '

DYNPPROG = progname

DYNPNR = dynnum

DYNPROFIELD = 'I_MAT-WERKS'

  • STEPL = 0

  • WINDOW_TITLE =

  • VALUE = ' '

VALUE_ORG = 'S'

  • MULTIPLE_CHOICE = ' '

  • DISPLAY = ' '

  • CALLBACK_PROGRAM = ' '

  • CALLBACK_FORM = ' '

  • MARK_TAB =

  • IMPORTING

  • USER_RESET =

TABLES

VALUE_TAB = I_M_TYPE

  • FIELD_TAB =

RETURN_TAB = v_return.

TEMP_PLANT = V_return-fieldval.

from TEMP_PLANT u can assign values to your next screen field

by using FM

CALL FUNCTION 'DYNP_VALUES_UPDATE'

EXPORTING

DYNAME = sy-cprog

DYNUMB = sy-dynnr

TABLES

DYNPFIELDS = dynpfields.

endif.

Regards,

vikram

Edited by: vikram s on May 21, 2008 7:24 AM

Read only

asik_shameem
Active Contributor
0 Likes
1,525

Hi

If you can write the select query in PBO, then you can acheive this.

Lets consider the screen fields are MARA-MATNR and MARA-MTART.

PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
MODULE GET_MTART.
*
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.


PROGRAM  zm_test .

DATA: gv_mtart TYPE mara-mtart.

MODULE get_mtart OUTPUT.

SELECT SINGLE mtart INTO gv_mtart WHERE matnr = mara-matnr.

mara-mtart = gv_mtart.

ENDMODULE.

Read only

Former Member
0 Likes
1,525

Thank you All. The problem is solved