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

Short Dump while multiplying curr & decimal

Former Member
0 Likes
5,191

I have a small equation like this:

p0008-ansal = p0008-ansal * p0027-kpr02 / 100.

Apparently both the internal format seems to be P type but of different lengths. Since am multiplying a currency (ansal) with decimal (kpr02), am really not able to understand why its throwing dump.

Below is the dump:

Error analysis

An arithmetic operation in the current program "ZHRPA_COST_DIST" attempts

to process a field of type P that contains an invalid

BCD format.

Possible reasons:

1. If the field is part of a field string and its current contents are

hex 20: The field string was deleted with MOVE SPACE ... instead of

CLEAR.

2. The VARYING parameter was incorrectly placed within a DO loop,

e.g. because the TIMES parameter was too large.

Similar for WHILE ... VARY.

3. A FIELD-SYMBOL was incorrectly assigned.

Any clues plz...

Thanks

Kiran

1 ACCEPTED SOLUTION
Read only

jayanthi_jayaraman
Active Contributor
0 Likes
4,698

Hi,

Try this.

data v1 type p0008-ansal value '132321.10'.

data v2 type p0027-kpr02 value '3.00'.

data v3(21) type c.

v3 = ( v1 * v2 ) / 100.

v1 = v3.

write v1.

Hi,

Try this.

data v1 type p0008-ansal value '132321.10'.

data v2 type p0027-kpr02 value '3.00'.

data v3(21) type c.

v3 = ( v1 * v2 ) / 100.

v1 = v3.

write v1.

39 REPLIES 39
Read only

Former Member
0 Likes
3,411

Multipling currency with amount?

i guess you should have a conversion factor of currency instead, which would be integer..

When you multiply these you get proper answer.

Regards,

Lalit Mohan Gupta.

Read only

0 Likes
3,411

Hi,

AM multiplying with Currency with Decimals..i.e a fraction. and then dividing by 100.

can you please explain with a example. I ddint understand what you tried to say.

Thanks

Kiran

Read only

0 Likes
3,411

what is the type of your amount and currency

Read only

0 Likes
3,411

Dollars.

Thanks

Kiran

Read only

0 Likes
3,411

what is the technical characterstics?

dollars as in what ?

it is currency?

then how can you multiply this with amount?

Read only

Former Member
0 Likes
3,411

Hi Kiran,

Your dump claims there is an issue with the "BCD format"

This means the thousand and decimal separators are interchanged in one of the fields (ansal or kpr02) as against the user settings and hence the issue.

In debugging can you confirm the formats?

Cheers,

Aditya

Read only

0 Likes
3,411

I am executing this report for several pernrs. But its failing at only 1 case and i could find any problem with the data.

Below is the data from debug mode:

kpr : 3.00 ( type: p(3) decimals 2)

ansal: 132321.10 (type: p(8) decimals 2)

Any clues plz.

Thanks

Kiran

Edited by: kiran dasari on Apr 24, 2009 7:51 PM

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
4,699

Hi,

Try this.

data v1 type p0008-ansal value '132321.10'.

data v2 type p0027-kpr02 value '3.00'.

data v3(21) type c.

v3 = ( v1 * v2 ) / 100.

v1 = v3.

write v1.

Read only

0 Likes
3,411

Hi Jayanthi,

Dump is occuring only for that particular record. rest of the records are passing successfully. So can you please tell me any specific reason for this?

thanks

Kiran

Read only

0 Likes
3,411

Hi Jayanthi,

I tried that way and still no charm.

It failed again for the same record.

this is the code

DATA: l_ansal_temp(21) TYPE c.

l_ansal_temp = L_ANSAL * W_KPR / 100.

move l_ansal to lni-ansal.

Thanks

Kiran

Read only

0 Likes
3,411

See if this helps:

p0008-ansal = p0008-ansal  / 100.
p0008-ansal = p0008-ansal * p0027-kpr02

.

Rob

Read only

0 Likes
3,411

Rob,

This did not bring too

As I said, its dumping only with one pernr. Rest all are passing thru fine. Am not finding any fault with the values too... Any more clues plz.

Thanks

Kiran

Read only

0 Likes
3,411

