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

problem in screen painter

Former Member
0 Likes
905

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?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
881

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

8 REPLIES 8
Read only

Former Member
0 Likes
881

Convert them into number type and then do the addition

Read only

Former Member
0 Likes
881

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

Read only

Former Member
0 Likes
881

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

Read only

Former Member
0 Likes
881

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

Read only

Former Member
0 Likes
881

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

Read only

Mohamed_Mukhtar
Active Contributor
0 Likes
881

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

Read only

Former Member
0 Likes
882

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

Read only

0 Likes
881

HI,

Use CONDENSE total_days. after calculation.

Check in debugg mode if data comming in the debug mode or not