cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

Hi SAP-Community,

I am currently very desperate, and I count with your help.

In the ABAP Cloud context I am trying to get the information dynamically, if a field of a database table is a key field.

The relevant RTTI/RTTS objects are forbidden in the ABAP Cloud scope, so now I'm looking at the XCO framework.

Specifically, I try to do something like this (this is copied from the SAP documentation):

" Content handle for the field KEY_FIELD of database table ZMY_DBT.
DATA(lo_field_content) = xco_cp_abap_dictionary=>database_table( 'ZMY_DBT'
  )->field( 'KEY_FIELD'
  )->content( ).
" Get the complete content (i.e. all the available attributes of the field)
" as a structure of all attributes.
DATA(ls_field_content) = lo_field_content->get( ).
DATA(lv_key_indicator) = lo_field_content->get_key_indicator( ).

The problem is that when I'm trying to get the content (line 7), I get a CX_XCO_NEWS_EXCEPTION "Database table ZMY_DBT does not exist.

After some debugging, I found out, that the framework expects that ZMY_DBT is C1-released. But I cannot release database tables with C1.

This seems highly contradictory.

Did I find a bug or am I missing something?

What are alternative solutions to dynamically get the key indicator of a database table field (without creating a CDS View)? 

Thank you very much in advance!

View Entire Topic
Saftladen
Explorer

Hi all,

I consulted SAP Support regarding this issue and wanted to share the outcome in case others run into the same problem.

The key factor was the software component, which in our case was not configured for ABAP Cloud.

If a database table belongs to a package that is assigned to an ABAP Cloud software component, the corresponding XCO APIs can be used for that table without requiring a C1 release contract.

There is another important aspect: if your system contains at least one ABAP Cloud software component, it is also possible to assign a C1 release contract to database tables outside that component. These tables can then also be accessed using the corresponding XCO APIs.

This was the main source of confusion in my case. We had two systems with seemingly identical circumstances, but one contained an ABAP Cloud software component while the other did not. As a result, assigning a C1 contract to a database table was possible in one system but not in the other.

I personally found this behavior quite confusing, especially since other object types can be assigned a C1 contract even when no ABAP Cloud software component exists in the system.

SAP Support confirmed that the documentation will be updated to make the prerequisites for using the XCO APIs clearer.

I hope this helps anyone running into the same issue!

Sandra_Rossi
Active Contributor
0 Likes
Nice to know, thanks for the feedback!