<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Using ADBC with CDS View - Language Session Parameter is Blank in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-adbc-with-cds-view-language-session-parameter-is-blank/m-p/12674819#M2016536</link>
    <description>&lt;P&gt;Thanks so, if I understand correctly, you are working around the problem by making the language a parameter.&lt;/P&gt;&lt;P&gt;But using ADBC means you are using native SQL, so parameters to CDS views would not be possible.&lt;/P&gt;&lt;P&gt;Moreover, using a parameter means that the consumer of the view must reference the language, which I am trying to avoid.&lt;/P&gt;</description>
    <pubDate>Tue, 10 Jan 2023 10:17:28 GMT</pubDate>
    <dc:creator>martinc_mb38</dc:creator>
    <dc:date>2023-01-10T10:17:28Z</dc:date>
    <item>
      <title>Using ADBC with CDS View - Language Session Parameter is Blank</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-adbc-with-cds-view-language-session-parameter-is-blank/m-p/12674815#M2016532</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
  &lt;P&gt;I thought I would just post this here before logging an incident with SAP, in case anyone knows more about this.&lt;/P&gt;
  &lt;P&gt;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.&lt;/P&gt;
  &lt;P&gt;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:&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;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,
}&amp;lt;br&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;When querying this view in SE16 or in a program with OpenSQL, the PRIOKX field is filled with the description.&lt;/P&gt;
  &lt;P&gt;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.&lt;/P&gt;
  &lt;P&gt;One can even extend the view to show the value of the session language variable as follows:&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;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
}&amp;lt;br&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;In an ADBC query, the LANG column, containing the language session variable is blank.&lt;/P&gt;
  &lt;P&gt;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?&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 09:03:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-adbc-with-cds-view-language-session-parameter-is-blank/m-p/12674815#M2016532</guid>
      <dc:creator>martinc_mb38</dc:creator>
      <dc:date>2023-01-10T09:03:55Z</dc:date>
    </item>
    <item>
      <title>Re: Using ADBC with CDS View - Language Session Parameter is Blank</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-adbc-with-cds-view-language-session-parameter-is-blank/m-p/12674816#M2016533</link>
      <description>&lt;P&gt;Please check following example:&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-us/abencds_f1_session_variable.htm" target="test_blank"&gt;https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-us/abencds_f1_session_variable.htm&lt;/A&gt;&lt;/P&gt;&lt;DL&gt;&lt;/DL&gt;&lt;PRE&gt;&lt;CODE&gt;@AbapCatalog.sqlViewName: 'DEMO_CDS_T100'&lt;BR /&gt;@AccessControl.authorizationCheck: #NOT_REQUIRED&lt;BR /&gt;define view demo_cds_select_t100&lt;BR /&gt;as select from&lt;BR /&gt;demo_cds_select_t100_langu( p_langu: $session.system_language )&lt;BR /&gt;{&lt;BR /&gt;*&lt;BR /&gt;}    &lt;BR /&gt;@AbapCatalog.sqlViewName: 'DEMO_CDS_T100_LG'&lt;BR /&gt;@AccessControl.authorizationCheck: #NOT_REQUIRED&lt;BR /&gt;define view demo_cds_select_t100_langu&lt;BR /&gt;with parameters&lt;BR /&gt;@Environment.systemField:#SYSTEM_LANGUAGE&lt;BR /&gt;p_langu : lang&lt;BR /&gt;as select from&lt;BR /&gt;t100&lt;BR /&gt;{&lt;BR /&gt;*&lt;BR /&gt;}&lt;BR /&gt;where&lt;BR /&gt;sprsl = :p_langu&lt;BR /&gt;and arbgb = 'SABAPDEMOS'    &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Jan 2023 09:25:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-adbc-with-cds-view-language-session-parameter-is-blank/m-p/12674816#M2016533</guid>
      <dc:creator>ThorstenHoefer</dc:creator>
      <dc:date>2023-01-10T09:25:38Z</dc:date>
    </item>
    <item>
      <title>Re: Using ADBC with CDS View - Language Session Parameter is Blank</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-adbc-with-cds-view-language-session-parameter-is-blank/m-p/12674817#M2016534</link>
      <description>&lt;P&gt;Hello Thorsten,&lt;/P&gt;&lt;P&gt;Can you explain a bit what is going on in this example?&lt;/P&gt;&lt;P&gt;I see you are referencing $session.system_language in the view definition, but my whole point is that in an ADBC query it is blank.&lt;/P&gt;&lt;P&gt;Also, the link to the help does not mention ADBC anywhere, so I am at a bit of a loss as to what this example is supposed to show.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Martin&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 09:43:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-adbc-with-cds-view-language-session-parameter-is-blank/m-p/12674817#M2016534</guid>
      <dc:creator>martinc_mb38</dc:creator>
      <dc:date>2023-01-10T09:43:20Z</dc:date>
    </item>
    <item>
      <title>Re: Using ADBC with CDS View - Language Session Parameter is Blank</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-adbc-with-cds-view-language-session-parameter-is-blank/m-p/12674818#M2016535</link>
      <description>&lt;P&gt;Please check following view:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;define view demo_cds_select_t100&lt;BR /&gt;as select from&lt;BR /&gt;demo_cds_select_t100_langu( p_langu: $session.system_language )&lt;BR /&gt;{&lt;BR /&gt;*&lt;BR /&gt;} &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;try to select the data from the view demo_cds_select_t100_langu directly with&lt;/P&gt;&lt;P&gt;select * from emo_cds_select_t100_langu( p_langu: 'E' )&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 09:51:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-adbc-with-cds-view-language-session-parameter-is-blank/m-p/12674818#M2016535</guid>
      <dc:creator>ThorstenHoefer</dc:creator>
      <dc:date>2023-01-10T09:51:46Z</dc:date>
    </item>
    <item>
      <title>Re: Using ADBC with CDS View - Language Session Parameter is Blank</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-adbc-with-cds-view-language-session-parameter-is-blank/m-p/12674819#M2016536</link>
      <description>&lt;P&gt;Thanks so, if I understand correctly, you are working around the problem by making the language a parameter.&lt;/P&gt;&lt;P&gt;But using ADBC means you are using native SQL, so parameters to CDS views would not be possible.&lt;/P&gt;&lt;P&gt;Moreover, using a parameter means that the consumer of the view must reference the language, which I am trying to avoid.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 10:17:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-adbc-with-cds-view-language-session-parameter-is-blank/m-p/12674819#M2016536</guid>
      <dc:creator>martinc_mb38</dc:creator>
      <dc:date>2023-01-10T10:17:28Z</dc:date>
    </item>
    <item>
      <title>Re: Using ADBC with CDS View - Language Session Parameter is Blank</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-adbc-with-cds-view-language-session-parameter-is-blank/m-p/12674820#M2016537</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;while trying to reproduce the problem, I fell into a nasty trap. Maybe it is the same issue like in your SQL (you did not post it, so it's a guess only).&lt;/P&gt;&lt;P&gt;With 'Select * from Z_PRIOK...' in native SQL you will also get the MANDT field back, despite it is not defined in your CDS view. If in your definition of the result table there is no field for the MANDT, the target area does not fit to the columns from the table access and you will find values or parts of values of other columns in the columns of your result table. &lt;/P&gt;&lt;P&gt;So with this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;report z_test1.&lt;BR /&gt;types: begin of TResult,&lt;BR /&gt;         mandt  type mandt,&lt;BR /&gt;         artpr  type artpr,&lt;BR /&gt;         priok  type priok,&lt;BR /&gt;         priokz type char20,&lt;BR /&gt;         langu  type char1,&lt;BR /&gt;       end of TResult.&lt;BR /&gt;data: result_tab type standard table of TResult with empty key.&lt;BR /&gt;try.&lt;BR /&gt;    DATA(result) = NEW cl_sql_statement( )-&amp;gt;execute_query(&lt;BR /&gt;                `select * from Z_PRIOK where MANDT = SESSION_CONTEXT('CLIENT')` ).&lt;BR /&gt;    result-&amp;gt;set_param_table( itab_ref = REF #( result_tab ) ).&lt;BR /&gt;    if ( result-&amp;gt;NEXT_PACKAGE( ) &amp;gt; 0 ).&lt;BR /&gt;      cl_demo_output=&amp;gt;display( result_tab ).&lt;BR /&gt;    endif.&lt;BR /&gt;  catch CX_PARAMETER_INVALID into data(exParmInvalid).&lt;BR /&gt;    write:/ 'Error:', exParmInvalid-&amp;gt;get_text( ).&lt;BR /&gt;  catch CX_SQL_EXCEPTION into data(exSql).&lt;BR /&gt;    write:/ 'Error:', exSql-&amp;gt;get_text( ) .&lt;BR /&gt;endtry.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;the result is fine:&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2127448-image001.png" /&gt;&lt;/P&gt;&lt;P&gt;But without the MANDT&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;types: begin of TResult,
         artpr  type artpr,
         priok  type priok,
         priokz type char20,
         langu  type char1,
       end of TResult.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;the result is nonsense (first 2 chars of MANDT in column ARTPR, first char of ARTPR in column PRIOK etc.):&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2127449-image002.png" /&gt;&lt;/P&gt;&lt;P&gt;So, maybe the problem is in the target of the projection list instead of the variable $session.system_language...?&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;&lt;P&gt;Jan&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 17:05:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-adbc-with-cds-view-language-session-parameter-is-blank/m-p/12674820#M2016537</guid>
      <dc:creator>jmodaal</dc:creator>
      <dc:date>2023-01-10T17:05:25Z</dc:date>
    </item>
    <item>
      <title>Re: Using ADBC with CDS View - Language Session Parameter is Blank</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-adbc-with-cds-view-language-session-parameter-is-blank/m-p/12674821#M2016538</link>
      <description>&lt;P&gt;Hello Jan,&lt;/P&gt;&lt;P&gt;Thank you for taking the time to reproduce my issue! In my testing, I have made sure to select with the client and match the columns, as shown in my screenshot below.&lt;/P&gt;&lt;P&gt;Would you mind telling me on what database and ABAP release you are running? We are on Oracle and 750. I wonder if it is perhaps a database or kernel issue (or a combination of the two).&lt;/P&gt;&lt;P&gt;I have in the meantime logged an incident with SAP as I believe this to be a problem with the standard.&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;/P&gt;&lt;P&gt;Martin&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2125463-image.png" /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jan 2023 05:05:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-adbc-with-cds-view-language-session-parameter-is-blank/m-p/12674821#M2016538</guid>
      <dc:creator>martinc_mb38</dc:creator>
      <dc:date>2023-01-11T05:05:04Z</dc:date>
    </item>
    <item>
      <title>Re: Using ADBC with CDS View - Language Session Parameter is Blank</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-adbc-with-cds-view-language-session-parameter-is-blank/m-p/12674822#M2016539</link>
      <description>&lt;P&gt;If you uning ADBC in ABAP you can use the content of sy-langu to fill the parameter.&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abenselect_cds_para_abexa.htm"&gt;SELECT, CDS View with Input Parameters - ABAP Keyword Documentation (sap.com)&lt;/A&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;select * from demo_cds_select_t100_langu( p_langu: sy-langu )&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 11 Jan 2023 06:51:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-adbc-with-cds-view-language-session-parameter-is-blank/m-p/12674822#M2016539</guid>
      <dc:creator>ThorstenHoefer</dc:creator>
      <dc:date>2023-01-11T06:51:36Z</dc:date>
    </item>
    <item>
      <title>Re: Using ADBC with CDS View - Language Session Parameter is Blank</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-adbc-with-cds-view-language-session-parameter-is-blank/m-p/12674823#M2016540</link>
      <description>&lt;P&gt;Hello  &lt;SPAN class="mention-scrubbed"&gt;martin_mbsa&lt;/SPAN&gt;,&lt;/P&gt;&lt;P&gt;tested on &lt;/P&gt;&lt;P&gt;SAP_BASIS	757, SP 0 with HDB 2.00.065.00.1665753120&lt;/P&gt;&lt;P&gt;SAP_BASIS 750, SP 22 with Oracle 19.16.0.0.0 &lt;BR /&gt;  (using 'SESSION_CONTEXT('CLIENT')' does not work in this environment, here I have to use a literal for the client).&lt;/P&gt;&lt;P&gt;Works.&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;&lt;P&gt;Jan&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jan 2023 10:25:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-adbc-with-cds-view-language-session-parameter-is-blank/m-p/12674823#M2016540</guid>
      <dc:creator>jmodaal</dc:creator>
      <dc:date>2023-01-11T10:25:39Z</dc:date>
    </item>
  </channel>
</rss>

