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

Data type

Former Member
0 Likes
782

Hi,

I have following code:

loop at gt_pimcall where mvgr4 = 'PS'.

clear: gt_sumdien.

gt_sumdien-pim_posnr = gt_pimcall-pim_posnr.

gt_sumdien-prod_base = gt_pimcall-prod_base.

gt_sumdien-pl = gt_pimcall-pl.

gt_sumdien-total_price = gt_pimcall-total_price.

gt_sumdien-discount = gt_pimcall-discount.

collect gt_sumdien.

endloop.

gt_pimcall-total_price and gt_pimcall-discount are character types of size 15.

The structure of gt_sumdien is as below:

data: begin of gt_sumdien occurs 0,

pim_posnr like zupistgitm-pim_posnr,

prod_base like zupistgitm-prod_base,

prod_option like zupistgitm-prod_option,

pl like zupistgitm-pl,

total_price type i,

discount type i,

end of gt_sumdien.

The COLLECT statment in the above code will fail with OVERFLOW exception when ever the value in total_price or discount exceeds "2147483647" as this is the maximum value a field of type I can accept.

Can any one suggest what I should do so that the above piece of code doent throw an exception. The point is total_price can have -ve value, decimal values.

Please suggest me what data type I have to use so that program doesnt go for a dump.

Regards,

Ganesh

8 REPLIES 8
Read only

Former Member
0 Likes
758

Try to use Floating types <b>TYPE F</b>

Regards

Wenceslaus

Read only

0 Likes
758

Hi,

When I declared the variable as type F, and when I try to print the values in the iternal table, I am seeing data somthing like this "1.23456789E+15". Any way so that we can see the values in the normal format.

regards,

Ganesh

Read only

0 Likes
758

Hi,

Just move this value 1.23456789E+15 to some other character type variable and then print it else make that particular column to text column.

Regards,

Suresh

Read only

0 Likes
758

You can use COLLECT for data type F,

Any way so that we can see the values in the normal format.

Suppose ITAB-CNT is the field of type F: To display without Exponents and Decimal points,

WRITE itab-cnt EXPONENT 0 DECIMALS 0.

Read only

0 Likes
758

Actually the values in the internal table will be used for a BDC, and when I try to populated the BDC tables, its again throwing error.

Regards,

Ganesh

Read only

0 Likes
758

HI..

before sending that value to BDC,

move that float value into a type P:

data:

<b> w_pack type p decimals 0.</b> * mention the decimals as u required 0,1,2....

<b>move w_float to w_pack.</b>

send this value to BDC...

Read only

Former Member
0 Likes
758

Hi

Either use TYPE P DECIMALS 2 or

use the FLOAT type.

it will take care.

reward if useful

regards

Anji

Read only

0 Likes
758

Will I be able to use the collect statement if I declare the variable as F.