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: 

I want an example for event Process on Value-request in Module Pool

Former Member
0 Kudos

Hi,

I need to populate f4 values for a field in module pool program under POV event.

Can anyone send me the sample code.

Helpful answers will be rewarded .

Thanks and Regards

Aditya

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Sai,

In Flow Logic write this code,

PROCESS ON VALUE-REQUEST.

FIELD CURRENCY1 MODULE BOX.

Then In SE38,

DATA : CURRENCY1 LIKE ZCUREN-CURRENCY.

DATA: IT_BOX LIKE TABLE OF WA_BOX WITH HEADER LINE.

MODULE BOX INPUT.

SELECT CURRENCY FROM ZCUREN INTO CORRESPONDING FIELDS OF TABLE IT_BOX.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

RETFIELD = 'CURRENCY'

VALUE_ORG = 'S'

TABLES

VALUE_TAB = IT_BOX

EXCEPTIONS

PARAMETER_ERROR = 1

NO_VALUES_FOUND = 2

OTHERS = 3.

ENDMODULE. " BOX INPUT

Thanks,

Reward If Helpful.

6 REPLIES 6

Former Member
0 Kudos

Hi

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

0 Kudos

Hi ,

My requirement is I have a table control and for the first field If I press F4 I need to display the values.

I have declared an internal table ITAB. and for the field say RULEID I need to get the values.

So when I write Field Itab-RuleID Module F4_FOR_RULEID.

Its saying INPUT/OUTPUT field ITAB-RULEID not defined. Can you please help.

Thanks

Aditya

Former Member
0 Kudos

Hi Sai,

In Flow Logic write this code,

PROCESS ON VALUE-REQUEST.

FIELD CURRENCY1 MODULE BOX.

Then In SE38,

DATA : CURRENCY1 LIKE ZCUREN-CURRENCY.

DATA: IT_BOX LIKE TABLE OF WA_BOX WITH HEADER LINE.

MODULE BOX INPUT.

SELECT CURRENCY FROM ZCUREN INTO CORRESPONDING FIELDS OF TABLE IT_BOX.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

RETFIELD = 'CURRENCY'

VALUE_ORG = 'S'

TABLES

VALUE_TAB = IT_BOX

EXCEPTIONS

PARAMETER_ERROR = 1

NO_VALUES_FOUND = 2

OTHERS = 3.

ENDMODULE. " BOX INPUT

Thanks,

Reward If Helpful.

0 Kudos

Thanks for the example.

I wrote in the flow logic

FIELD ITAB-FNAME MODULE F4_FNAME.

when I try to check the syntax it says that I have Input/Output filed ITAB-FNAME is not defined.

So should I declare the field FNAME in the SE38 program.

In your example u have written

FIELD CURRENCY1 MODULE BOX.

Then In SE38,

DATA : CURRENCY1 LIKE ZCUREN-CURRENCY.

DATA: IT_BOX LIKE TABLE OF WA_BOX WITH HEADER LINE.

May be thats for a single field. But for me I have a table control and when I say F4 pressing on the field FNAME in the table control I have to show a popup of some F4 values.

So in the flow logic what will be my syntax and how will I declare in the SE38 program.

Thanks

0 Kudos

Hi,

Do I need to write like this

Loop at Itab.

Field FNAME MODULE MNAME.

Endloop.

I have FNAME as the first field in the table control.So when I press F4 in the 1st row or 2nd row or 3rd row of the field I need to get some F4 values.

So does the above code needs to be written as I have to get F4 for a field in tha table control?

Can anyone clear me.Thanks

Former Member
0 Kudos

Hi,

check the standard program

DEMO_DYNPRO_F4_HELP_MODULE