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

In Dialog screen auto insert calculated value

Former Member
0 Likes
778

Hi friends,

i want to do is when user selects a value in a field based on search help, i want to fetch record from database and want to do some arithmetic calculation then i want to display result automaticaly in second field.

Can any budy help me.

Thank you

Regards,

Virat

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
566

hi,

so for one field u r using search help i.e pov for that field.

for suppose this pov for that field have some module field_pov. in that module only u do arithmetic calculation for the second field. some u select one value for field one and this calcualation will takes place and then pbo will be trigged then that result of the second field will automatically displayed.

make sure that u declare a data varible in that module with the same name of the second field.

i think this will help u.

3 REPLIES 3
Read only

Former Member
0 Likes
567

hi,

so for one field u r using search help i.e pov for that field.

for suppose this pov for that field have some module field_pov. in that module only u do arithmetic calculation for the second field. some u select one value for field one and this calcualation will takes place and then pbo will be trigged then that result of the second field will automatically displayed.

make sure that u declare a data varible in that module with the same name of the second field.

i think this will help u.

Read only

0 Likes
566

<b>for that screen after pbo and pai write this pov</b>

PROCESS ON VALUE-REQUEST.

FIELD field1 MODULE VALUE_field1.

<b>this code in ur report</b>

MODULE VALUE_field1 INPUT.

<b>" here u declare that field2</b>

data field2 type i.

SELECT Receiver logsys descr

FROM ZGI_LISYS

INTO CORRESPONDING FIELDS OF TABLE VALUES_TAB.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

RETFIELD = 'RECEIVER'

DYNPPROG = PROGNAME

DYNPNR = DYNNUM

DYNPROFIELD = 'S_SAPSYS'

VALUE_ORG = 'S'

TABLES

VALUE_TAB = VALUES_TAB.

"<b>this function module for f4 help.</b>

"here write select query and fetch field2 value.

"write that logic here once u select the field1 value by using f4 help later through "ur logic field2 always gets the value and pbo will be triggered so that both field1 and field2 will have values.

ENDMODULE. " VALUE_field INPUT

check this if useful

Read only

Former Member
0 Likes
566

Hi Virat,

make your own F4 like this:

TABLES: SCUSTOM.

TABLES: MARA, MAKT.

*

*

SELECTION-SCREEN: BEGIN OF LINE.

SELECTION-SCREEN: COMMENT 01(33) T_MATNR.

PARAMETERS: P_MATNR LIKE MARA-MATNR.

SELECTION-SCREEN: COMMENT 60(30) T_MAKTX.

SELECTION-SCREEN: END OF LINE.

*

DATA: DYNFIELDS TYPE TABLE OF DYNPREAD WITH HEADER LINE.

*

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_MATNR.

*

DATA: DYNFIELDS TYPE TABLE OF DYNPREAD WITH HEADER LINE.

*

DATA: RETURN_TAB TYPE TABLE OF DDSHRETVAL WITH HEADER LINE.

DATA: X_MATNR LIKE MARA-MATNR.

*

CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'

EXPORTING

TABNAME = 'MARA'

FIELDNAME = 'MATNR'

TABLES

RETURN_TAB = RETURN_TAB.

*

READ TABLE RETURN_TAB INDEX 1.

CHECK SY-SUBRC = 0.

*

DYNFIELDS-FIELDNAME = 'P_MATNR'.

WRITE RETURN_TAB-FIELDVAL TO DYNFIELDS-FIELDVALUE.

APPEND DYNFIELDS.

*

  • Here you can do what you want!!!!

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = DYNFIELDS-FIELDVALUE

IMPORTING

OUTPUT = X_MATNR.

*

DYNFIELDS-FIELDNAME = 'T_MAKTX'.

SELECT SINGLE * FROM MAKT WHERE SPRAS = SY-LANGU

AND MATNR = X_MATNR.

WRITE MAKT-MAKTX TO DYNFIELDS-FIELDVALUE.

APPEND DYNFIELDS.

*

CALL FUNCTION 'DYNP_VALUES_UPDATE'

EXPORTING

DYNAME = SY-REPID

DYNUMB = SY-DYNNR

TABLES

DYNPFIELDS = DYNFIELDS.

*

initialization.

*

T_MATNR = 'Materialnummer:'.

T_MAKTX = SPACE.

Regards, Dieter