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

HANA External View - type mapping

Former Member
0 Likes
3,956

Hi,

Is there any way to expose HANA view to ABAP as External View, when column types are: DATS, TIMESTAMP, VARCHAR ?

I've found one answer for VARCHAR (https://scn.sap.com/thread/3533385)

I have the possibility to edit HANA View, so how can I neatly expose columns with DATE data type, to use on ABAP as simple select statement ?

It's really useful since I have ranges as variables in WHERE clause and of course simple SELECT in ABAP code is much easier to read.

So far I get the error during creation of External View:

Field DOCUMENT_DATE: no Dictionary type exists for database type DATE.

The aim is to have such a situation:

HANA:

AT_DOCUMENTS:

document_date (Data Type DATE)

ABAP:

ZEV_DOCUMENTS

document_date (what type??)

and in code

SELECT *

      FROM zev_documents

      INTO DATA(lt_documents)

     WHERE document_date IN s_date.

I cannot find any reference, which HANA types are supported and which not, neither the way how to easily convert unsupported types

Regards,

Radek

Hi,

Is there any way to expose HANA view to ABAP as External View, when column types are: DATS, TIMESTAMP, VARCHAR ?

I've found one answer for VARCHAR (https://scn.sap.com/thread/3533385)

I have the possibility to edit HANA View, so how can I neatly expose columns with DATE data type, to use on ABAP as simple select statement ?

It's really useful since I have ranges as variables in WHERE clause and of course simple SELECT in ABAP code is much easier to read.

So far I get the error during creation of External View:

Field DOCUMENT_DATE: no Dictionary type exists for database type DATE.

The aim is to have such a situation:

HANA:

AT_DOCUMENTS:

document_date (Data Type DATE)

ABAP:

ZEV_DOCUMENTS

document_date (what type??)

and in code

SELECT *

      FROM zev_documents

      INTO DATA(lt_documents)

     WHERE document_date IN s_date.

I cannot find any reference, which HANA types are supported and which not, neither the way how to easily convert unsupported types

Regards,

Radek

9 REPLIES 9
Read only

amol_samte
Contributor
0 Likes
2,706

Hi Radek,

I have not understood fully your question.

As per my experience whenever I came across situation, I changed HANA view date column to NVARCHAR(8) type and later in external view changed to date type.

-Amol S

Read only

0 Likes
2,706

Hi Amol,

Just imagine that on HANA side (column SAP HANA Type), for column FKDAT, you have the type DATE - and that's my question. To create a HANA view from such a column.

Regards,

Radek

Read only

0 Likes
2,706

Yes you are right...

If you really don't want to change a data type of HANA, then you can call hana view in AMDP ....

Cheers,

Amol

Message was edited by: Amol Samte

Read only

0 Likes
2,706

This message was moderated.

Read only

0 Likes
2,706

Hi Amol, thanks for the clue NVARCHAR(8), i did exactly the same and now DATS is in the list.

Thank you very much.

Read only

pfefferf
Active Contributor
0 Likes
2,706

Hello Radek,

here you find a list of supported data types. Data type conversion for not supported types is typically done on HANA level in a separate "ABAP Query View" (just put an additional query view on top of the existing query view which does the necessary conversions, e.g. by a calculated column).

Another question is if you really need the HANA view. I mean do you need the HANA view also in the HANA database or in another tool, or is it just consumed from the ABAP level? If you just need it from the ABAP level you can think about the usage of ABAP CDS Views. In that case you don't have to deal with not supported data type mappings and the lifecylce management stuff.

Regards,

Florian

Read only

Former Member
0 Likes
2,706

Hi Florian,

Thanks for the link, I just forgot that 7.4 documentation is really complementary.

The thing is that database table stems from HANA (is used not only on ABAP side), therefore I need to adjust.

Calculation View with simple conversion looks like the solution.

Are there any "official" recommendations how to convert unsupported HANA Data Types (like date to integer or string etc...)? Or is it just up to developer?

Regards,

Radek

Read only

pfefferf
Active Contributor
0 Likes
2,706

To my knowledge there are no guide etc. We did it ourself depending on the requirements.

Regards,

Florian

Read only

Former Member
0 Likes
2,706

Hi Fiorian,

Thank you for the information.

How can we do this at HANA level with abap query view, if possible please provide sample code.

Many thanks in Advance

Riyas