CDS View with input parameters Part 7 ABAP on HANA Course

SAP TECHNOMANIAC
1 Jul 202221:55

Summary

TLDRThis video tutorial delves into the creation and use of parameterized CDS (Core Data Services) views in SAP. It explains how to define parameters for a CDS view, making some mandatory and others optional by setting default values. The video walks through examples of passing parameters such as sales order numbers and dates, and shows how default system fields like client, system date, and user ID can be applied. Additionally, the tutorial discusses the differences between DDIC-based CDS views and new CDS entity views, providing insights on how to manage parameters effectively.

Takeaways

  • 📊 Parameterized CDS views require user input for certain values to execute, especially for filtering data dynamically.
  • ⚙️ Parameters can be passed during the execution or while calling the CDS view in a select statement.
  • 💡 Defining parameters in a CDS view allows more flexibility as users can input values instead of relying on constants.
  • 📝 Parameters need to be referenced using the `$parameters` syntax to pass the user input into WHERE conditions.
  • 🚫 All parameters are mandatory unless a default system value (like system date or client) is assigned.
  • 📅 You can define multiple parameters, including dates, and use them in the WHERE clause or output fields.
  • 🚀 Default values for parameters can be assigned using system variables (e.g., system date), making those parameters optional during execution.
  • 🔧 When using parameters in output fields, an alias must be specified.
  • 📝 SAP provides system fields like system date, system time, and client as default values, but only a few system fields can be used as defaults.
  • 🖥️ SAP's standard demo programs provide examples for testing and understanding parameterized CDS views.

Q & A

  • What is a parameterized CDS view in SAP?

    -A parameterized CDS view is a Core Data Services (CDS) view that accepts input parameters. When executing the view, it asks for parameter values, and only after these values are provided does it generate the output.

  • Why would you use a parameterized CDS view instead of a normal CDS view?

    -You would use a parameterized CDS view when you want to control which data is displayed by asking the user to provide specific input values. This makes the view more dynamic and flexible, as it can return different results based on the parameters passed.

  • How do you define a parameter in a CDS view?

    -To define a parameter in a CDS view, you add the `with parameters` clause after the view entity definition. You specify the parameter name, its data type (like ABAP types or data elements), and optionally default values using system variables.

  • Can you explain how to access a parameter in a WHERE clause in CDS?

    -To access a parameter in a WHERE clause, you use the `$parameters` keyword followed by the parameter name. For example, `$parameters.p_vbeln` would be used to access a parameter named `p_vbeln` and pass its value to the WHERE clause.

  • Are parameters in a CDS view always mandatory?

    -Yes, parameters in a CDS view are mandatory by default. However, there is an exception if you provide a default value using system fields (like system date, system client). In such cases, the parameter is not mandatory.

  • What annotation is used to assign a default value to a parameter in a CDS view?

    -The `@Environment.systemField` annotation is used to assign default values to parameters in a CDS view. This annotation allows you to use predefined system values like the system date, time, client, etc.

  • What happens if you don't pass a parameter value when calling a parameterized CDS view in ABAP?

    -If a mandatory parameter is not passed when calling a parameterized CDS view in an ABAP program, the system will raise a syntax error or cause a dump, indicating that the parameter is missing.

  • Can a parameter be used in fields other than the WHERE clause?

    -Yes, parameters can be used in various parts of the CDS view, such as the field list, WHERE clause, or even in aggregation and on conditions. You can access the parameter value using the `$parameters` expression.

  • What types of system fields can be used as default values in CDS parameters?

    -The system fields that can be used as default values include the system client, system date, system time, system user, system language, and system timezone.

  • What is the difference between a DDIC-based CDS view and a CDS view with entity definitions?

    -A DDIC-based CDS view can use colon syntax (:) to access parameters, while a CDS view with entity definitions requires the use of the `$parameters` expression. The newer entity-based CDS views have stricter syntax rules.

Outlines

00:00

👋 Introduction to Parameterized CDS Views

The video begins with an introduction to parameterized CDS views in SAP. It explains that parameterized CDS views require user input to display data and discusses the importance of parameters when executing or using CDS views in select statements. A step-by-step guide is provided on how to convert a normal CDS view into a parameterized one by adding a parameter called `p_vbln` for the sales order number. The video emphasizes that the view will only execute if the user provides the required parameter.

05:00

