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: 

Regarding F4 help/Search help

Former Member
0 Kudos

HI,

I want to add F4 functionality in Selection Screen.

Any body help on this regards.

Thanks,

Singha

10 REPLIES 10

JoseMunoz
Active Participant
0 Kudos

You have to create the Search help by your own, and then do this:

SELECT-OPTIONS se_orgid FOR norg-orgid OBLIGATORY

MATCHCODE OBJECT zish_cn

MEMORY ID oge.

Where the zish_cn is your Search help.

Regards

Message was edited by: Jose Muñoz

Former Member
0 Kudos

Hai Singha

Check the following Code for F4 Functionality

TABLES : MARD.

DATA: BEGIN OF IT_MARD OCCURS 0,

WERKS LIKE MARD-WERKS,

LGORT LIKE MARD-LGORT,

END OF IT_MARD.

DATA : T_RETURN TYPE STANDARD TABLE OF DDSHRETVAL WITH HEADER LINE.

parameters : P_WERKS LIKE MARD-WERKS.

parameters : P_LGORT LIKE MARD-LGORT.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_WERKS.

SELECT WERKS LGORT FROM MARD UP TO 10 ROWS INTO table IT_MARD.

DELETE ADJACENT DUPLICATES FROM IT_MARD COMPARING WERKS.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

RETFIELD = 'WERKS'

DYNPPROG = SY-REPID

DYNPNR = '1000'

DYNPROFIELD = 'P_WERKS'

VALUE_ORG = 'S'

TABLES

VALUE_TAB = IT_MARD

RETURN_TAB = T_RETURN

EXCEPTIONS

PARAMETER_ERROR = 1

NO_VALUES_FOUND = 2

OTHERS = 3.

if sy-subrc = 0.

read table it_mard index 1. "transporting werks.

move it_mard-lgort to p_lgort.

endif.

Thanks & regards

Sreenivasulu P

dani_mn
Active Contributor
0 Kudos

Hi,

Use a data element or domain with search help attached as reference to your field. Search Help attached to the field will automatically gets on.

Or create a data element and attach a search help with it.

Create search help using SE11.

Or if you want to manully build a search help for field. then use this code.

at selection-screen on value-request for source.

progname = sy-repid.

dynnum = sy-dynnr.

clear value_tab.

refresh value_tab.

  • Filling the Value_tab internal table by itab2 internal table.

*----


loop at itab_desc.

write itab_desc-description to value_tab.

append value_tab.

endloop.

*----


prog = sy-repid.

no = 1000.

clear tab.

refresh tab.

*----


  • Building the Structure of the Seach Help.

tab-tabname = 'FMFCTRT'.

tab-fieldname = 'BESCHR'.

collect tab.

  • Function Used to provide Search Help.

call function 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'BESCHR'

dynpprog = prog

dynpnr = no

dynprofield = 'SOURCE'

window_title = 'Function'

TABLES

value_tab = value_tab

field_tab = tab.

Regards,

Wasim Ahmed

Former Member
0 Kudos

data: w_auart type vbak-auart.

SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.

parameters s_auart type vbak-auart.

SELECTION-SCREEN END OF BLOCK blk1.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_auart.

SELECT aauart bbezei

FROM tvak AS a INNER JOIN tvakt AS b

ON aauart = bauart

INTO TABLE t_f4_orders

WHERE a~auart NE space

AND a~trvog EQ c_four

AND a~sperr EQ space

AND b~spras EQ sy-langu.

IF sy-subrc EQ 0.

SORT t_f4_orders BY auart.

*C-- Function module to provide f4 help for the given

*C-- select option. Values displayed in the f4 will be the

*C-- values populated in the internal table t_f4_orders

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = c_auart

dynpprog = sy-repid

dynpnr = sy-dynnr

dynprofield = c_dyn_auart

value_org = c_success

TABLES

value_tab = t_f4_orders

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

IF sy-subrc <> 0.

CASE sy-subrc.

WHEN 1.

MESSAGE s092 DISPLAY LIKE c_error.

"Unknown Error

WHEN 2.

MESSAGE s091 DISPLAY LIKE c_error.

"No Input Help Is Avaialable.

WHEN 3.

MESSAGE s092 DISPLAY LIKE c_error.

"Unknown Error

