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

BCD_BADDATA

Former Member
0 Likes
2,493

Hi,

I am getting runtime error 'BCD_BADDATA'.

I am getting values from a file in workarea.

and then using fields to further calculations.

While adding two fields, both are of packed decimal type, I am getting this error.

Please help me out.

Mani.

15 REPLIES 15
Read only

Former Member
0 Likes
1,938

Dear Mani,

Generally BCD_BADDATA will come in the calculations. If your trying to calculate two incompatible fields this type error will come.

Check all the calculations you are performing.

Thanks and Regards,

Read only

0 Likes
1,938

Thanks Chandra,

But both the fields are of same type.

So what else I should check, while I am doing calculations.

Read only

Former Member
0 Likes
1,938

Hi,

Post the calculation part and the declaration of the variables involved in it...

Regards

Karthik D

Read only

0 Likes
1,938

Data: SALES(7) TYPE P DECIMALS 2,

COST(10) TYPE P DECIMALS 2.

(Sales is getting value from one file.)

ADD SALES TO COST.

Read only

0 Likes
1,938

>

> Data: SALES(7) TYPE P DECIMALS 2,

> COST(10) TYPE P DECIMALS 2.

> (Sales is getting value from one file.)

>

> ADD SALES TO COST.

Hi,

What are the values of SALES and COST during the error? Could you be able to reproduce the error?

Regards

Karthik D

Read only

0 Likes
1,938

Hi Karthik,

The values are

sales = 44202020303.03

cost = 0.00

Read only

0 Likes
1,938

Hi,

The error may be possibly because of other calculation, could you post the code segment where the error occurs?

Regards

Karthik D

Read only

0 Likes
1,938

Hi Karthik,

code is:

IF SUMMARY-BILLG_PERIOD GE PPFY_BEG_YRMO.

CASE SUMMARY-KEY-SALES_CHNNL.

WHEN 'D ' OR 'EMS ' OR 'F ' OR 'MTR ' OR

'RPD ' OR 'RPE ' OR 'SPK '.

PERFORM 2200-COLLECT-PRFT-SPLT.

ENDCASE.

ENDIF.

ADD SUMMARY-SALES TO PROGRAM-SALES. " Here error occurs

ADD SUMMARY-COST TO PROGRAM-COST.

ADD SUMMARY-SELLG_QTY TO PROGRAM-SELLG_QTY.

ADD SUMMARY-BASIC_QTY TO PROGRAM-BASIC_QTY.

ADD SUMMARY-LOW_QTY TO PROGRAM-LOW_QTY.

ADD SUMMARY-ORD_CNT TO PROGRAM-ORD_CNT.

Read only

0 Likes
1,938

>

> ADD SUMMARY-SALES TO PROGRAM-SALES. " Here error occurs

How is Summary and program declared?

Read only

0 Likes
1,938

Try to set a break-point on the calculation statement, and look for values of both fields before the addition.

Regards,

Raymond.

Read only

Former Member
0 Likes
1,938

Hi ,

If the types are compatible then check if the value is divided by zero.

Regards,

Ravi.

Read only

Former Member
0 Likes
1,938

Hi Mani,

As per the info u have given, regarding the field type.

Always for BDC, the fields used should be chars, if any other type, then it should be converted to string and used.

it is for smooth working of BDCs.

Its not a compulsion to change to string, but just something coz of which, the field type problems dont occur

Please try doing this

Regards,

Radhika

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,938

BCD_BADDATA is a non-catchable error related to the value stored in a packed field, look to the code which fill the operation operands, "no correct [BCD|http://help.sap.com/abapdocu/en/ABENBCD_GLOSRY.htm] format "

Regards,

Raymond

PS: Not related to BDC

Read only

0 Likes
1,938

Code is just to add two fields.

Read only

Former Member
0 Likes
1,938

check the OSS note BCD_BADDATA

[http://www.sapfans.com/forums/viewtopic.php?t=108207]