08-30-2019 2:57 PM
Hello colleagues,
Does anyone know a way, how to get a current system ID (SY-SYSID) inside ABAP CDS ?
Thanks, Dima
03-10-2022 1:49 PM
Why not do the following? It should do the job (tested on a 7.50 system).
define view ZIM_I_Project
as select from proj as PR
// session variable SY-SYSID not available: read table TADIR instead
left outer join tadir as SY on pgmid = 'HEAD' and object = 'SYST'
{
key PR.pspid as ProjectID,
SY.srcsystem as SystemID
}
08-30-2019 3:05 PM
I think it's currently not possible. The only session fields are user, client and language (and date).
@AbapCatalog.sqlViewName: 'DEMO_CDS_SESSVAR'
@AccessControl.authorizationCheck: #NOT_REQUIRED
define view demo_cds_session_variables
as
select
from demo_expressions
{ id,
$session.user as system_user,
$session.client as system_client,
$session.system_language as system_language,
$session.system_date as system_date
}
<br>
Edit: added System Date (7.52)
08-30-2019 3:35 PM
Hi Uwe,
Thanks for your reply, I knew that.
Potentially I can get the logical system from the table T000 based on the $session.client, but this is not exactly what I want...
So my question is rather, is there any workaround to get SID via $session variables ?
Thanks, Dima
04-28-2020 11:45 AM
Hello Fetzer,
i see now $sesion.system_date has become obsolete
is there any other option in CDS to get system date
04-28-2020 11:55 AM
Where do you have got the infomation from, that system_date became obsolete? This fields new to 7.51 (link) and I don't think SAP will revert this already again.
08-30-2019 6:36 PM
Well one way could be, with the help of "AbapCatalog.dbHints[ ].dbSystem" you can try to get it by running database queries
https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abencds_f1_view_entity_annotations.htm
Please also check the below,
https://answers.sap.com/questions/3783883/system-information-tables.html
Thanks,
Kaushik
03-10-2022 1:49 PM
Why not do the following? It should do the job (tested on a 7.50 system).
define view ZIM_I_Project
as select from proj as PR
// session variable SY-SYSID not available: read table TADIR instead
left outer join tadir as SY on pgmid = 'HEAD' and object = 'SYST'
{
key PR.pspid as ProjectID,
SY.srcsystem as SystemID
}