ENDCASE.

ENDIF.

Former Member
0 Kudos

Possible ways of solving this are

Add the AT SELECTION-SCREEN ON VALUE REQUEST event in your program.

Find the data element of the field and attach a search help to the data element. This is obviously recommended if you r dealing with custom data elements.

-Kiran

Former Member
0 Kudos

Hi ,

U can solve it by any of the two following method, they r as follows :

1. Search help (Using SE11 trans.)

2. Using Function module

‘F4IF_INT_TABLE_VALUE_REQUEST’ at AT SELECTION-SCREEN ON VALUE-REQUEST FOR <INPUT-FIELD NAME>.

The above methods are expolained in details :-

<u>### <b>Search Help.</b></u>

Creating Elementary Search Helps

Procedure

1. In the initial screen of the ABAP Dictionary, select object class Search help, enter the name of the search help and choose Create.

A dialog box appears in which you must select the type of search help.

2. Select Elementary search help and choose .

The maintenance screen for elementary search helps appears.

3. Enter an explanatory text in the field Short text.

You can for example find the search help at a later time using this short text.

4. In the Definition tab page enter the selection method of the search help.

You can enter the name of a table or a view (database view, projection view or help view) here. If you enter a table that has a text table, the name of the text table is automatically entered in the corresponding field.

5. Using the input help (F4 help), select fields of the selection method as parameter in the Search help parameter area. Select the fields that should be used in the dialog box for value selection or in the hit list.

If the selection method is a table that has a text table, both the fields of the table and the fields of the text table are offered in the input help.

The data element of the parameter is automatically copied from the selection method. The data element defines the output attributes and the F1 help of the parameter in the hit list and in the dialog box for value selection.

You can assign the parameter another data element. To do so, select the Mod flag. The Data element field is now ready for input. Then select a data element with the input help (F4 help). Only data elements whose data type, length and number of decimal places is the same as those of the previous data element can be assigned.

This removes the link between the data element of the search help parameter and the data element of the selection method field having the same name. If you cancel the Mod flag, the data element of the assigned table field is used again.

6. Define the attributes of the search help parameters.

Select the IMP flag if it is an import parameter. Select the EXP flag if it is an export parameter.

You can define the dialog for the input help with the fields LPos, SPos and SDis. Enter the parameter position in the hit list in LPos. If you enter nothing or the value 0 here, the parameter is not displayed in the hit list.

Enter the parameter position in the dialog box for value selection in SPos. If you enter nothing or the value 0 here, the parameter is not displayed in the dialog box for value selection.

Set the SDis flag if the parameter should be a pure display field in the dialog box for value selection. The user is thus informed that the contents of the parameter restrict the value, but he cannot change this restriction. This makes sense for example when the parameter is an import parameter or if it has a default value.

You can assign the parameter a default value in the Default value field.

7. Select the dialog type of the search help.

The dialog type defines how the hit list is displayed in the input help.

8. Save your entries.

A dialog box appears in which you have to assign the search help a development class.

9. Choose .

Do not forget to link the search help to a screen field.(Can do it using se11 transaction) The search help attachment is not part of the search help definition; it is part of the object definition to which the search help is attached.

Result

The search help is activated. You can find information about the activation flow in the activation log, which you can display with Utilities &#61614; Activation log. If errors occurred during activation, the activation log is automatically displayed.

Other Options

• Assign a hot key: If the search help is to be accessed with a hot key, you must enter a one-place ID in the Hot key field. All the elementary search helps contained in a collective search help should have different short cuts.

• Assign a search help exit: In exceptions, you might have to change the standard flow defined by the search help with a search help exit. In this case enter the name of the search help exit in the corresponding field.

• Test the search help: You can test the flow of an input help defined by the elementary search help with . A dialog box appears in which you can simulate the behavior of the search help under different conditions. You can obtain information about the options provided in this window with .

<u>####2.Using Function Module</u>

Following steps should be followed for implementing F4 HELP :-

The Function Module used for this purpose : ‘F4IF_INT_TABLE_VALUE_REQUEST’

AT SELECTION-SCREEN ON VALUE-REQUEST FOR <INPUT-FIELD NAME>

  • Populate internal table with value(s) that you want on request.

SELECT * FROM ytrg_g1_e10tabd INTO TABLE t_int1 WHERE bill_no NE space.

