diff --git a/cds/cdl.md b/cds/cdl.md index 36141c238..8f6dbab2b 100644 --- a/cds/cdl.md +++ b/cds/cdl.md @@ -2101,7 +2101,21 @@ service CatalogService { Explicitly modelled binding parameters are ignored for OData V2. +#### Returning Media Data Streams { #actions-returning-media} +Actions and functions can also be modelled to return streamed media data like images, CSVs, etc. In order to do so, the action or function's return type has to refer to a [predefined type](#types) annotated with [media data annotations](/guides/providing-services#annotating-media-elements) that is defined in the same service. The minimum set of annotations required is `@Core.MediaType`. + +```cds +service CatalogService { + @Core.MediaType: 'image/png' @Core.ContentDisposition.Filename: 'image.png' @Core.ContentDisposition.Type: 'attachment' + type png : LargeBinary; + + entity Products as projection on data.Products { ... } + actions { + function image() returns png; + } +} +``` ### Custom-Defined Events {#events}