‎2009 Feb 09 1:00 PM
hello,
i have 3 fields(no_days, no_days_for_config, no_days_for_test ) in which i have retrieved values from a table, in the table the values are of char type... i want to do addition of the values of those fields and display the result(total_days) on the same screen...
1. will i be able to perform addition as their datatype is char?
2. if i can, how?
‎2009 Feb 09 1:39 PM
i have added the values, but how to display the value on the screen.
i have declared total_days in the layout, it is an input/output field...
total_days = no_days + no_days_for_config + no_days_for_test .
doing this did no display the value on the screen...
thx
‎2009 Feb 09 1:03 PM
‎2009 Feb 09 1:03 PM
Hi
yes you can perform the addition on the data type char.
just add the fields of the table
ie., itab-total_days = itab-no_days + itab-no.of_days_for_config + itab-no_days_for_test.
thanks,
sarves
‎2009 Feb 09 1:04 PM
Hi,
There will be no problem in adding the char field.
Ex
DATA : char1 type char10 VALUE '4'.
DATA : char2 type char10 VALUE '5'.
DATA : char3 type char10.
Char3 = char1 + char2.Char3 will have 9
‎2009 Feb 09 1:04 PM
Hi,
Yes, it is possible...
add the values and pass it to another variable and display it.
result = no_days+ no_days_for_config +no_days_for_test.
Regards,
Pavan
‎2009 Feb 09 1:07 PM
Hi ,
You can add char typed data objects in another char typed data object.
Or else ...
You can create those fields prog. typed with data type n and length same as in dictionary and
do the addition .
It will work.
Regards
Pinaki
Edited by: Pinaki Mukherjee on Feb 9, 2009 2:15 PM
‎2009 Feb 09 1:09 PM
hi,
Declare these variables in top include
data : no_days(6) type c,
no_days_for_config(6) type c,
no_days_for_test(6) type c,
total_days(6) type c.Define another field on the screen for total and name it as total_days.
" Define a pushbuton on ur screen. set attributes as button name = 'ADD',
" function code = 'ADD'.in flow logic
PROCESS BEFORE OUTPUT.
MODULE status_2002.
PROCESS AFTER INPUT.
MODULE Add. "----------------> double cclick on this module-
i
*&---------------------------------------------------------------------*
*& MODULE Add. INPUT
*&---------------------------------------------------------------------*
.
if sy-ucom = 'ADD'.
total_days = no_days + no_days_for_config + no_days_for_test .
endif.
.Thanks & Regards
Edited by: Always Learner on Feb 9, 2009 2:55 PM
‎2009 Feb 09 1:39 PM
i have added the values, but how to display the value on the screen.
i have declared total_days in the layout, it is an input/output field...
total_days = no_days + no_days_for_config + no_days_for_test .
doing this did no display the value on the screen...
thx
‎2009 Feb 09 2:03 PM
HI,
Use CONDENSE total_days. after calculation.
Check in debugg mode if data comming in the debug mode or not