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: 

Cannot select from table dummy

0 Kudos

Hello,

I'm trying to use the sys.dummy table to do some calculations in ADT. However, when I issue e.g. the statement

SELECT RAND()*1000 AS VAL FROM DUMMY

in SQL console I get the error

"DUMMY" is not declared as a table, projection view, or database view in ABAP Dictionary or does not exist in an active version

When I try to join dummy in a CDS view definition I get

"Basis object dummy does not exist or is not active"

In the same system, when I execute the function module SHDB_EXISTS_TABLE with I_SCHEMA_NAME = SYS and I_TABLE_NAME = DUMMY, I get a positive result. Inside, it counts the rows of the table to check whether it exists. So it must be active, otherwise it couldn't count the rows.

Is there any limitation that I can't use table DUMMY in ABAP Developer tools?

System is a HDB system with SAP_BASIS 751.

Thank you

Josef

1 ACCEPTED SOLUTION

pfefferf
Active Contributor
0 Kudos

Hello Josef,

the ADT SQL console uses the OpenSQL connection which is linked to the "ABAP schema" on your database system (by default it is named "SAP<SYSID>"). Because of that table DUMMY is not found due to the assignment to schema SYS.

Function SHDB_EXISTS_TABLE uses the ADBC interface which does a native SQL query on the system view TABLES.

If you have a HANA DB user and the necessary privileges you could use the HANA SQL console for your requirement. For that you have to install the SAP HANA tools in your Eclipse environment.

Regards,

Florian

3 REPLIES 3

pfefferf
Active Contributor
0 Kudos

Hello Josef,

the ADT SQL console uses the OpenSQL connection which is linked to the "ABAP schema" on your database system (by default it is named "SAP<SYSID>"). Because of that table DUMMY is not found due to the assignment to schema SYS.

Function SHDB_EXISTS_TABLE uses the ADBC interface which does a native SQL query on the system view TABLES.

If you have a HANA DB user and the necessary privileges you could use the HANA SQL console for your requirement. For that you have to install the SAP HANA tools in your Eclipse environment.

Regards,

Florian

0 Kudos

Hello Florian,

thank you for your quick answer. Does that mean I cannot use sys.dummy in CDS views at all?

Regards,

Josef

0 Kudos

Hi Josef,

if you are only running on SAP HANA then can implement an ABAP CDS Table Function in SAP NetWeaver AS ABAP 7.51. In the SQLScript implementation you can access SYS.DUMMY and use the RAND() function. Otherwise, it is not possible.

Regards

Chris