⚠️ Parameters in Select Statements and Syntax Errors

This section explains the importance of passing parameters when calling parameterized CDS views in select statements. If parameters are not provided, the view will generate an error or dump. The video demonstrates how to resolve syntax errors by binding the required parameter `p_vbln` and passing the sales order value. It also highlights the strict nature of mandatory parameters and the impact of omitting them.

10:02

📅 Adding Multiple Parameters and Default Values

The presenter introduces adding multiple parameters to a CDS view and assigning default values to avoid mandatory input requirements. A new date parameter (`p_date`) is added, and it is explained that default values for certain system fields (e.g., client, system date, system time) can make these parameters optional. The video showcases how the date parameter displays either user input or defaults to the system date if no input is provided.

15:03

🛠️ Using Environmental Annotations for Default Values

This section focuses on environmental annotations, specifically `@Environment.systemField`, used to assign default values to parameters in CDS views. The video explains that only certain system fields (e.g., system date, client, user ID) can be set as default values. A demonstration is given on how to activate and execute the CDS view when a default value is set, showing that mandatory fields become optional if they have a system-defined default.

20:04

📝 SAP Standard Program and Demo for Parameterized Views

The final section covers an SAP standard demo program that uses a parameterized CDS view with system default values. The video explains how parameters in this demo are not mandatory due to default values and shows how the program handles both cases—when parameters are passed and when they are omitted. The difference between DDIC-based CDS views and new CDS view entities is also discussed, particularly regarding syntax differences when accessing parameters.

Mindmap

Keywords

💡Parameterized CDS View

A Parameterized CDS View is a type of Core Data Services (CDS) view in SAP HANA that allows users to pass parameters to filter or customize the data retrieval. In the video, the presenter explains how to convert a normal CDS view into a parameterized one by defining parameters after the view entity. This feature is crucial as it enables dynamic data retrieval based on user input, as demonstrated when the presenter creates a parameter 'p_controls' to filter sales order numbers.

💡CDSU

CDSU stands for CDS Update View, which is a type of CDS view used for updating data. In the script, the term is used in the context of executing a CDS view that prompts for parameter values. The presenter uses CDSU to show how the view behaves when parameters are not provided, leading to errors, and how providing parameters resolves these issues.

💡Mandatory Parameters

Mandatory parameters are those that must be provided for the CDS view to execute successfully. The video emphasizes the importance of mandatory parameters by showing that if they are not supplied, the view will not execute, as indicated by the star symbol next to the parameter name in the script.

💡Default Value

A default value is a pre-set value for a parameter that makes it optional to provide a value during execution. The video script explains how to assign a default value to a parameter using environmental annotations, such as 'system date', which allows the parameter to be non-mandatory. This is demonstrated when the presenter adds a date parameter with 'system date' as the default value.

💡Environmental Annotation

Environmental annotations are used to assign default values to parameters based on system variables like 'system date' or 'system time'. In the video, the presenter uses the annotation 'environment.system_field' to assign the system date as a default value to the date parameter, illustrating how this can make a parameter non-mandatory.

💡DDIC-Based CDS View

DDIC stands for Data Dictionary Independent Component. A DDIC-based CDS view is created using the data dictionary structure in SAP. The script contrasts DDIC-based CDS views with defined view entities, mentioning that in DDIC-based views, parameters can be accessed using a colon, whereas in defined view entities, the '$parameter' expression must be used.

💡Activation (Ctrl+F3)

Activation in the context of the video refers to the process of enabling or preparing a CDS view or program for execution in SAP. The presenter uses the term while discussing the steps to activate a parameterized CDS view after defining parameters, highlighting the transition from creation to execution.

💡Select Statement

A select statement is a part of SQL used to retrieve data from a database. In the video, the presenter mentions calling a CDS view within a select statement, emphasizing how parameters must be passed for the view to function correctly within this context.

💡Expression Table

An expression table is a temporary table used for storing data during the execution of a program. The video script refers to an expression table when discussing how data is manipulated before being passed to a CDS view, showing how expression tables can be used to manage data dynamically.

💡SFP

SFP stands for SAP Fiori Launchpad, a platform for launching SAP Fiori apps. The video is part of an SFP series, indicating that the content is aimed at helping users understand and work with Fiori applications, including the creation and use of parameterized CDS views.

Highlights

Introduction to parameterized CDS views and their role in executing queries with user-defined parameters.

