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

MODULE POOL

Former Member
0 Likes
776

CAN ANY BODY GIVE THE CODE ON HOW TO PERFORM <b>ON REQUEST</b> ON TWO INPUT FIELDS

1 ACCEPTED SOLUTION
Read only

former_member673464
Active Contributor
0 Likes
747

hi ,

You can write as follows.

PROCESS ON VALUE-REQUEST.

...

FIELD <f> MODULE <mod>.

...

After the PROCESS ON VALUE-REQUEST statement, you can only use the MODULE statement together with the FIELD statement. When the user chooses F4 for a field <f>, the system calls the module <mod> belonging to the FIELD <f> statement. If there is more than one FIELD statement for the same field <f>, only the first is executed. The module <mod> is defined in the ABAP program like a normal PAI module. However, the contents of the screen field <f> are not available, since it is not transported by the FIELD statement during the PROCESS ON HELP-REQUEST event. You can now program your own value lists in the module.

REPORT DEMO_DYNPRO_F4_HELP_MODULE.

TYPES: BEGIN OF VALUES,

CARRID TYPE SPFLI-CARRID,

CONNID TYPE SPFLI-CONNID,

END OF VALUES.

DATA: CARRIER(3) TYPE C,

CONNECTION(4) TYPE C.

DATA: PROGNAME LIKE SY-REPID,

DYNNUM LIKE SY-DYNNR,

DYNPRO_VALUES TYPE TABLE OF DYNPREAD,

FIELD_VALUE LIKE LINE OF DYNPRO_VALUES,

VALUES_TAB TYPE TABLE OF VALUES.

CALL SCREEN 100.

MODULE INIT OUTPUT.

PROGNAME = SY-REPID.

DYNNUM = SY-DYNNR.

CLEAR: FIELD_VALUE, DYNPRO_VALUES.

FIELD_VALUE-FIELDNAME = 'CARRIER'.

APPEND FIELD_VALUE TO DYNPRO_VALUES.

ENDMODULE.

MODULE CANCEL INPUT.

LEAVE PROGRAM.

ENDMODULE.

MODULE VALUE_CARRIER INPUT.

CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'

EXPORTING

TABNAME = 'DEMOF4HELP'

FIELDNAME = 'CARRIER1'

DYNPPROG = PROGNAME

DYNPNR = DYNNUM

DYNPROFIELD = 'CARRIER'.

ENDMODULE.

MODULE VALUE_CONNECTION INPUT.

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 CARRID CONNID

FROM SPFLI

INTO CORRESPONDING FIELDS OF TABLE VALUES_TAB

WHERE CARRID = FIELD_VALUE-FIELDVALUE.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

RETFIELD = 'CONNID'

DYNPPROG = PROGNAME

DYNPNR = DYNNUM

DYNPROFIELD = 'CONNECTION'

VALUE_ORG = 'S'

TABLES

VALUE_TAB = VALUES_TAB.

ENDMODULE.

The screen flow logic is as follows:

PROCESS BEFORE OUTPUT.

MODULE INIT.

PROCESS AFTER INPUT.

MODULE CANCEL AT EXIT-COMMAND.

PROCESS ON VALUE-REQUEST.

FIELD CARRIER MODULE VALUE_CARRIER.

FIELD CONNECTION MODULE VALUE_CONNECTION.

regards,

veeresh

6 REPLIES 6
Read only

Former Member
0 Likes
747

hi,

PROCESS ON HELP-REQUEST

This event is fired when the user presses F1 key.

PROCESS ON VALUE-REQUEST

This event is fired when the user presses F4 key.

regards,

keerthi

Read only

Former Member
0 Likes
747

Satessh,

Conditions for Single Screen Fields

You can ensure that a PAI module is only called when a certain condition applies by using the following statement:

FIELD <f> MODULE <mod> ON INPUT|REQUEST|*-INPUT.

The additions have the following effects:

• ON INPUT

The ABAP module is called only if the field contains a value other than its initial value. This initial value is determined by the data type of the field: Space for character fields, zero for numeric fields. Even if the user enters the initial value of the screen as the initial value, the module is not called. (ON REQUEST, on the other hand, does trigger the call in this case.)

• ON REQUEST

The module <mod> is only called if the user has entered something in the field. This includes cases when the user overwrites an existing value with the same value, or explicitly enters the initial value.

In general, the ON REQUEST condition is triggered through any form of "manual input". As well as user input, the following additional methods of entering values also call the module:

• The element attribute PARAMETER-ID (SPA/GPA parameters).

• The element attribute HOLD DATA

• CALL TRANSACTION ... USING

• Automatic settings of particular global fields

• ON *-INPUT

The ABAP module is called if the user has entered a "*" in the first character of the field, and the field has the attribute *-entry in the Screen Painter. When the input field is passed to the program, the * is removed. * behaves like an initial field in the ON INPUT condition.

The functions of the FIELD statement for controlling data transport also apply when you use MODULE.

*********************************

PROGRAM DEMO_DYNPRO_ON_CONDITION.

