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 HELP for fields in different tabs

Former Member
0 Likes
2,150

hi,

i have 3 tabs namely main,item,options.

In main tab,i have 3 fields like customer etc for them i have to create f4.

how to create f4??

Thanks

Sri

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,361

Hi,

Check the Demo program

DEMO_DYNPRO_F1_HELP

DEMO_DYNPRO_F4_HELP_DICTIONARY

DEMO_DYNPRO_F4_HELP_DYNPRO

DEMO_DYNPRO_F4_HELP_MODULE

hi,

i have 3 tabs namely main,item,options.

In main tab,i have 3 fields like customer etc for them i have to create f4.

how to create f4??

Thanks

Sri

5 REPLIES 5
Read only

Former Member
0 Likes
1,362

Hi,

Check the Demo program

DEMO_DYNPRO_F1_HELP

DEMO_DYNPRO_F4_HELP_DICTIONARY

DEMO_DYNPRO_F4_HELP_DYNPRO

DEMO_DYNPRO_F4_HELP_MODULE

Read only

Former Member
0 Likes
1,361

Hi Sri

Use the FM F4IF_INT_TABLE_VALUE_REQUEST in the event AT SELECTION-SCREEN ON VALUE-REQUEST FOR <sel parameter>.


  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
     retfield               = 'KUNNR'
     dynpprog               = sy-repid
     dynpnr                 = sy-dynnr
     dynprofield            = S_KUNNR'
     value_org              = 'S'
    TABLES
      value_tab             = li_f4_kunnr
    EXCEPTIONS
      parameter_error       = 1
      no_values_found       = 2
      others                = 3.
  IF sy-subrc NE 0.
  ENDIF.

Fill li_f4_kunnr with the values for kunnr.

Thanks

Pushpraj

Read only

0 Likes
1,361

i have to provide f4 for the fields in module pool screen not in the selection-screen.

Read only

Former Member
0 Likes
1,361

Hi Sri,

Suppose your field name is : wa_lic_scs-lic_typ

After PAI you need to write a code like this. This will surely help you.

PROCESS ON VALUE-REQUEST.

  • This provides the F4 help for the field - License Type

FIELD wa_lic_scs-lic_typ MODULE f4_help_scs.

Now Module f4_help_scs.

&----


*& Module : f4_help_scs INPUT *

&----


*& Description : F4 Help for License Type *

&----


MODULE f4_help_scs INPUT.

PERFORM f4_help.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'GEART'

dynpprog = sy-repid

dynpnr = sy-dynnr

dynprofield = 'WA_LIC_SCS-LIC_TYP'

value_org = 'S'

TABLES

value_tab = t_lic

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.

ENDMODULE. " f4_help_scs INPUT

&----


*& Form Name : f4_help *

&----


*& Description : To provide F4 help *

&----


*& Parameters : None *

&----


FORM f4_help .

CLEAR wa_dynfields.

*-- FM to track current line index in the table control

*-- Begin of M-RD1K921052

CALL FUNCTION 'DYNP_GET_STEPL'

IMPORTING

povstepl = w_dynindex

EXCEPTIONS

stepl_not_found = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

*-- End of M-RD1K921052

*--To focus on the required row of the control table.

wa_dynfields-stepl = w_dynindex.

*--With the help of flags assign the field names dynamically.

IF w_flag_ct = c_flag_x.

wa_dynfields-fieldname = c_wa_lic_ct.

ELSEIF w_flag_scs = c_flag_x.

wa_dynfields-fieldname = c_wa_lic_scs.

ELSEIF w_flag_scsct = c_flag_x.

wa_dynfields-fieldname = c_wa_lic_scsct.

ELSEIF w_flag_cust = c_flag_x.

wa_dynfields-fieldname = c_wa_lic_cust.

ELSEIF w_flag_scsc = c_flag_x.

wa_dynfields-fieldname = c_wa_lic_scsc.

ELSE.

wa_dynfields-fieldname = c_wa_std_table.

ENDIF.

*--Populate the below table for fieldname and row number.

APPEND wa_dynfields TO t_dynfields.

*--This function module Read field contents on screen.

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

dyname = sy-repid

dynumb = sy-dynnr

translate_to_upper = 'X'

TABLES

dynpfields = t_dynfields

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 the row to check if anything entered in the field

*--Before giving F4 help.

CLEAR wa_dynfields.

READ TABLE t_dynfields INTO wa_dynfields

WITH KEY stepl = w_dynindex.

IF sy-subrc EQ 0 AND NOT wa_dynfields-fieldvalue IS INITIAL.

*--Fetch the data for entered values.

SELECT geart FROM t606 INTO TABLE t_lic

WHERE gegru = wa_dynfields-fieldvalue.

IF sy-subrc EQ 0.

SORT t_lic BY geart.

DELETE ADJACENT DUPLICATES FROM t_lic.

ENDIF.

ELSE.

*--Nothing is entered on the screen, fetch all the data from DB.

SELECT geart FROM t606 INTO TABLE t_lic.

IF sy-subrc NE 0.

MESSAGE s999(zz) DISPLAY LIKE 'W' WITH text-t22.

ENDIF.

ENDIF.

ENDFORM. " f4_help

Regards,

Amit.

Read only

Former Member
0 Likes
1,361

Hii,

Check out these different ways...for creating Input Helps.

Input help can be programmed in selection screen using event