LOOP AT t_int1 INTO wa_area1.

wa_area = wa_area1-shop_code.

APPEND wa_area TO t_int.

CLEAR wa_area.

ENDLOOP.

  • Building the Structure of the Seach Help.

tab-tabname = 'YTRG_G1_E10TABD'. (Name of the table)

tab-fieldname = 'SHOP_CODE'. (Name of the field)

APPEND tab. (type dfies )

  • Function Used to provide Search Help.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'SHOP_CODE'

dynpprog = sy-repid

dynpnr = sy-dynnr

window_title = 'Function' (Window Title)

TABLES

value_tab = t_int

field_tab = tab.

Former Member
0 Kudos

hi Singha,

Please try this code,

DATA:L_FILEPATH TYPE IBIPPARMS-PATH.

PARAMETERS:P_FILE TYPE RLGRAP-FILENAME OBLIGATORY.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.

PERFORM FILE_HELP USING P_FILE.

&----


*& Form file_help

&----


FORM FILE_HELP USING P_P_FILE.

CALL FUNCTION 'F4_FILENAME'

  • EXPORTING

  • PROGRAM_NAME = SYST-CPROG

  • DYNPRO_NUMBER = SYST-DYNNR

  • FIELD_NAME = ' '

IMPORTING

FILE_NAME = L_FILEPATH.

P_FILE = L_FILEPATH.

ENDFORM. " file_help

Regards,

Shalini

Former Member
0 Kudos

HI,

Plz check this code once.

REPORT ZLAXMI_BDC1

NO STANDARD PAGE HEADING LINE-SIZE 255.

DATA: BEGIN OF RECORD,

MATNR_001(018),

KZSEL_01_002(001),

MAKTX_003(040),

MEINS_004(003),

MTPOS_MARA_005(004),

BRGEW_006(017),

GEWEI_007(003),

VOLUM_008(017),

VOLEH_009(003),

END OF RECORD.

DATA: ITAB LIKE RECORD OCCURS 0 WITH HEADER LINE.

DATA: IT_BDC TYPE BDCDATA OCCURS 0 WITH HEADER LINE.

*selection screen

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

PARAMETERS: P_FILE TYPE RLGRAP-FILENAME DEFAULT 'c:\vendor.txt'

OBLIGATORY.

SELECTION-SCREEN END OF BLOCK B1.

*start of selection

START-OF-SELECTION.

PERFORM F4_FILENAME USING P_FILE.

PERFORM UP_FILE USING P_FILE.

PERFORM POP_BDC.

&----


*& Form f4_filename

&----


  • text

----


  • -->P_P_FILE text

----


FORM F4_FILENAME USING P_P_FILE.

DATA: L_FILE TYPE IBIPPARMS-PATH.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

PROGRAM_NAME = SYST-CPROG

DYNPRO_NUMBER = SYST-DYNNR

FIELD_NAME = ' '

IMPORTING

FILE_NAME = L_FILE.

P_P_FILE = L_FILE.

ENDFORM. " f4_filename

&----


*& Form up_file

&----


  • text

----


  • -->P_F_FILE text

----


FORM UP_FILE USING P_P_FILE.

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

  • CODEPAGE = ' '

FILENAME = P_P_FILE

FILETYPE = 'DAT'

  • HEADLEN = ' '

  • LINE_EXIT = ' '

  • TRUNCLEN = ' '

  • USER_FORM = ' '

  • USER_PROG = ' '

  • DAT_D_FORMAT = ' '

  • IMPORTING

  • FILELENGTH =

TABLES

DATA_TAB = ITAB

EXCEPTIONS

CONVERSION_ERROR = 1

FILE_OPEN_ERROR = 2

FILE_READ_ERROR = 3

INVALID_TYPE = 4

NO_BATCH = 5

UNKNOWN_ERROR = 6

INVALID_TABLE_WIDTH = 7

GUI_REFUSE_FILETRANSFER = 8

CUSTOMER_ERROR = 9

NO_AUTHORITY = 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.

ENDFORM. " up_file

&----


*& Form pop_bdc

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM POP_BDC .

LOOP AT ITAB INTO RECORD.

PERFORM BDC_DYNPRO USING 'SAPLMGMM' '0060'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'RMMG1-MATNR'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=ENTR'.