DATA: OK_CODE LIKE SY-UCOMM,

INPUT1(20), INPUT2(20), INPUT3(20),

FLD(20).

CALL SCREEN 100.

MODULE INIT_SCREEN_100 OUTPUT.

SET PF-STATUS 'STATUS_100'.

ENDMODULE.

MODULE CANCEL INPUT.

LEAVE PROGRAM.

ENDMODULE.

MODULE CURSOR INPUT.

GET CURSOR FIELD FLD.

MESSAGE I888(BCTRAIN) WITH TEXT-001 FLD.

ENDMODULE.

MODULE MODULE_1 INPUT.

MESSAGE I888(BCTRAIN) WITH TEXT-002.

ENDMODULE.

MODULE MODULE_2 INPUT.

MESSAGE I888(BCTRAIN) WITH TEXT-003.

ENDMODULE.

MODULE MODULE_* INPUT.

MESSAGE I888(BCTRAIN) WITH TEXT-004 INPUT3.

ENDMODULE.

MODULE C1 INPUT.

MESSAGE I888(BCTRAIN) WITH TEXT-005 '1'.

ENDMODULE.

MODULE C2 INPUT.

MESSAGE I888(BCTRAIN) WITH TEXT-005 '2' TEXT-006 '3'.

ENDMODULE.

The screen fields INPUT1, INPUT2, and INPUT3 are assigned to the input fields. The function code of the pushbutton is EXECUTE.

In the GUI status STATUS_100, the icon (F12) is active with function code CANCEL and function type E. The function key F2 is also active with function code CS and function type S. The F8 key is active with the function code EXECUTE and no special function type.

The screen flow logic is as follows:

PROCESS BEFORE OUTPUT.

MODULE INIT_SCREEN_100.

PROCESS AFTER INPUT.

MODULE CANCEL AT EXIT-COMMAND.

CHAIN.

FIELD: INPUT1, INPUT2.

MODULE MODULE_1 ON CHAIN-INPUT.

FIELD INPUT3 MODULE MODULE_* ON *-INPUT.

MODULE MODULE_2 ON CHAIN-REQUEST.

ENDCHAIN.

FIELD INPUT1 MODULE C1 AT CURSOR-SELECTION.

CHAIN.

FIELD: INPUT2, INPUT3.

MODULE C2 AT CURSOR-SELECTION.

ENDCHAIN.

MODULE CURSOR AT CURSOR-SELECTION.

*********************************

Instead of on INPUT put ON REQUEST.

Pls. reward if useful

Read only

Former Member
0 Likes
747

Hi Sateesh,

Here it is the sample performs for u

IN SE51

PROCESS ON VALUE-REQUEST.

FIELD S-POS MODULE F4_POSITION.

FIELD S-POS2 MODULE F4_POSITION2.

IN SE38:

Module F4_POSITION.

call function for value request...............................

..................................................

...................................

Hope this helps you and reply for any queries.

Regards,

kumar.

Read only

Former Member
0 Likes
747

See the following sample code.

PROCESS ON VALUE-REQUEST.

FIELD ZSDRBT_INELG_INV-ZAPPR1_STA MODULE DLIST.

FIELD ZSDRBT_INELG_INV-ZAPPR2_STA MODULE DLIST1.

&----


*& Module DLIST INPUT

&----


  • text

----


MODULE DLIST INPUT.

DATA: l_input(1).

clear l_input.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

  • DDIC_STRUCTURE = ' '

RETFIELD = 'HL'

  • PVALKEY = ' '

DYNPPROG = 'ZSD_RBT_DEVIATION_PRS'

DYNPNR = '0200'

DYNPROFIELD = 'ZSDRBT_INELG_INV-ZAPPR1_STA'

  • STEPL = 0

WINDOW_TITLE = 'Input'

  • VALUE = ' '

VALUE_ORG = 'S'

  • MULTIPLE_CHOICE = ' '

DISPLAY = l_input

  • CALLBACK_PROGRAM = ' '

  • CALLBACK_FORM = ' '

  • MARK_TAB =

  • IMPORTING

  • USER_RESET =

TABLES

VALUE_TAB = ITAB

  • FIELD_TAB =

RETURN_TAB = IT_RET

  • DYNPFLD_MAPPING =

  • EXCEPTIONS

  • PARAMETER_ERROR = 1

  • NO_VALUES_FOUND = 2

  • OTHERS = 3

.

if sy-subrc = 0.

  • if BM_APP1 <> 'C'.

read table it_ret index 1.

move it_ret-fieldval to ZSDRBT_INELG_INV-ZAPPR1_STA.

  • endif.

endif.

*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. " DLIST INPUT

&----


*& Module DLIST1 INPUT

&----


  • text

----


MODULE DLIST1 INPUT.

DATA: l_input1(1).

clear l_input1.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

  • DDIC_STRUCTURE = ' '

RETFIELD = 'HL'

  • PVALKEY = ' '

DYNPPROG = 'ZSD_RBT_DEVIATION_PRS'

