cancel
Showing results for 
Search instead for 
Did you mean: 

Type Mismatch When Selecting From a CDS View in an AMDP

mosilva
Explorer
0 Kudos

Hi,

I have a main CDS view that selects all the fields I may need at some point. I also have another (subsequent) CDS view selecting just some fields from the main view.

Main view:

Subsequent View:

Now I'm trying to create an AMDP based on the second view. The problem is that I get a "return type mismatch" error as the compiler seems to get the returning structure from the main, not from the subsequent view.

All comments are welcome.
Thanks, Marcos.

Accepted Solutions (1)

Accepted Solutions (1)

pfefferf
Active Contributor

The error message should be quite clear, or not? The result structure prepared by your select/apply_filter does match the required type defined by the type of your AMDP exporting parameter ET_RESERVATIONS with type ZTTMM_ODATA_HEADER. The pepared result needs to have the same structure (same field names, same types). Either you remove the fields for which no value is provided in the result or you adjust your result to match the expected export structure.

Regards,
Florian

mosilva
Explorer
0 Kudos

Hi, Florian.

The main view has an additional field, ResNum, which isn't present in the subsequent view. Nevertheless, the structure of the subsequent view and the structure of ZTTMM_ODATA_HEADER is exactly the same.

And every time I add a field to the main view and try to activate the AMDP, the added field is displayed in the error log. It seems to me that the AMDP is comparing the structure of main view to ET_RESERVATIONS, instead of comparing the subsequent view to ET_RESERVATIONS.

It doesn't make sense as I am not selecting from the main view directly, does it?

Thanks, Marcos.

pfefferf
Active Contributor
0 Kudos

Can you please post the structure of type ZTTMM_ODATA_HEADER?

mosilva
Explorer
0 Kudos

Hi, Florian.

Here it is.

Thanks for helping, Marcos.

mosilva
Explorer
0 Kudos

Thank you, Florian. You found the issue.

I was sure the table type was pointing to a local structure but it was actually pointing to the main view. I must have changed it at some point in time and forgot about it. That explains why adding new fields caused the problem.

Now the table type is pointing to a correct structure and problem is gone.

Answers (0)