Derived SQL interpretation, reconstructed from the parsed view metadata (data sources, associations, and field mappings). SAP annotations are omitted and the structure is reformulated as SQL — this is a functional approximation, not the verbatim SAP source.
-- Derived SQL interpretation of CDS view CUAN_TG_WITH_NAMES_SEARCH.
-- Reconstructed from parsed metadata (data sources, associations, fields).
-- SAP annotations are omitted and the structure is reformulated as SQL;
-- this is a functional approximation, not the verbatim SAP source. Some join
-- conditions may be unavailable and a few CDS constructs are kept as-is.
CREATE VIEW CUAN_TG_WITH_NAMES_SEARCH AS
SELECT
cuan_d_tg_root.db_key AS DB_KEY,
cast( coalesce( _CUAN_TG_COUNT_MEMBERS.MEMBER_COUNT, cast('0' as int4)) as int4 preserving type ) AS MEMBER_CNT,
cuan_d_tg_root.id AS ID,
cuan_d_tg_root.target_group_name AS TARGET_GROUP_NAME,
cuan_d_tg_root.life_cycle_status AS LIFE_CYCLE_STATUS,
cuan_d_tg_root.description AS DESCRIPTION,
cuan_d_tg_root.crea_uname AS CREA_UNAME,
cuan_d_tg_root.crea_date_time AS CREA_DATE_TIME,
cuan_d_tg_root.lchg_date_time AS LCHG_DATE_TIME,
cuan_d_tg_root.lchg_uname AS LCHG_UNAME,
cuan_d_tg_root.responsible AS RESPONSIBLE,
cuan_d_tg_root.origin AS ORIGIN,
cuan_d_tg_root.origin_db_key AS ORIGIN_DB_KEY,
cuan_d_tg_root.sm_segment_id AS SM_SEGMENT_ID,
cuan_d_tg_root.dynamic AS DYNAMIC,
cuan_d_tg_root.versioning AS VERSIONING,
cuan_d_tg_root.version AS VERSION,
cuan_d_tg_root.man_mbr_changes AS MAN_MBR_CHANGES,
gseg_d_sm_root.name AS ORIGIN_NAME,
cuan_d_tg_root.last_rebuild AS LAST_REBUILD,
cuan_d_tg_root.operation AS OPERATION,
cuan_d_tg_root.definition_id AS DEFINITION_ID,
hpa_d_ed_root.name AS DEFINITION_NAME,
cuan_d_tg_root.comm_area_id AS COMM_AREA_ID,
_commareatxt.CommunicationAreaName AS COMM_AREA_DESC,
cuan_d_tg_root.ref_org_struc AS REF_ORG_STRUC,
gseg_d_sm_root.application_id AS ORIGIN_APPL_ID,
gseg_d_sm_root.profile_id AS ORIGIN_PROFILE_ID,
cuan_d_tg_root.appl_id AS appl_id,
cuan_d_tg_root.ot_id AS OT_ID,
cuan_d_tg_root.ic_comp_name AS IC_COMP_NAME,
cuan_d_tg_root.ia_comp_name AS IA_COMP_NAME,
cuan_d_tg_root.cp_comp_name AS CP_COMP_NAME,
cuan_d_tg_root.gres_ref AS GRES_REF,
cuan_d_tg_root.csv_export_date AS CSV_EXPORT_DATE,
gseg_obj_type_t.ot_text AS LOGON_OT_TEXT,
dd07t.ddtext AS LIFE_CYCLE_STATUS_T,
dd07t.ddtext AS LIFE_CYCLE_STATUS_DESCR,
DD07T_ORIGIN.ddtext AS ORIGIN_T,
DD07T_DYNAMIC.ddtext AS DYNAMIC_T,
DD07T_OPERATION.ddtext AS OPERATION_T,
case when adrp.name_text = '' or adrp.name_text is null then cuan_d_tg_root.responsible else adrp.name_text end as RESPONSIBLE_PERSON_NAME AS name_textendasRESPONSIBLE_PERSON_NAME,
case when ADRP_CREA.name_text = '' or ADRP_CREA.name_text is null then cuan_d_tg_root.crea_uname else ADRP_CREA.name_text end as CREA_UNAME_PERSON_NAME AS name_textendasCREA_UNAME_PERSON_NAME,
case when ADRP_CHNG.name_text = '' or ADRP_CHNG.name_text is null then cuan_d_tg_root.lchg_uname else ADRP_CHNG.name_text end as LCHG_UNAME_PERSON_NAME AS name_textendasLCHG_UNAME_PERSON_NAME,
case when gseg_obj_type_t.ot_text is null then cuan_d_tg_root.ot_id else case when gseg_obj_type_t.ot_text = '' then cuan_d_tg_root.ot_id else gseg_obj_type_t.ot_text end end as OT_TEXT AS ot_textendendasOT_TEXT
FROM cuan_d_tg_root
LEFT OUTER JOIN dd07t ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN gseg_d_sm_root ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN dd07t AS DD07T_DYNAMIC ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN dd07t AS DD07T_OPERATION ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN hpa_d_ed_root ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN dd07t AS DD07T_ORIGIN ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN gseg_obj_type_t ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN I_CommunicationAreaText AS _commareatxt ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN I_User AS usr21 ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN I_User AS USR21_CREA ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN I_User AS USR21_CHNG ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN adrp ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN adrp AS ADRP_CREA ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN adrp AS ADRP_CHNG ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN CUAN_TG_COUNT_MEMBERS AS _CUAN_TG_COUNT_MEMBERS ON DB_KEY = _CUAN_TG_COUNT_MEMBERS.db_key -- association [1..1]
;