Demonstrating how parameters in a CDS view ask for user input, ensuring the query result is based on that input.

Creating a parameterized CDS view by adding a parameter after defining the view entity name.

Usage of system annotations to create default values for parameters, making them optional.

Explanation of using system variables like system date, time, and user data as default values in parameterized CDS views.

Illustration of converting a standard CDS view into a parameterized CDS view by using the 'with parameters' clause.

Showing how parameters can be used in the WHERE clause to filter results dynamically based on user input.

Clarification on the usage of '$parameters' to access user input values in the CDS query logic.

Default parameter values can only be assigned from system variables like client, system date, and user.

Steps to activate a parameterized CDS view and how to test it by running a program in ABAP.

Showing how using parameters in the field list can help display user-entered data directly in the output.

Demonstrating the use of multiple parameters in a CDS view by separating them with commas.

Explaining the importance of aliasing parameters in the field list for proper view activation.

Illustrating how to call parameterized CDS views within ABAP programs and handling the mandatory nature of parameters.

SAP’s best practices and guidelines for working with parameterized CDS views, including a reference to SAP's standard demo program for further experimentation.

Transcripts

play00:00

hello everyone welcome to sfp

play00:01

technomaniac in this video we will learn

play00:04

about the parameterized cds view and we

play00:06

will able to answer some of the best

play00:08

equations like when we use the parameter

play00:10

cdsu is it all the parameters are

play00:13

mandatory to enter in the cds view or

play00:15

there is some exception as well where we

play00:17

will

play00:18

not enter some parameters value still

play00:20

our serious view will be executing so

play00:23

let's get started

play00:25

to create a view with parameter i will

play00:27

use same

play00:29

tds which we have created in my last

play00:31

video

play00:32

so

play00:34

this is the normal cds view we will

play00:36

convert the cds view into a

play00:38

parameterized cds view

play00:40

what i mean by the parameter is cdsu

play00:43

whenever we execute this particular cds

play00:46

view it will ask for the some value when

play00:48

we enter that value then only the result

play00:51

will be displayed

play00:52

not only the

play00:54

exit on the execution but also when we

play00:57

call this particular cdsu in my select

play01:00

statement

play01:01

uh then also

play01:03

it will ask for the values and then only

play01:06

it will be activated

play01:10

what i will do

play01:12

i will use i will create one parameter

play01:15

for this particular cds view for

play01:17

creating a parameter you after the

play01:19

defined view entity and we are giving

play01:22

the entity name just after that we have

play01:24

to write with parameters

play01:26

and as soon as

play01:27

we will write with parameter i have to

play01:29

give the parameter name so what is the

play01:32

parameter name p underscore controls

play01:35

i have to give the vbln as a parameter

play01:37

because instead of passing this

play01:39

parameter is a constant value i

play01:42

currently when i am executing this

play01:45

particular cdsu entity i have passed in

play01:48

where condition as a sales order is a

play01:51

sixth sales order number i am displaying

play01:53

in the output but i want

play01:56

that user should enter any sales order

play01:58

number that should be displayed in the

play02:00

output so for that purpose i have

play02:02

created this parameter p underscore vbln

play02:05

i have to give the parameter name then

play02:07

the column then i have to give the type

play02:10

of this particular parameter i can use

play02:14

any about type of parameter or system

play02:17

default whatever the environmental

play02:19

parameter which is we are using whenever

play02:21

we are defining that any day variables

play02:23

in the normal program those all we can

play02:25

use data element also we can use so in

play02:28

this case we will use the data element

play02:30

we know the type should be vblm so i

play02:32

have used the vbl and as a type

play02:35

so as soon as i have defined this

play02:37

particular parameter

play02:39

now the system is telling like that you

play02:41

have defined this parameter

play02:43

but but you are you are not using this

play02:46

particular parameter in anywhere in your

play02:49

cds

play02:50

so for this purpose i want to access

play02:52

this parameter in my wire condition so

play02:55

instead of passing this constant

play02:56

whatever the user will enter

play02:59

in the parameter value that value i will

play03:01

pass

play03:02

in this where condition for that purpose

play03:04

to access the parameter in the system

play03:07

what i have to use i have to use the

play03:10

dollar

play03:14

parameters

play03:15

and if i do control space all the

play03:17

parameters will be displayed and i will

play03:19

pass this

