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 assignment.

Former Member
0 Likes
1,014

Hi all,

Refer this code and answer my query.

data : ece1 LIKE J_1IEXCDTL-ECSRATE.

ece1 = ( 60000 / 1300 ) * 100 .

this program is going into dump at calculation part. the result of calculation is

4615.384615384615384615384 . but since ece1 is less than that size it is not getting assigned. i tried taking the value into packed decimal, char type and assigning to ece1. but still while assigning it to ece1 it is going into dump.I know that dump is due to mismatch in assigment. but can anyone tell me a way to assign it(like any function modules available).can anyone plz solve my problem.

if i take the value into type n i am getting rounded value. but i want value including decimal places.

Message was edited by:

KURUVELLA NAVEEN

Message was edited by:

KURUVELLA NAVEEN

Message was edited by:

KURUVELLA NAVEEN

1 ACCEPTED SOLUTION
Read only

former_member188827
Active Contributor
0 Likes
962

data : ece1 LIKE J_1IEXCDTL-ECSRATE.

data ece TYPE p decimals 2.

<b>ece1 = ( 60000 / 1300 ).

ece = ece1 * 100.</b>WRITE / ece.

check if dis satisfies ur need.

Message was edited by:

abapuser

9 REPLIES 9
Read only

Former Member
0 Likes
962

Hello Naveen,

Dump is due to mismatch of the type.

see you are declaring ece1 LIKE J_1IEXCDTL-ECSRATE. you need to pass values to ece1 those which are of type same as type of ECSRATE in J_1IEXCDTL.

Reward If Useful.

Regards

--

Sasidhar Reddy Matli.

Read only

Former Member
0 Likes
962

This code is working fine for me

data ece1 type p decimals 4.

ece1 = ( 60000 / 1300 ) * 100 .

Read only

former_member188827
Active Contributor
0 Likes
962

data : ece1 LIKE J_1IEXCDTL-ECSRATE.

data ece type n.

ece = ( 60000 / 1300 ) * 100 .

ece1 = ece.

plz reward if dis helps

Read only

Former Member
0 Likes
962

Hi,

Normally ABAP Program allows 14 Decimal Places only.

But in your program the result consist of more than 31 places.

So the result is not fit for the field and it goes to dump error.

Thanks,

Reward If Helpful.

Read only

former_member188827
Active Contributor
0 Likes
962

as i mentioned,first carry out calculation in type n variable n den move to ece1..

it works!!!!!!!!!

Read only

Former Member
0 Likes
962

Hi naveen,

Once you use this declaration ece1 LIKE J_1IEXCDTL-ECSRATE.

it taken 7 chars in that 4decimal places so u r getting only 3 places before decimal part , for eg: 000.0000 (This is ur declaration).

But ur cala part giving 4615.384615384615384615384 , so its not possible to fit that value into 000.0000.

If u have any possibility then change declaration and use the variable which fits ur requirement.

Reward if it useful......

Read only

former_member188827
Active Contributor
0 Likes
963

data : ece1 LIKE J_1IEXCDTL-ECSRATE.

data ece TYPE p decimals 2.

<b>ece1 = ( 60000 / 1300 ).

ece = ece1 * 100.</b>WRITE / ece.

check if dis satisfies ur need.

Message was edited by:

abapuser

Read only

Former Member
0 Likes
962

not solved

Read only

Former Member
0 Likes
962

not satisfied with this answer