abaps4hana

Amount Field Length Extension: Code Adaptations (2 decimals / 3 decimals)


While preparing for the conversion to S/4HANA, our custom code check produces following error message:

Old Arithmetic type conflict (Type DMBTR, Note: 0002610650) P(13,3)

I have recreated the problem in a simple demo program.

DATA: punit TYPE dmbtr,                 "curr(23,2)
      two   TYPE dmbtr VALUE '12.55',   "curr(23,2)
      three TYPE menge_d VALUE '5.123'. "quan(13,3)
CATCH SYSTEM-EXCEPTIONS arithmetic_errors = 4.
  punit = two / three.
ENDCATCH.
WRITE (26) punit.

The error is in the line punit = two / three.

I've already checked the SAP Note 2610650 but can not find any useful information in it. Hope you can help me.


Solution

  • With the new data type dmbtr_cs it worked fine. (see SAP Note 2628040)

    DATA: punit TYPE dmbtr_cs,
          two   TYPE dmbtr_cs VALUE '12.55',
          three TYPE menge_d VALUE '5.123'.
    
    CATCH SYSTEM-EXCEPTIONS arithmetic_errors = 4.
      punit = two / three.
    ENDCATCH.
    
    WRITE (26) punit.