05-21-2007 10:11 AM
I want to give F4 for a field in the Module Pool.Can someone tell me how to do that??
05-21-2007 10:12 AM
Hi
See this and do any one of as per your requirement
For F4 Values on Screen:
PROCESS ON VALUE_REQUEST
using module call starting with FIELD i.e FIELD field MODULE module
There are 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.
Other FM that may be used to provide input help is HELP_START .
Reward points if useful
Regards
Anji
05-21-2007 10:13 AM
05-21-2007 10:15 AM
hi supriya,
in pbo event AT SELECTION-SCREEN ON VALUE-REQUEST and give required FM for the field.
if helpful reward some points.
with regards,
suresh babu aluri.
05-21-2007 10:15 AM
HI Supriya ,
Please go through the two demo programs and you will be clear with provoding F4 help .
demo_dynpro_f4_help_dynpro
demo_dynpro_f4_help_dictionary
hope this helps ! Revert for further clarificvation if needed !
Regards,
Ranjita
05-21-2007 10:16 AM
Hi,
There are two ways to show F4 help:
1. using itab 2. referring db field:
wite this codes in POV module
samels are as follows:
F4 help using internal table example:
DATA: BEGIN OF LI_FABGRP OCCURS 0,
FABGRP LIKE ZAPO_FABGRP-FABGRP,
BEGDA LIKE ZAPO_FABGRP-BEGDA,
END OF LI_FABGRP.
DATA : T_RETURN TYPE STANDARD TABLE OF DDSHRETVAL WITH HEADER LINE,
L_RETFIELD TYPE DFIES-FIELDNAME.
parameters : S_FABGR like ZAPO_FABGRP-FABGRP.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_FABGR.
SELECT FABGRP BEGDA FROM ZAPO_FABGRP INTO table LI_FABGRP.
SORT LI_FABGRP BY FABGRP ASCENDING BEGDA DESCENDING.
* Henter de mulige fabriksgrupper med nyeste BEGDA *indenfor hver
DELETE ADJACENT DUPLICATES FROM LI_FABGRP COMPARING FABGRP.
L_RETFIELD = 'FABGRP'.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = L_RETFIELD
DYNPPROG = SY-REPID
DYNPNR = '1000'
DYNPROFIELD = 'S_FABGR'
VALUE_ORG = 'S'
MULTIPLE_CHOICE = ' '
TABLES
VALUE_TAB = LI_FABGRP
RETURN_TAB = T_RETURN
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3.
F4 help using field example:
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_FABGR.
CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
EXPORTING
tabname = mara
fieldname = matnr
* SEARCHHELP = ' '
* SHLPPARAM = ' '
* DYNPPROG = ' '
* DYNPNR = ' '
* DYNPROFIELD = ' '
* STEPL = 0
* VALUE = ' '
* MULTIPLE_CHOICE = ' '
* DISPLAY = ' '
* SUPPRESS_RECORDLIST = ' '
* CALLBACK_PROGRAM = ' '
* CALLBACK_FORM = ' '
* SELECTION_SCREEN = ' '
* IMPORTING
* USER_RESET =
* TABLES
* RETURN_TAB =
* EXCEPTIONS
* FIELD_NOT_FOUND = 1
* NO_HELP_FOR_FIELD = 2
* INCONSISTENT_HELP = 3
* NO_VALUES_FOUND = 4
* OTHERS = 5
.
Jogdand M B
05-21-2007 10:17 AM
Hi,
Check the standard programs demo_dynpro_f4_help_dynpro (For the F4 obtained with our program data), demo_dynpro_f4_help_dictionary (For refering to the data dictionary fields) and demo_dynpro_f4_help_module (For the data to be displayed which we filled in an internal table).
05-21-2007 10:23 AM
In the Data Declaration you need to declare an internal table of type DDSHRETVAL.
e.g.
DATA: intab like DDSHRETVAL occurs 0 with header line.
For F4 on a field:
PROCESS ON VALUE-REQUEST
FIELD <field-name> MODULE <module-name>.
Here, <field-name> is the name of the parameter you want to assign F4 help.
<module-name> is a module where you need to write the following code:
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = <value-table field whose value will be displayed in F4>
DYNPPROG = SY-CPROG
DYNPNR = SY-DYNNR
DYNPROFIELD = <screen-field name>
VALUE_ORG = 'S'
TABLES
VALUE_TAB = <value-table>.
RETURN_TAB = internal table of type DDSHRETVAL.
05-21-2007 10:39 AM
Hi,
Check the following code:
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_WERK-LOW.
REFRESH ITEMP.
CLEAR ITEMP.
SELECT WERKS
NAME1
FROM T001W
INTO TABLE ITEMP
WHERE IWERK = 'M011'.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = ' '
RETFIELD = 'WERKS'
PVALKEY = ' '
DYNPPROG = ' '
DYNPNR = ' '
DYNPROFIELD = ' '
STEPL = 0
WINDOW_TITLE =
VALUE = ' '
VALUE_ORG = 'S'
MULTIPLE_CHOICE = ' '
DISPLAY = ' '
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
TABLES
VALUE_TAB = ITEMP
FIELD_TAB =
RETURN_TAB = T_RETURN
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.
S_WERK-LOW = T_RETURN-FIELDVAL.
Hope this helps.
reward if helpful.
Regards,
Sipra