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

packed type

Former Member
0 Likes
1,195

Hi experts

I am using this field

bdmng LIKE resb-bdmng, * 0.010

iamng LIKE afpo-iamng, * 150

it_final-iamng = it_final-bdmng / it_final-psmng.

when i do calculations in program the result of iamng

is supposed to 6.66667E-05, but it assigns iamng = 0.

but iamng takes Zero, i don't know why, is this problem with packed type.

how to solve this problem and declare this decimal places.

Thanks in advance.

Regards

Rajaram

11 REPLIES 11
Read only

Former Member
0 Likes
1,148

Hi

All these are QUAN type field with 3 decimals

If you want integer as output for IAMNG field declare another variable of TYPE I and then move this IAMNG to that variable and display

check the values of the fields in debug mode and see

if not it_final-psmng is initial.

it_final-iamng = it_final-bdmng / it_final-psmng.

endif.

<b>Reward points for useful Answers</b>

Regards

Anji

Read only

0 Likes
1,148

Its ok but again it give the following error yar

An internal table field is too short.

CX_SY_ARITHMETIC_OVERFLOW'

The name of the field is "BDMNG".

how to solve this.

Read only

Former Member
0 Likes
1,148

actual value of 6.66667E-05 is 0.0000666667 so when you are taking in iamng( which has decimals 3) it only takes first 3 digit after the decimal and gives you the value 0.000. so as per your requirement you have to assign some typ p variable with decimals 5 or more to get the value.

by default iamng is of decimals 3.. so you declare like that

data : result type p decimals 6.

result = it_final-bdmng / it_final-psmng.

write : / result.

and before doing the calculation check it_final-psmng is non zero value as said by anji.

regards

shiba dutta

Read only

0 Likes
1,148

thank you very much yar

and bdmng also gives dump with the following error.

CX_SY_ARITHMETIC_OVERFLOW'

when i try the collect stmt.

how to solve this.

Read only

0 Likes
1,148

this is the error description.

An internal table field is too short.

Read only

0 Likes
1,148

i think you are not clearing properly your field. In somecases it may added or multiply with other value and give you this error just check it ... and if possible please paste the code..

regards

shiba dutta

Read only

0 Likes
1,148

when i treid this code, am getting the error.

loop at itab1.

move-corresponding itab1 to it_final.

collect it_final.

endloop.

again problem with bdmng, what could be.

Read only

0 Likes
1,148

its may be for the collect statement because it is adding the bdmng field every time when the key field of your int table is repeated. So if it is necessary to add tose bdmng then i think it is not possible by quantity field . If your quantity field does not contain any decimal value(e.g. if your qty 12 whole number) then you have to take it in type n field . If it contains decimal value then you have to assign the sum in a character field. But for both the cases collect will not work you have to do the sum manually.

regards

shiba dutta

Read only

0 Likes
1,148

no collect is working for some data with quan field ,

but some of the cases it is not working, i don't know why.

see this error description.

An exception occurred. This exception will be dealt with in more detail

below. The exception, assigned to the class 'CX_SY_ARITHMETIC_OVERFLOW', was

not caught, which

led to a runtime error. The reason for this exception is:

The COLLECT statement stores totals in the internal table

"\PROGRAM=Z_PGM\DATA=IT_FINAL[]",

but the values are too large for the type P field intended to store them

.

The name of the field is "BDMNG".

Read only

Former Member
0 Likes
1,148

as per my previous thread i have told due to collect the addition of bdmng is overflowing the capacity of type p variable..

so declare a inttable like that..

data : begin of itab,

aufnr like afpo-aufnr,

sum(40).

end of itab.

now suppose your data is present in iafpo with aufnr posnr and bdmng.

sort iafpo by aufnr posnr.

loop at iafpo.

itab-sum = itab-sum + iafpo-bdmng.

itab-aufnr = iafpo-aufnr.

at end of aufnr.

append itab.

endat.

endloop.

i think because of collect statement the error is coming...

just try like the above code (make adjustment as per need that is only an idea)...

regards

shiba dutta

Read only

0 Likes
1,148

ok yar

thank you very much, let me check and revert back you soon.

Regards

Rajaram