play03:20

sales order number which user have

play03:22

entered that in the where condition and

play03:25

it will be displayed once the user do

play03:27

app hit let me activate this one control

play03:29

f3

play03:32

of now just ignore this program where we

play03:33

are using this particular cds view

play03:37

ok i have activated this particular

play03:39

program let me do

play03:42

fade to this particular cds view

play03:45

f8

play03:48

so it soon i did the effect you can see

play03:50

it is asking for the parameter value

play03:52

because i have defined one parameter in

play03:54

my cds view

play03:56

i can and this is also mandatory i can

play03:58

see the star symbol means it's a

play03:59

mandatory that's very important thing so

play04:01

i have to pass this value then only the

play04:04

cdsu will be executed otherwise it will

play04:05

be not executed so one two three four

play04:08

five six seven eight nine and any number

play04:11

i can give i use the six number because

play04:13

we were using previously

play04:15

and i am clicking on ok button then the

play04:18

output will come this time instead of

play04:20

where condition we have

play04:25

we have passed the

play04:28

through const instead of passing through

play04:30

constant we have passed as a parameter

play04:32

this particular sales order value and we

play04:35

can see the result

play04:37

or let me do f8 once again this time i

play04:39

will pass instead of six sales order

play04:41

some other sales order

play04:45

i can pass suppose i have a passport to

play04:47

sales order and i will do

play04:49

so you can see i this time i got that's

play04:52

order number four so like that

play04:55

i can get any sales order detail when i

play04:58

pass the sales order value this is the

play05:00

normal thing

play05:01

so as you remember from my previous

play05:04

video i have called this particular cds

play05:07

view

play05:08

in my one of the program

play05:10

that time that this particular cdsu was

play05:13

not

play05:14

this particular cds view was not

play05:16

parameterized

play05:17

and here we

play05:19

we normally call the cds view and we got

play05:22

the result easily but now if i try to

play05:25

do f8 i will get the dump

play05:28

because now you have converted your cds

play05:31

you to the parameter cds view and you

play05:34

don't pass those parameters here because

play05:36

parameters are mandatory

play05:38

you have to pass there is one exception

play05:40

case that also i will explain but as of

play05:43

now you can see parameters are mandatory

play05:45

and uh

play05:46

since we didn't pass this particular

play05:48

parameter so it will give us a dump and

play05:50

if you try to activate this one we will

play05:52

get on first place the

play05:55

syntax error you can see activation

play05:57

failed with the error c problem view

play05:59

basically we got the syntax error what

play06:01

syntax error the parameter was not bound

play06:04

we didn't pass any parameter

play06:06

so for how to pass the parameter when we

play06:09

call the cds

play06:10

view or cds entity in our select

play06:13

statement what is just after the cdsu

play06:17

entity name we have to click on control

play06:19

space

play06:21

control z control space

play06:25

just

play06:31

so i can give the p underscore vbl and

play06:34

value and i have to pass p underscore

play06:36

vbln value i can pass any value one two

play06:38

three four five six seven eight

play06:40

nine ten

play06:42

so i have passed this particular sales

play06:43

order value to display in the output i

play06:46

am using the cl demo output to display

play06:48

in the output i have passed you can see

play06:50

that particular syntax error got removed

play06:53

because i since my

play06:55

the cds view entity is the parameterized

play06:58

and i have passed this particular

play06:59

parameter as well let me activate this

play07:01

one control f3

play07:03

and let me see the result

play07:06

if i do f9

play07:10

so

play07:11

let me open console over here so you can

play07:13

see the result as well let me clear out

play07:16

the console and do the f9 again

play07:21

so i go to the result with the fourth

play07:23

size

play07:24

sales order number four fourth and other

play07:26

detail also i put

play07:28

like that i can call the parameterized

play07:30

cds view in my ab report or my program

play07:34

now

play07:35

the other thing is i told you

play07:38

the parameters are mandatory we have to

play07:41

pass there is one exception

play07:44

if we can give some default value to

play07:47

this parameter

play07:49

then these are not mandatory

play07:52

and the default value we can give is

play07:55

only as a system variables

play07:58

so how to give the default value for

play08:00

explaining purpose i will add one more

play08:02

parameter to our cds that will be the

play08:04

date

play08:05

so what i will do if you want to add

play08:07

multiple parameter to particular cds you

play08:10

