cancel
Showing results for 
Search instead for 
Did you mean: 

The field "MATERIALNAME" does not have a corresponding field in the work area

merveguel
Participant
0 Kudos

Hi All,

I am trying to bring the text of a Material field on a Smartfield with using annotation "ObjectModel.text.association". However once I implement it, I am receiving a backend error on ST22 with the text of : "The field "MATERIALNAME" does not have a corresponding field in the work area.". I am building and exposing the CDS views over SADL.

I am following the example on the page 221 from the link : https://s3-eu-west-1.amazonaws.com/gxmedia.galileo-press.de/leseproben/4822/reading_sample_sappress_...

I have already googled, but all the other examples quite the similar of what I am doing (since it is already not too complicated). Could you kindly guide me, what is missing/wrong?

My CDS View:

define view ZMG_CDS_TEST

.

association [0..*] to I_MaterialText as _MaterialText on $projection.matnr = _MaterialText.Material

.

.

@ObjectModel.text.association: '_MaterialText'

@Consumption.valueHelpDefinition: [{entity:{name: 'I_Material', element: 'Material' }}]

matnr,

.

.

/* Associations */

_MaterialText

}

CDS : I_MATERIALTEXT

@AbapCatalog:{

sqlViewName: 'IMATERIALTEXT',

preserveKey: true,

compiler.compareFilter: true

}

@ObjectModel.dataCategory: #TEXT

@VDM.viewType: #BASIC

@AccessControl.authorizationCheck: #CHECK

@EndUserText.label: 'Material Text'

@ObjectModel.representativeKey: 'Material'

@ObjectModel.usageType.serviceQuality: #A

@ObjectModel.usageType.sizeCategory : #L

@ObjectModel.usageType.dataClass: #MASTER

@ClientHandling.algorithm: #SESSION_VARIABLE

@Metadata.ignorePropagatedAnnotations: true

define view I_MaterialText

as select from makt

association [1..1] to I_Material as _Material on $projection.Material = _Material.Material

{

key makt.matnr as Material,

@Semantics.language: true

key makt.spras as Language,

@Semantics.text: true

makt.maktx as MaterialName,

_Material

}

Best,

Merve

Accepted Solutions (0)

Answers (2)

Answers (2)

tom_peng
Explorer
0 Kudos

I encountered a similar problem today when I was trying to enhance the CDS for Purchase Requisition Items in My Inbox. What I found was that adding a normal field to the CDS automatically adds the field to the GET_ENTITYSET structure because part of the entityset structure is done via INCLUDE STRUCTURE. However, adding a text association does not add the field to the entityset structure, so it needs to be added manually. You should be able to find the structure in the public section of the *_MPC class for the Gateway service. Note that text fields are added with a very specific syntax T_FIELD, so if you have a field MATERIAL, then corresponding text field in the entityset structure is T_MATERIAL.

I don't know if re-generating the Gateway service project would automatically add the text field to the entityset structure. I am modifying a standard project, so SAP is preventing me from generating it in SEGW (I'm sure I can find a workaround however).

catalinfeidi
Participant
0 Kudos

Did you find out the root cause?