PERFORM BDC_FIELD USING 'RMMG1-MATNR'

RECORD-MATNR_001.

PERFORM BDC_DYNPRO USING 'SAPLMGMM' '0070'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'MSICHTAUSW-DYTXT(01)'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=ENTR'.

PERFORM BDC_FIELD USING 'MSICHTAUSW-KZSEL(01)'

RECORD-KZSEL_01_002.

PERFORM BDC_DYNPRO USING 'SAPLMGMM' '4004'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=BU'.

PERFORM BDC_FIELD USING 'MAKT-MAKTX'

RECORD-MAKTX_003.

PERFORM BDC_FIELD USING 'MARA-MEINS'

RECORD-MEINS_004.

PERFORM BDC_FIELD USING 'MARA-MTPOS_MARA'

RECORD-MTPOS_MARA_005.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'MARA-VOLEH'.

PERFORM BDC_FIELD USING 'MARA-BRGEW'

RECORD-BRGEW_006.

PERFORM BDC_FIELD USING 'MARA-GEWEI'

RECORD-GEWEI_007.

PERFORM BDC_FIELD USING 'MARA-VOLUM'

RECORD-VOLUM_008.

PERFORM BDC_FIELD USING 'MARA-VOLEH'

RECORD-VOLEH_009.

CALL TRANSACTION'MM02' USING IT_BDC MODE 'A' UPDATE 'S'.

WRITE:/ SY-SUBRC.

CLEAR IT_BDC.

REFRESH IT_BDC.

ENDLOOP.

ENDFORM. " pop_bdc

&----


*& Form bdc_dynpro

&----


  • text

----


  • -->P_0184 text

  • -->P_0185 text

----


FORM BDC_DYNPRO USING VALUE(P_0184)

VALUE(P_0185).

IT_BDC-PROGRAM = P_0184.

IT_BDC-DYNPRO = P_0185.

IT_BDC-DYNBEGIN = 'X'.

APPEND IT_BDC.

CLEAR IT_BDC.

ENDFORM. " bdc_dynpro

&----


*& Form bdc_field

&----


  • text

----


  • -->P_0189 text

  • -->P_0190 text

----


FORM BDC_FIELD USING VALUE(P_0189)

VALUE(P_0190).

IT_BDC-FNAM = P_0189.

IT_BDC-FVAL = P_0190.

APPEND IT_BDC.

CLEAR IT_BDC.

ENDFORM. " bdc_field

Regards,

Laxmi.

Former Member
0 Kudos

There are two way of doing this:

1. Attach search help which will show values directly from database table (transparent table). For this you have to create elementary or composite search help as explained above. Then you can attached this to selection screen 'select-options' using 'MATCHCODE OBJECT'.

2. You can create dynamic serach help. So this will value from an internal table, using 'F4........' FM, as explained in above mentioned examples.

Hope this helps.

Regards,

Surpreet Bal

Former Member
0 Kudos

Hi Singha,

Here is avery simple example u can refer to...

at selection-screen on value-request for p_atwrt.

perform show_atwrt using p_atwrt 'P_ATWRT'.

FORM show_atwrt using p_code P_FIELD.

data: L_FIELD LIKE HELP_INFO-DYNPROFLD.

TYPES: begin of i_code1 ,

atwrt like ausp-atwrt,

end of i_code1.

DATA : I_CODE TYPE TABLE OF I_CODE1.

DATA: progname TYPE sy-repid,

dynnum TYPE sy-dynnr.

progname = SY-REPID.

DYNNUM = SY-DYNNR.

L_FIELD = P_FIELD.

select distinct atwrt

from ausp

into table i_code

where atinn = gc_source

and klart = gc_001.

if sy-subrc = 0.

delete i_code where atwrt = space.

call function 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'P_ATWRT'

DYNPPROG = progname

DYNPNR = dynnum

DYNPROFIELD = L_FIELD

window_title = 'Source of Supply'

VALUE_ORG = 'S'

TABLES

value_tab = i_code

EXCEPTIONS

parameter_error = 1

no_values_found = 2

others = 3.

if sy-subrc <> 0.

endif.

else.

message S999 with 'No values found'(040).

endif.

ENDFORM. " show_atwrt

Regards,

Kiran B