Application Development 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: 

How to cast calculation field in ABAP-CDS to a data element?

15,413

How to cast calculation field in ABAP-CDS to a data element?

1 ACCEPTED SOLUTION

Domi
Active Contributor
1,346

Hi

That's not possible at the moment, maybe SAP will use an annotation (eg @EndUserText.label) also in all backend tools...

 @EndUserText.label: 'A Sum'
 cast( 100 * 22 as abap.dec(11,2) ) as total,

You can already use the annotations in you custom code, if needed - tables DDHEADANNO and DDFIELDANNO or class CL_DD_DDL_ANNOTATION_SERVICE (not available with 740!)

And it's also recommended not to use the generated DDL SQL View.

regards

Domi

8 REPLIES 8

rajkumarnarasimman
Active Contributor
0 Kudos
1,346

Hi.

Instead of abap.dec(11,2), did you tried with data element name.

What is the version you are using? It looks from release ABAP 750, the data element can be specified in CAST Expression, please check here

Regards

Rajkumar Narasimman

0 Kudos
1,346

I tried to use data element without success.

I'm using ABAP 740 SP08.

Domi
Active Contributor
1,347

Hi

That's not possible at the moment, maybe SAP will use an annotation (eg @EndUserText.label) also in all backend tools...

 @EndUserText.label: 'A Sum'
 cast( 100 * 22 as abap.dec(11,2) ) as total,

You can already use the annotations in you custom code, if needed - tables DDHEADANNO and DDFIELDANNO or class CL_DD_DDL_ANNOTATION_SERVICE (not available with 740!)

And it's also recommended not to use the generated DDL SQL View.

regards

Domi

0 Kudos
1,346

I tried the annotation "@EndUserText.label" and it doesnt affect the description of the field =\

Domi
Active Contributor
1,346

Hi

Yes, it's not yet implemented in backend now! - SAP use them eg. in CDS based GW services, but not in DDIC/DDIC related tools...

kr

Domi

0 Kudos
1,346

Hi,

can you be more specific about "CDS based GW services"?

1,346

Thanks for this tip. It was really helpfull.