have to give the comma separated list i

play08:12

have to do comma

play08:14

and i have to give another

play08:16

parameter which i want to give this will

play08:18

be the date parameter i want to give the

play08:20

date parameter over here and the type

play08:22

should be

play08:24

i can use this time the ab date is a

play08:30

it's

play08:31

is a parameter

play08:33

so this will uh

play08:36

again i have created one more parameter

play08:38

and i didn't use this time instead of

play08:40

using in my where condition i will use

play08:43

this particular parameter in my

play08:46

filled list

play08:47

so you can use in the field list or if

play08:50

you are doing any automatical operation

play08:51

there also you can use if you are doing

play08:53

any aggregation operation there also you

play08:55

can use and if you can you can use on

play08:58

the on condition filter condition or in

play09:00

wire condition anywhere you can use this

play09:02

parameters as per your requirement

play09:04

so i just want to display this

play09:06

particular p underscore date to access

play09:08

this particular parameter again i have

play09:10

to use this

play09:12

a dollar

play09:14

parameter expression and control space

play09:18

we underscore date

play09:20

i want to display this date whatever

play09:22

user have entered

play09:23

so if i do control f3

play09:28

one more important thing if you are

play09:29

using the

play09:30

i got the error if you are using

play09:33

the parameter

play09:34

in the field list you have to

play09:36

mandatorily give the alias name so i

play09:39

have to give some alias name then only i

play09:41

can use is

play09:42

just date

play09:44

i can give some name

play09:46

just date now i will not get the error

play09:48

let me do activation of this control f3

play09:51

and now our

play09:52

tdsu entity got activated now let me

play09:56

execute this span

play09:58

you can see i can enter two parameter

play10:01

but both parameters are mandatory

play10:04

let me pass some value 1 2 3 4 5 6 7 8 9

play10:08

10

play10:09

and let me pass some date also 1991 1104

play10:13

or some any date you can pass

play10:16

and because it is mandatory to pass the

play10:18

date otherwise this particular view

play10:20

entity will be not executed let me do

play10:22

okay

play10:25

and we can see the result

play10:28

let me open over here

play10:30

so this system did go uh this this date

play10:34

whatever i have entered the date with

play10:36

same date got displayed over here

play10:39

but that was mandatory

play10:41

as i told you there is one hack over

play10:43

here i can there one exception where we

play10:45

can

play10:47

though those parameters are mandatory

play10:49

in those cases those parameters will be

play10:52

not mandatory so for making that i have

play10:54

to pass some default value to the

play10:56

parameter

play10:57

so default value to parameter i can pass

play10:59

only the four or five very values are

play11:02

there that i can pass as a default value

play11:04

like this client values system date

play11:07

system time

play11:09

or

play11:10

system variables basically i want to say

play11:12

system variable i can pass as a default

play11:14

value and since it is a date field i can

play11:17

pass a system date as a default value

play11:19

and this will be not mandatory because i

play11:21

have passed this parameter as a default

play11:23

value so let me do for that purpose i

play11:26

have to use one again one new annotation

play11:29

will learn environmental

play11:31

environment

play11:33

annotation let me

play11:35

write it down and wire

play11:38

environment dot system field to access

play11:40

system field this is particular

play11:41

annotation is very very useful and this

play11:45

system field it will give the default

play11:47

value to the particular this date

play11:49

because we defined this particular

play11:51

annotation just

play11:53

above the this particular date either we

play11:55

can define over here or just after this

play11:57

p date also we can define so let me do

play12:00

what value i want to use here then i can

play12:02

use only five values client system date

play12:05

system language system type user or one

play12:07

more thing is there user date and user

play12:09

time zone six values only

play12:12

is a parameter with the default this six

play12:14

value is

play12:16

i can use as a default value apart from

play12:18

that and any value i can't use as a

play12:20

default value

play12:22

so these are the values i can easily use

play12:24

as a default value i will use system

play12:26

date in this case as a default value

play12:29

and i will activate my tds view entity

play12:36

let me analyze little bit over here and

play12:38

let me activate it ctrl f3

play12:41

one interesting thing you will see

play12:43

when you execute this one

play12:46

now you can see this date is not

play12:47

mandatory but sales order is still

play12:49

mandatory you have to pass the size of

play12:51

that one two three four five six seven

play12:53

eight nine

play12:54

and ten any sales order i can display