Which line did it dump on and what were the vaules? (I'm guessing the division.)

Rob

Read only

0 Likes
3,411

Oops it was at a different line but the dump says description remains the same:

My Code:

if not p0008-ansal eq 0.

p0008-ansal = p0008-ansal / 100.

p0008-ansal = p0008-ansal * p0027-kpr02

endif. --> Dump Pointing here now.

Thanks

Kiran

Edited by: kiran dasari on Apr 25, 2009 1:56 AM

Read only

0 Likes
3,411

So your original problem is solved?

Rob

Read only

0 Likes
3,411

But still am getting the same dump at endif.

Any more clues plz..

thanks

kiran

Read only

0 Likes
3,411

Same problem or something new? What error does the new dump give?

Rob

Read only

0 Likes
3,411

hi try like this,

ansal -> (type: p(12) decimals 2)

This error may be because of overflow.

Regards

Read only

0 Likes
3,411

Hi,

DATA: l_ansal_temp(21) TYPE c.

l_ansal_temp = L_ANSAL * W_KPR / 100.

lni-ansal = l_ansal_temp.

I think you moved l_ansal instead of temp.

Read only

0 Likes
3,411

Hi Jayanthi,

I corrected but still no charm.

This is driving me crazy. The same equation is working fine upt 1980 records and failing at 1981 records. So I dont see any data type issue. Any more clues plz...

Thanks

Kiran

Edited by: kiran dasari on Apr 29, 2009 1:52 AM

Read only

0 Likes
3,411

Hi Kiran ,

Can u send the rest of the code , may be the debugging analysis has not performed correctly.

because the dump occurs at line which u have not mentioned above.

Thks

Shailesh

Read only

0 Likes
3,411

its dumping while multiplying dude.

almost 1980 records passed well. but i dont really understand why its dumping after that.

thanks

kiran

Edited by: kiran dasari on Apr 30, 2009 10:37 PM

Read only

0 Likes
3,411

Maybe it's time you bite the bullet and solve it yourself. There's not much the forum can do without your system, data and program.

Rob

Read only

0 Likes
3,411

>

> almost 1980 records passed well. but i dont really understand why its dumping after that.

> Edited by: kiran dasari on Apr 30, 2009 10:37 PM

DO  25 TIMES VARYING w_kst FROM p0027-kst01 NEXT p0027-kst02
VARYING w_kpr FROM p0027-kpr01 NEXT p0027-kpr02
VARYING w_fct FROM p0027-fct01 NEXT p0027-fct02
VARYING w_fcd FROM p0027-fcd01 NEXT p0027-fcd02
VARYING w_fkber FROM p0027-fkber01 NEXT p0027-fkber02
VARYING w_grant FROM p0027-grant01 NEXT p0027-grant02
VARYING w_auf FROM p0027-auf01 NEXT p0027-auf02
VARYING w_psp FROM p0027-psp01 NEXT p0027-psp02.

Please add the 25 TIMES addition and check if it works.

Regards

Rajesh.

Read only

0 Likes
3,411

Hi Kiran

Some issue with data type L_ANSAL I think in run time some where it is becoming character.

Read only

0 Likes
3,411

Awesome.

This addition solved my problem.

Nothing specific to data types.

I did not realize that I should be explicitly loop 25times.

Thanks

Kiran

Read only

Former Member
0 Likes
3,411

Hi Rob, am still getting a dump:

Below is my complete code:

DO VARYING w_kst FROM p0027-kst01 NEXT p0027-kst02

VARYING w_kpr FROM p0027-kpr01 NEXT p0027-kpr02

VARYING w_fct FROM p0027-fct01 NEXT p0027-fct02

VARYING w_fcd FROM p0027-fcd01 NEXT p0027-fcd02

VARYING w_fkber FROM p0027-fkber01 NEXT p0027-fkber02

VARYING w_grant FROM p0027-grant01 NEXT p0027-grant02

VARYING w_auf FROM p0027-auf01 NEXT p0027-auf02

VARYING w_psp FROM p0027-psp01 NEXT p0027-psp02.

IF w_kpr = 0.

EXIT.

ENDIF.

lni-begda = p0027-begda.

lni-endda = p0027-endda.

IF NOT w_fct IS INITIAL.

lni-kostl = w_fct.

lni-cfcflag = 'F'.

ELSE.

lni-kostl = w_kst.

lni-cfcflag = 'C'.

ENDIF.

lni-geber = w_fcd.

lni-fkber = w_fkber.

lni-grant = w_grant.

lni-aufnr = w_auf.

lni-pspsp = w_psp.

lni-pkprz = w_kpr.

IF w_kpr NE 100.

  • Begin of DASARIKB Insert & Comment

IF NOT l_ansal EQ 0.

lni-ansal = l_ansal / 100.

lni-ansal = l_ansal * w_kpr.

ENDIF.

IF NOT l_betrg EQ 0. -


> Dump is pointing here.

lni-betrg = l_betrg / 100.

lni-betrg = l_betrg * w_kpr.

ENDIF.

  • LNI-ANSAL = L_ANSAL * W_KPR / 100.

  • LNI-BETRG = L_BETRG * W_KPR / 100.

  • End of DASARIKB Insert & Comment

Dump description:

An arithmetic operation in the current program "ZHRPA_COST_DIST" attempts

to process a field of type P that contains an invalid

BCD format.

Possible reasons:

1. If the field is part of a field string and its current contents are

hex 20: The field string was deleted with MOVE SPACE ... instead of

CLEAR.

2. The VARYING parameter was incorrectly placed within a DO loop,

e.g. because the TIMES parameter was too large.

Similar for WHILE ... VARY.

3. A FIELD-SYMBOL was incorrectly assigned.

Pl let me know.

Thanks

Kiran

Read only

0 Likes
3,411

So it's not at the ENDIF. Are you sure it's pointing at this line?

Rob

Read only

0 Likes
3,411

Yes, Its not at ENDIF.

Its pointing at IF NOT l_betrg eq 0.

Can you please help me.

Declarations are below:

DATA: l_ansal LIKE lni-ansal,

l_betrg LIKE lni-betrg.

TYPES: BEGIN OF ty_lni,

personid_ext TYPE personid_ext,

ename LIKE p0001-ename,

pernr LIKE p0001-pernr,

plans LIKE p0001-plans,

infty LIKE prelp-infty,

begda TYPE begda,

endda TYPE endda,

kostl TYPE kostl,

cfcflag,

geber TYPE bp_geber,

fkber TYPE fkber,

grant TYPE gm_grant_nbr,

aufnr TYPE aufnr,

pspsp TYPE ps_psp_pnr,

pkprz TYPE pkprz,

ansal TYPE p0008-ansal,

betrg TYPE betrg,

seq(3) TYPE n,

werks LIKE p0001-werks,

btrtl LIKE p0001-btrtl,

persg LIKE p0001-persg,

persk LIKE p0001-persk,

stell LIKE p0001-stell,

zz_hr_jbtyp LIKE p0001-zz_hr_jobtype,

lgart_s(30), " like p0008-lga01,

stat2 LIKE p0000-stat2,

plstx LIKE t528t-plstx,

orgeh LIKE p0001-orgeh,

oshort LIKE p1000-short,

ostext LIKE p1000-stext,

END OF ty_lni.

TYPES: t_ty_lni TYPE TABLE OF ty_lni

WITH DEFAULT KEY.

DATA: t_lni TYPE t_ty_lni,

lni TYPE ty_lni,

Thanks for your help and time.

Kiran

Read only

0 Likes
3,411

I'm confused. Is this a new problem or your original one?

Rob

Read only

0 Likes
3,411

yes, Its a new one.

But both are similar and in the same program.

If you see the code, i got my 1st dump at

  • LNI-ANSAL = L_ANSAL * W_KPR / 100.

which i changed it to:

IF NOT l_ansal EQ 0.

lni-ansal = l_ansal / 100.

lni-ansal = l_ansal * w_kpr.

ENDIF.

after your suggestion

I have one more line of code like:

  • LNI-BETRG = L_BETRG * W_KPR / 100.

So i changed this also to:

IF NOT l_betrg EQ 0. -


> Now its dumping out here.

lni-betrg = l_betrg / 100.

lni-betrg = l_betrg * w_kpr.

ENDIF.

Pl let me know, if u need any more details.

Thanks

Kiran

Read only

0 Likes
3,411

I assume l_betrg has some value. Can you tell what it is? Can you see where in the program it is poulated?

Rob

Read only

0 Likes
3,411

When the dump occurs, l_betrg value is 0.0

I saw this in the debugger.

Thanks

Kiran

Read only

0 Likes
3,411

0.0 or 0.00 ?

Rob

Read only

0 Likes
3,411

Its my bad again.Am sorry.

0.00.

Thanks

Kiran

Read only

0 Likes
3,411

So, at the statement just before it dumps, the value is 0.00 ? Or is it somewhere else?

Rob

Read only

0 Likes
3,411

Its value is 0.00, the moment it enters the DO loop.

Thanks,

kiran

Hi Rob,

actually I debugged it line by line. Dump happened on this line

lni-ansal = l_ansal * w_kpr

but when i see it in ST22, its pointing to the next line (if not l_betrg eq 0). Sorry for all the confusion.Dump happened after 1980 loops. i.e sy-tabix is 1980.

Hence, the original problem is not solved.

And the values are as below:

l_ansal = 132321.10

lni_ansal = 1323.21

w_kpr = 3.00

so when its multiplying 1323.21 * 3.00, its throwing the dump.

Any more thoughts plz...

Thanks

Kiran

Edited by: kiran dasari on Apr 28, 2009 7:54 PM

Read only

0 Likes
3,411

check the data type of this lni-ansal<< this shud be same datatype as the values you multiplying.

Read only

0 Likes
3,411

Any more clues...

Thanks

Kiran