DYNPNR = '0200'

DYNPROFIELD = 'ZSDRBT_INELG_INV-ZAPPR2_STA'

  • STEPL = 0

WINDOW_TITLE = 'Input'

  • VALUE = ' '

VALUE_ORG = 'S'

  • MULTIPLE_CHOICE = ' '

DISPLAY = l_input1

  • CALLBACK_PROGRAM = ' '

  • CALLBACK_FORM = ' '

  • MARK_TAB =

  • IMPORTING

  • USER_RESET =

TABLES

VALUE_TAB = ITAB

  • FIELD_TAB =

RETURN_TAB = IT_RET

  • DYNPFLD_MAPPING =

  • EXCEPTIONS

  • PARAMETER_ERROR = 1

  • NO_VALUES_FOUND = 2

  • OTHERS = 3

.

if sy-subrc = 0.

  • if BM_APP1 <> 'C'.

read table it_ret index 1.

move it_ret-fieldval to ZSDRBT_INELG_INV-ZAPPR1_STA.

  • endif.

endif.

*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. " DLIST1 INPUT

Read only

Former Member
0 Likes
747

1) for procees on help request .

field wa_header-NETPRICE module help_currency .

2) process on value request .

field wa_header-NETPRICE module value_currency .

3) for validation purposes the on request used is as follows .

a) using chain end chain

CHAIN.

FIELD IT_LIST-EBELP.

FIELD IT_LIST-MATNR.

FIELD IT_LIST-MENGE.

FIELD IT_LIST-MEINS.

FIELD IT_LIST-NETPR.

FIELD IT_LIST-WAERS.

FIELD IT_LIST-NETVAL.

FIELD IT_LIST-currency1.

MODULE validate_matnr ON CHAIN-REQUEST.

ENDCHAIN.

b) for single field editable purposes .

FIELD WA_HEADER-ccode MODULE validate_ccode ON REQUEST.

hope this helps

Navjot sharma

reward points if helpfull

Read only

former_member673464
Active Contributor
0 Likes
748

hi ,

You can write as follows.

PROCESS ON VALUE-REQUEST.

...

FIELD <f> MODULE <mod>.

...

After the PROCESS ON VALUE-REQUEST statement, you can only use the MODULE statement together with the FIELD statement. When the user chooses F4 for a field <f>, the system calls the module <mod> belonging to the FIELD <f> statement. If there is more than one FIELD statement for the same field <f>, only the first is executed. The module <mod> is defined in the ABAP program like a normal PAI module. However, the contents of the screen field <f> are not available, since it is not transported by the FIELD statement during the PROCESS ON HELP-REQUEST event. You can now program your own value lists in the module.

REPORT DEMO_DYNPRO_F4_HELP_MODULE.

TYPES: BEGIN OF VALUES,

CARRID TYPE SPFLI-CARRID,

CONNID TYPE SPFLI-CONNID,

END OF VALUES.

DATA: CARRIER(3) TYPE C,

CONNECTION(4) TYPE C.

DATA: PROGNAME LIKE SY-REPID,

DYNNUM LIKE SY-DYNNR,

DYNPRO_VALUES TYPE TABLE OF DYNPREAD,

FIELD_VALUE LIKE LINE OF DYNPRO_VALUES,

VALUES_TAB TYPE TABLE OF VALUES.

CALL SCREEN 100.

MODULE INIT OUTPUT.

PROGNAME = SY-REPID.

DYNNUM = SY-DYNNR.

CLEAR: FIELD_VALUE, DYNPRO_VALUES.

FIELD_VALUE-FIELDNAME = 'CARRIER'.

APPEND FIELD_VALUE TO DYNPRO_VALUES.

ENDMODULE.

MODULE CANCEL INPUT.

LEAVE PROGRAM.

ENDMODULE.

MODULE VALUE_CARRIER INPUT.

CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'

EXPORTING

TABNAME = 'DEMOF4HELP'

FIELDNAME = 'CARRIER1'

DYNPPROG = PROGNAME

DYNPNR = DYNNUM

DYNPROFIELD = 'CARRIER'.

ENDMODULE.

MODULE VALUE_CONNECTION INPUT.

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 CARRID CONNID

FROM SPFLI

INTO CORRESPONDING FIELDS OF TABLE VALUES_TAB

WHERE CARRID = FIELD_VALUE-FIELDVALUE.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

RETFIELD = 'CONNID'

DYNPPROG = PROGNAME

DYNPNR = DYNNUM

DYNPROFIELD = 'CONNECTION'

VALUE_ORG = 'S'

TABLES

VALUE_TAB = VALUES_TAB.

ENDMODULE.

The screen flow logic is as follows:

PROCESS BEFORE OUTPUT.

MODULE INIT.

PROCESS AFTER INPUT.

MODULE CANCEL AT EXIT-COMMAND.

PROCESS ON VALUE-REQUEST.

FIELD CARRIER MODULE VALUE_CARRIER.

FIELD CONNECTION MODULE VALUE_CONNECTION.

regards,

veeresh