Application Development 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: 

trouble in summing with char...

Former Member
0 Kudos

Dear friends,

I report programing i want to add totals in left hand side

and at bottom.but the quantity to which i hve to add having character like ND there.

system is showing short dump error we cant add numbers with char.can u give some solutions.

regards

veera

12 REPLIES 12

Former Member
0 Kudos

Hi Veera,

you can do the arithmetic calculations only for numeric fields...

Regards,

Vidya.

0 Kudos

hi vidya

but iam having char in my display...

hw to solve..

regards

veera

Former Member
0 Kudos

hi Veera,

declare the field that you are declaring it as char as type N or I....

<b>in that case do this way .. do all the arithematic caluclations that you wnat to do and put them in to I or N variable and then move them in to type C and print ..</b>

Regards,

Santosh

Message was edited by: Santosh Kumar P

0 Kudos

hi santosh

but the field having both nume and char in my itab...

regards

veera

0 Kudos

do all the arethimatic calculatiosn and store in some temporary I or N variables and then finally when you display them move them on to char variables...

0 Kudos

Hi,

use an numeric type field and then move your value in character variable to this numeric field and then do the calculations.

if you have only numeric and without decimals,

use I or N.

DATA : V_INT type I.

v_int = v_char .

then use V_INT in your calculations

Regards

Srikanth

0 Kudos

hi

thanks for replying...

i have in final itab char =nd and others r quantity like

10 20 30 etc..hw can i declare...

regards

veera

Former Member
0 Kudos

Hi Veera,

what are the values you have in that field...

use a temporary variable of type i in between and do the additions..

again output it as char...

Regards,

Vidya.

0 Kudos

hi vindya,

i will try it and get back u.thanks.

regards

veera

Former Member
0 Kudos

As to my understanding of your issue...can you please let us know if all the rows have some characters or the field always starts with some character and digits at the end(which you wish to sum) or there can some rows with char and some with digits and you need to sum only the digit ones ??

Regards

Anurag

0 Kudos

hi

according to condtion this char(nd) is comming in display ,if condtion = yes ,nd will be placed there, otherwise nu(quantity) will be comming...

it can come in any place..

regards

veera

0 Kudos

U can do the following...

loop at itab.

if itab-f1(2) = 'NU'.

lnum = itab-f1+2(10).

lsum = lnum + lsum.

endif.

endloop.

Here lsum will give u the total.

Message was edited by: Anurag Bankley