Skip to Content
avatar image
Former Member

AMDP - SQLSCRIPT message: Return type mismatch error on sum of currency field

Hi Friends,

I am getting below error when i try to activate AMDP class.

DescriptionResourcePathLocationType SQLSCRIPT message: return type mismatch: Procedure YCL_DEMO_AMDP_1=>GET_TOP_VENDOR: Attribute name "DMBTR" different from Attribute name: "SUM(DMBTR)"YCL_DEMO_AMDP_1 (Global Class)[DR1] YCL_DEMO_AMDP_1line 41ABAP Syntax Check Problem .

CLASS Defination

CLASS Implementation

Error Details

I Tried changing the DMBTR type to ( P LENFTH 13 DECIMAL 3 ) but still getting the same error.

But if i don't use SUM function it is working fine.

Why it is not allowing for SUM but allowing without some ?

How to get the sum of DMBTR ?

Thank you ALL :)

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Mar 11, 2017 at 09:09 AM

    Use an alias name for your summed field:

    ...
    sum(dmbtr) as dmbtr
    ...
    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Thanks for your reply .

      It is working find now . Could you explain why alias name is required here ?

  • Mar 11, 2017 at 09:14 AM

    You have to take the mapping rules into account

    https://help.sap.com/http.svc/rc/abapdocu_751_index_htm/7.51/en-US/index.htm?file=abenamdp_hdb_sqlscript.htm

    SUM has type DOUBLE, I guess. It must be mapped to f.

    Either use ABAP type f or cast SUM to DECIMAL in SQLScript.

    Add comment
    10|10000 characters needed characters exceeded