play12:57

okay

play13:00

so sales order nine got displayed but

play13:04

the important thing is that which i want

play13:05

to show you this time

play13:07

uh system date go displays two days did

play13:10

what is the two days that because i

play13:11

didn't pass any date value so it took

play13:13

the system date and that date got

play13:15

particular date code displayed in the

play13:17

output

play13:19

and with the same goes with the

play13:21

this one also if i will not define this

play13:24

particular

play13:25

parameter is a default if i will not

play13:28

pass any default value

play13:31

ctrl z ctrl x and control f3 and i will

play13:36

try to activate this particular program

play13:38

where i have used this particular cds

play13:40

entity it will give me error

play13:44

what error i will get

play13:46

okay let me activate this first

play13:49

ctrl f3

play13:51

and let me activate this particular

play13:53

program as well control f3

play13:57

i got one error activation failed with

play13:59

the

play14:00

this will basically say you didn't pass

play14:02

date is a mandatory if i pass this date

play14:05

also p underscore date some value

play14:08

then i will not get that error

play14:10

what i will pass

play14:12

1991-0202

play14:14

something i can pass so

play14:17

since i have passed the now this

play14:19

particular since we have to pass here

play14:21

comma as well if we are passing the

play14:22

multiple uh parameter so

play14:25

if i try to activate now control f3 i

play14:28

will not get any error and if i do f9 as

play14:31

well then i will get the result pro

play14:33

result also there you go i got the

play14:35

result but this time date is different i

play14:37

go to some other date

play14:39

system date i got here in previous

play14:41

execution i didn't get the system date

play14:43

because i didn't that time in my

play14:46

parameter the system date was not there

play14:48

so it's a simple simple thing but if i

play14:51

use uh

play14:53

environmental system field

play14:55

and if i activate now this control f3

play14:59

and

play15:00

if i pass then whatever i am passing

play15:03

that will be displayed and if i don't

play15:05

pass this particular date

play15:07

and i will try to activate this time it

play15:09

will get activate because i pass default

play15:11

value using the environment environment

play15:14

annotation so that is the reason it is

play15:16

getting activated and if i try to get

play15:18

the result see the result in console let

play15:21

me do f9

play15:23

so i got this time but the date is a

play15:26

system date two days date i got and the

play15:29

result you can see how we are getting

play15:32

so like this is the way we can create

play15:34

the parameters cdsu before going further

play15:37

i just want to show you one sfp standard

play15:39

program there if you if you want to do

play15:43

experimental

play15:45

experimental thing with the parameter

play15:47

things so i have something standard

play15:49

program that is very useful control c

play15:51

and this is

play15:52

what this is written i have written the

play15:54

same thing whatever i return

play15:57

let me close everything

play15:59

else

play16:01

so it's written like the same thing

play16:03

default value can be assigned with the

play16:05

annotation this annotation and parameter

play16:08

are optional only when the default value

play16:10

is assigned we can assign the default

play16:11

value to parameter how we can assign

play16:14

using the environmental annotations

play16:16

environmental annotation we have the

play16:17

limitation only five or six

play16:19

environmental annotations we can use and

play16:21

we can as i assign as a default value

play16:23

and we can only use the system field to

play16:26

search as a system date system language

play16:28

as a default value other value we can't

play16:30

use so basically we can say apart from

play16:32

this six value we can't pass any default

play16:34

value and other

play16:36

apart from 56 value if you are using any

play16:38

other value then the parameter will

play16:40

become the mandatory

play16:42

and we have one

play16:43

cdsu control c

play16:46

control shift a

play16:47

control v

play16:48

let me this is sfp standard demo cdsu

play16:52

which used in this particular program i

play16:54

just want to show you this particular

play16:56

program

play16:57

this we how we usually do the this is

play17:00

main method we are this is local class

play17:02

demo uh and we have one static main

play17:05

method which we are calling instead of

play17:07

selection inside that they have one demo

play17:10

expression table that first what they

play17:12

are doing they are deleting everything

play17:14

from this demo expression table then

play17:17

they are inserting one entry with the id

play17:20

one if you see this demo expression

play17:22

table it is having the id field as a key

play17:25

field i just want to show you id field

play17:27

is a key field they have entered one

play17:29

entry with the other field are blank

play17:31

then what they are doing they are

play17:33

pulling on cdsu if you see this

play17:35

