Skip to Content
0
Jan 10, 2023 at 09:03 AM

Using ADBC with CDS View - Language Session Parameter is Blank

278 Views

Hi All,

I thought I would just post this here before logging an incident with SAP, in case anyone knows more about this.

When reading a CDS view using ADBC (i.e. with CL_SQL_STATEMENT and friends), it seems that when querying a CDS view, the $session.system_language built-in session variable is blank.

The following example shows a CDS view that joins T356 and T356_T and uses the login language of the user to retrieve PM priorities and their associated texts:

define view Z_PRIOK as 
select from t356 as t1
left outer join t356_t as t2
    on t1.artpr = t2.artpr
   and t1.priok = t2.priok
   and t2.spras = $session.system_language
{
    t1.artpr,
    t1.priok,
    t2.priokx,
}<br>

When querying this view in SE16 or in a program with OpenSQL, the PRIOKX field is filled with the description.

However, when using the ADBC classes to query the table with the same query (ensuring the client is the current client), the PRIOKX field returns blank.

One can even extend the view to show the value of the session language variable as follows:

define view Z_PRIOK as 
select from t356 as t1
left outer join t356_t as t2
    on t1.artpr = t2.artpr
   and t1.priok = t2.priok
   and t2.spras = $session.system_language
{
    t1.artpr,
    t1.priok,
    t2.priokx,
    $session.system_language as lang
}<br>

In an ADBC query, the LANG column, containing the language session variable is blank.

Perhaps there is a workaround for this, either by setting something before the ADBC query, or perhaps there is something that must be set in the definition of the CDS view?