AT SELECTION-SCREEN ON VALUE-REQUEST FOR FIELD and for module pools in event

PROCESS ON VALUE_REQUEST using module call starting with FIELD

i.e FIELD field MODULE module

There ar number of function modules that can be used for the purpose, but these

can fullfill the task easily or combination of them.

DYNP_VALUE_READ

F4IF_FIELD_VALUE_REQUEST

F4IF_INT_TABLE_VALUE_REQUEST

POPUP_WITH_TABLE_DISPLAY

DYNP_VALUE_READ

This function module is used to read values in the screen fields. Use of this

FM causes forced transfer of data from screen fields to ABAP fields.

There are 3 exporting parameters

DYNAME = program name = SY-CPROG

DYNUMB = Screen number = SY-DYNNR

TRANSLATE_TO_UPPER = 'X'

and one importing TABLE parameter

DYNPFIELDS = Table of TYPE DYNPREAD

The DYNPFIELDS parameter is used to pass internal table of type DYNPREAD

to this FM and the values read from the screen will be stored in this table.This

table consists of two fields:

FIELDNAME : Used to pass the name of screen field for which the value is to

be read.

FIELDVALUE : Used to read the value of the field in the screen.

e.g.

DATA: SCREEN_VALUES TYPE TABLE OF DYNPREAD ,

SCREEN_VALUE LIKE LINE OF SCREEN_VALUES.

SCREEN_VALUE-FIELDNAME = 'KUNNR' . * Field to be read

APPEND SCREEN_VALUE TO SCREEN_VALUES. * Fill the table

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

DYNAME = SY-CPROG

DYNUMB = SY-DYNNR

TRANSLATE_TO_UPPER = 'X'

TABLES

DYNPFIELDS = SCREEN_VALUES.

READ TABLE SCREEN_VALUES INDEX 1 INTO SCREEN_VALUE.Now the screen value for field KUNNR is in the SCREEN_VALUE-FIELDVALUE and can be used for further processing like using it to fill the internal table to be used as parameter in F4IF_INT_TABLE_VALUE_REQUEST ETC.

F4IF_FIELD_VALUE_REQUEST

This FM is used to display value help or input from ABAP dictionary.We have to pass the name of the structure or table(TABNAME) along with the field name(FIELDNAME) . The selection can be returned to the specified screen field if three

parameters DYNPNR,DYNPPROG,DYNPROFIELD are also specified or to a table if RETRN_TAB is specified.

CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'

EXPORTING

TABNAME = table/structure

FIELDNAME = 'field name'

DYNPPROG = SY-CPROG

DYNPNR = SY-DYNR

DYNPROFIELD = 'screen field'

IMPORTING

RETURN_TAB = table of type DYNPREAD

.

F4IF_INT_TABLE_VALUE_REQUEST

This FM is used to dsiplay values stored in an internal table as input

help.This FM is used to program our own custom help if no such input help

exists in ABAP dictionary for a particular field. The parameter VALUE_TAB is used to pass the internal table containing input values.The parameter RETFIELD

is used to specify the internal table field whose value will be returned to the screen field or RETURN_TAB.

If DYNPNR,DYNPPROG and DYNPROFIELD are specified than the user selection is passed to the screen field specified in the DYNPROFIELD. If RETURN_TAB is specified the selectionis returned in a table.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

RETFIELD = field from int table whose value will be returned

DYNPPROG = SY-CPROG

DYNPNR = SY-DYNNR

DYNPROFIELD = 'screen field'

VALUE_ORG = 'S'

TABLES

VALUE_TAB = internal table whose values will be shown.

RETURN_TAB = internal table of type DDSHRETVAL

EXCEPTIONS

parameter_error = 1

no_values_found = 2

others = 3.

POPUP_WITH_TABLE_DISPLAY

This FM is used to display the contents of an internal table in a popup window.The user can select a row and the index of that is returned in the CHOISE

parameter.The VALUETAB is used to pass the internal table.

A suitable title can be set using TITLETEXT parameter. The starting and end position of the popup can be specified by the parameters STARTPOS_COL / ROW and ENDPOS_ROW / COL .

CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'

EXPORTING

ENDPOS_COL =

ENDPOS_ROW =

STARTPOS_COL =

STARTPOS_ROW =

TITLETEXT = 'title text'

IMPORTING

CHOISE =

TABLES

VALUETAB =

EXCEPTIONS

BREAK_OFF = 1

OTHERS = 2.

e.g.

DATA: w_choice TYPE SY-TABIX.

DATA: BEGIN OF i_values OCCURS 0 WITH HEADER LINE,

values TYPE I,

END OF i_values.

PARAMETRS : id TYPE I.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR id

i_values-values = '0001'.

APPEND i_values.

i_values-values = '0002'.

APPEND i_values.

i_values-values = '0003'.

APPEND i_values.

i_values-values = '0004'.

APPEND i_values.

CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'

EXPORTING

ENDPOS_COL = 40

ENDPOS_ROW = 12

STARTPOS_COL = 20

STARTPOS_ROW = 5

TITLETEXT = 'Select an ID'

IMPORTING

CHOISE = w_choice

TABLES

VALUETAB = i_values

EXCEPTIONS

BREAK_OFF = 1

OTHERS = 2.

CHECK w_choice > 0.

READ TABLE i_values INDEX w_choice.

...now we can process the selection as it is contained

...in the structure i_values.

Hope this is Helpful,

Regards,

Sandy.