particular cdsu

play17:38

this is ddic based cds view i will show

play17:40

you

play17:41

the this is the

play17:43

ddac based cdsu you can see in this ddac

play17:47

base cdsu they are using

play17:49

four parameter or four or five parameter

play17:52

one two three four five parameter they

play17:54

are using all parameters are

play17:56

uh they are using the some default value

play17:58

using this particular environmental

play18:01

environment annotation

play18:03

and all the fields they are displaying

play18:05

in the output and one more thing they

play18:07

are just using id1 which they have

play18:09

inserted that particular entry so this

play18:11

is basic demo cds view given for the

play18:14

purpose of the how we can pass the

play18:17

default value values to parameter one

play18:19

what all are the values are possible

play18:20

only these five values are possible so

play18:22

they have used all

play18:24

five values so what they are doing

play18:26

if i do the f9 or f8 to this particular

play18:30

cds view you can say f8

play18:33

and all

play18:35

four parameters are there one two three

play18:37

four and all are not mandatory actually

play18:41

hola

play18:42

not mandatory if i do i if i do the f8

play18:46

over here uh if i click on ok button

play18:48

still is it will display some result

play18:50

with the system date client userid

play18:52

language and other detail it will

play18:54

display the error and if i call this

play18:56

particular cds you can so in the program

play18:59

also they have called in one select

play19:00

statement they have passed the all the

play19:03

parameter in another select statement

play19:04

they didn't pass any parameter but still

play19:07

we can see

play19:09

in both the cases we will get the same

play19:11

result and i just want to show you let

play19:13

me do f9

play19:15

you can see we got the result client

play19:18

date you date field time and both the

play19:20

cases we have got the same result from

play19:23

this particular program this is the one

play19:25

of the sfp standard demo program which i

play19:28

have used but one more important thing i

play19:31

just want to do might have seen what is

play19:33

this

play19:33

semicolon doing here we are accessing

play19:36

this particular parameter using the

play19:38

colon

play19:40

this got absolute

play19:42

because

play19:43

they have used the ddic based

play19:45

3ds view

play19:47

this ddic based cdsu we can use still

play19:50

this colon but in the if i try to use in

play19:53

my

play19:54

entity define view entity this

play19:56

particular

play19:57

cds like this this particular to access

play20:00

the parameter i will use colon then it

play20:03

will give us you have to use the

play20:04

expression this particular expression

play20:06

dollar parameter expression you have to

play20:08

use instead of this so that is the

play20:10

reason

play20:11

the uh in the

play20:12

define view entity or new cds view

play20:15

entity we have the stricter syntax check

play20:18

so we have to follow strictly

play20:21

uh

play20:22

we have to use pyramid dollar parameter

play20:24

only so one simple thing i just want to

play20:28

for this cds also we have another

play20:31

cds also there let me show you that cds

play20:34

also uh let me go here ctrl c

play20:38

ctrl c this is fills v

play20:42

and let me do ctrl shift a

play20:44

ctrl v

play20:45

this is the another cds is there

play20:49

where this is

play20:51

this cds and this cds both are similar

play20:54

but this is

play20:56

ddic based cds view

play20:58

this one and this one is the

play21:00

defined view entity means the cds view

play21:03

with entity a defined created with the

play21:05

cdsu entity in uh newer way of the

play21:09

view creation that newer way that is the

play21:11

reason in this they have used the colon

play21:13

and in this they can't use column they

play21:15

have to use mandatory dollar parameter

play21:17

and in this case they have created one

play21:19

sql view in this in this case we we

play21:21

don't have any sql

play21:23

this is the one of the example i just

play21:25

want to show you sf standard example

play21:27

so if you want to see because this kind

play21:29

of example available in every system you

play21:31

can experiment you can copy this program

play21:33

past in

play21:34

your local

play21:36

local program and you can do whatever

play21:38

you want i hope you learn something new

play21:40

from this video before going to next

play21:43

video please like this video

play21:45

subscribe this channel and share these

play21:47

videos with others as well with that

play21:50

thank you and happy learning

Rate This

5.0 / 5 (0 votes)

Etiquetas Relacionadas
CDS ViewsSAP TutorialsParameterized ViewsMandatory ParametersDefault ValuesSystem VariablesABAP ProgrammingTech TipsData ElementsSAP Best Practices
¿Necesitas un resumen en inglés?