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

Sum calculation

Former Member
0 Likes
431

Hi Experts,

Please advice,

I am having three fields in output 1 is directly fetched from table and other two are variables.

ITAB-MENGE = fetched data.

ITAB-UCOMM = input on ( user command )

when the user press ENTER

ITAB-SUM = ITAB-MENGE + ITAB-UCOMM.

For eq:

Suppose if ITAB-MENGE which is fetched from table = 100

and if the user enters the value in ITAB-UCOMM = 200

and when the user press enter the sum should display on the other field ITAB-SUM

Note: I am using normal write statement ( not ALV ) & there is no need of saving option.

Thanks

R.Karthik

2 REPLIES 2
Read only

Former Member
0 Likes
367
" ist enter the value in first field and do not press enter.
" Then place cursor on second input and write value. then press enter
" u can change code according to ur desire
SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-001 .

SELECTION-SCREEN COMMENT 1(35) text1.
PARAMETERS: pmenge type i.
SELECTION-SCREEN COMMENT 50(1) text2 .
PARAMETERS: pucomm TYPE i MODIF ID dpt.
PARAMETERS: psum TYPE i MODIF ID dpt.


SELECTION-SCREEN END OF BLOCK a.

INITIALIZATION.
  text1 = 'Please Enter the values'.

AT SELECTION-SCREEN OUTPUT.

  IF pmenge IS INITIAL.
    pmenge = ''.
    pucomm = ''.
    psum = ''.
  ELSE.
    pmenge = pmenge.
    pucomm = pucomm.
    psum = pucomm + pmenge.


  ENDIF.
Read only

Former Member
0 Likes
367

Hi karthik,

Your query is ambiguous. Still I am answering as per my understanding.

Let say you are selecting MENGE from database table.

And you have UCOMM as parameter in selection screen.

So if ITAB has following values,

100

200

300

400

and UCOMM = 20

then

data : begin of itab occurs 0,

menge type menge,

tot(10) type c ,

end of itab.

***already you selcetd data in ITAB

loop at itab.

itab-tot = itab-menge + p_ucomm.

modify itab transporting tot.

endloop.

Hope this helps you.

Regards,

Anil