Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

CDS view associations and parameters error

Team,

I am trying to have association between multiple CDS views

Option 1 : If I don't add parameters --> It throws Parameters are needed error

Option 2 : If I add parameters --> It throws Syntax error/ Parameters can not be defined here.

Note : It works when I am using Inner Join instead of Association but then it throws Table length error < 4096

--------------------------

Following is the piece of code

Option 1 :

define view Z_ABC_GROUP1 with parameters

@Consumption.hidden: true

@Environment.systemField: #SYSTEM_DATE

P_KeyDate : syst_datum ,

@Consumption.hidden: true

@Environment.systemField: #SYSTEM_LANGUAGE

P_Language : syst_langu

as select from Z300001Z_PQR_FEATUREMARA_

(P_KeyDate : $parameters.P_KeyDate ,P_Language : $parameters.P_Language)

as PQR_FEATURE

association to Z300001Z_GHI_FILMMARA_ as _GHI_FILM

on _PQR_FEATURE.Material = _GHI_FILM.Material

// Error : Entity Z300001Z_GHI_FILMMARA_ requires parameter P_KeyDate cds-option1-error.jpg

Entity Z300001Z_GHI_FILMMARA_ requires parameter P_Language

---------------------------------------------------------------------------------------------

Option 2 :

define view Z_ABC_GROUP1 with parameters

@Consumption.hidden: true

@Environment.systemField: #SYSTEM_DATE

P_KeyDate : syst_datum ,

@Consumption.hidden: true

@Environment.systemField: #SYSTEM_LANGUAGE

P_Language : syst_langu

as select from Z300001Z_PQR_FEATUREMARA_

(P_KeyDate : $parameters.P_KeyDate ,P_Language : $parameters.P_Language) //Error : unexpected word (; the keyword on was expected cds-option2-error.jpg

as PQR_FEATURE

association to Z300001Z_GHI_FILMMARA_

as _GHI_FILM

on _PQR_FEATURE.Material = _GHI_FILM.Material

1 REPLY 1

dmitry_sharshatkin
Active Participant
0 Kudos

Hello Kunal,

To overcome a limitation with 4096 characters you can try to use CDS extension.

@AbapCatalog.sqlViewAppendName: 'ZS_MY_EXT1'
@EndUserText.label: 'View Extension'
extend view ZS_MY_CDS with ZS_MY_EXTENSION 
association[0..1] to ZS_CASE_PROD_VERS_V as pv on pv.guid = cmg.guid
{
pv.pvs    as my_fld_1, // CHAR 512
pv.pvts   as my_fld_2  // CHAR 1024
}

The rest I did not check. Just had a similar issue with 4096 limitation and found SAP Note: 2154870. Hope it helps.

BR, Dima