experience exchange cds hands on session

Upload: gurushantha-doddamani

Post on 06-Jul-2018

226 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/17/2019 Experience Exchange CDS Hands on Session

    1/22

    Use  this  ti tle slide onl y  wi th an im

    age

    CDS Extension – Hands On

    By Rocky Agarwal, Sakti Mishra, Yeshwant More

  • 8/17/2019 Experience Exchange CDS Hands on Session

    2/22

    © 2015 SAP SE or an SAP affiliate company. All rights resered.

    Agenda

    ! ntrod!ction

    ! Basic "eat!res

    ! S#$ "eat!res

    ! CDS %iew Extension

    ! Enhancement "itho#t $odification

    !  A#tomatic E%tension

    ! Ad%antage

    ! &i'itations

    ! Hands Exercises Contd((

  • 8/17/2019 Experience Exchange CDS Hands on Session

    3/22

    © 2015 SAP SE or an SAP affiliate company. All rights resered.

    ntrod!ction )or *Core Data Ser%ices+

    'A(A introd#ces a Paradigm Shift in Programming $odel

    More )oc

    S& as tDatabase

    Middle Tier 

    HANA database

    Service Layer 

    UI/Application Layer(→ client-side)

    UI enderin!

    "ST (#Data)

    .

  • 8/17/2019 Experience Exchange CDS Hands on Session

    4/22

    /ools – ABA# on Ecli0se

  • 8/17/2019 Experience Exchange CDS Hands on Session

    5/22

    Basic "eat!res

  • 8/17/2019 Experience Exchange CDS Hands on Session

    6/22© 2015 SAP SE or an SAP affiliate company. All rights resered.

    Create a Basic 1iew

    *A+ap,atalog.s-liew(ame/ 3ASI,IE"1

    define iew 3ASI,IE" as select from tc#rc 4

    ey waers6

      isocd6

      gdat#

    7

  • 8/17/2019 Experience Exchange CDS Hands on Session

    7/22© 2015 SAP SE or an SAP affiliate company. All rights resered.

    "here ,la#se

    *A+ap,atalog.s-liew(ame/ 3ASI,IE"2

    define iew 3ASI,IE""'E9E as select from tc#rc 4

    ey waers6

      isocd6

      gdat#

    7 where waers : EU9

  • 8/17/2019 Experience Exchange CDS Hands on Session

    8/22© 2015 SAP SE or an SAP affiliate company. All rights resered.

    2ro!0 By and Ha%ing

    *A+ap,atalog.s-liew(ame/ 3ASI,IE"&

    define iew 3ASI,IE"'AI(< as select from tc#rc 4

    ey waers6

      isocd6

      gdat#

    7

    gro#p +y waers6 isocd6 gdat#

    haing waers lie E=

  • 8/17/2019 Experience Exchange CDS Hands on Session

    9/22© 2015 SAP SE or an SAP affiliate company. All rights resered.

    3oin Conditions – Create 3oins

    *A+ap,atalog.s-liew(ame/ 3ASI,IE"?

    define iew 3ASI,IE"@I(

    as select from tc#rc as c left o#ter Boin tc#r% as % on

      c.waers : %.c#rrey 4

      c.mandt as SAP,lient6

      c.waers as ,#rrency6

    %.c#rrdec as ,#rrencyCecimal6

      c.isocd as ,#rrencyIS,ode

    7

  • 8/17/2019 Experience Exchange CDS Hands on Session

    10/22© 2015 SAP SE or an SAP affiliate company. All rights resered.

    S#$ "eat!res

  • 8/17/2019 Experience Exchange CDS Hands on Session

    11/22

    © 2015 SAP SE or an SAP affiliate company. All rights resered.

    CASE Ex0ressions

    +Si'0le CASE4

    perates lie a switch statement

    Coes not allow to chec for (UDD al#eschec against (UDD always res#lts inFUnnownGH

    *Searched CASE+

    perates lie an if elseif con

    Eal#ates a series of +oolean eret#rns the first e%pression that tr#e

     Allows checs lie JIS (UDDF or

  • 8/17/2019 Experience Exchange CDS Hands on Session

    12/22

    © 2015 SAP SE or an SAP affiliate company. All rights resered.

    Case State'ents

  • 8/17/2019 Experience Exchange CDS Hands on Session

    13/22

    © 2015 SAP SE or an SAP affiliate company. All rights resered.

    CASE Ex0ressions

    +Si'0le CASE4 *Searched CASE+

    @AbapCatalog.sqlViewName: 'ZSFIN_CASE_01'define view zsfin_case_simple as select from  snwd_so as so

    {key so.so_id as order_id ,

    case so.lifecycle_status  when 'N' then 'New'  when 'P' then 'In Progress'  when '' then 'losed'  when '!' then 'ancelled'  else '"nknown'  end  as lifecycle_status

    #

    @AbapCatalog.sqlViewName: 'ZSFIN_CASE_02'define view zsfin_case_searched as select 

    left outer $oin snwd_so_inv_head as inv_heaon inv_head .so_guid % so.node_key{  key so.so_id as order_id , so.currency_code,

      so.gross_amount, case  when  so.gro

       when so.gross_amount )  ((( and  so.gro   when so.gross_amount )  *(((   else '-'

      end  as category, case  when inv_head.node_key is null then 'No

      else  'In  end  as invoice_info

    #

  • 8/17/2019 Experience Exchange CDS Hands on Session

    14/22

    © 2015 SAP SE or an SAP affiliate company. All rights resered.

    Di%ision

    @AbapCatalog.sqlViewName: 'ZSFIN_IV'define view /IN_+I0II1N as select from  snwd_so_inv_head 

    {

      !! "i#isio$ b% ! o$l% possible &o &loats  cast2 gross_amount as abap .fltp ) /  2.0 as  !! IN(E)E*+base" i#isio$:

      "i#2 gross_amount, * 3 as int_4ase_division !! ECI,A-+base" i#isio$:

      !! "i#isio$ si$g &$/tio$ "i#isio$ ag1  "i#isio$2 gross_amount, *, 5 3 as decimal_4

    #

    Di%ision

    Kloating Point operandsIntegerL+ased diision

    CecimalL+ased diision

  • 8/17/2019 Experience Exchange CDS Hands on Session

    15/22

    © 2015 SAP SE or an SAP affiliate company. All rights resered.

    1iews with n0!t #ara'eters

    1iew with in0!t 0ara'eters are not

    s!00orted on all DBs... DBSYS de0endent

    Syntax5

    wit3 paametes 4$ame5 :

    4t%pe5

    Cons!'0tionCependent iews

    penSMD

    @AbapCatalog.sqlViewName: 'ZSFIN_6A*A,_01'define view /IN_P67689:97_(

     with  parameters customer_name ; abap .char ( 80as select from  snwd_so as so  $oin snwd_4pa as 4pa on 4pa.node_key % so{  key so.so_id as order_id , 

  • 8/17/2019 Experience Exchange CDS Hands on Session

    16/22

    © 2015 SAP SE or an SAP affiliate company. All rights resered.

    1iews with n0!t #ara'eters 6Cons!'0tion7

    @AbapCatalog.sqlViewName: 'ZSFIN_6A*A,_01'define view /IN_P67689:97_( with  parameters customer_name ; abap .char ( 80) 

    as select from  snwd_so as so  $oin snwd_4pa as 4pa on 4pa.node_key % so. 4uyer_guid{  key so.so_id as order_id , 

  • 8/17/2019 Experience Exchange CDS Hands on Session

    17/22

    © 2015 SAP SE or an SAP affiliate company. All rights resered.

    1iew Extensions

  • 8/17/2019 Experience Exchange CDS Hands on Session

    18/22

    © 2015 SAP SE or an SAP affiliate company. All rights resered.

    1iew Extension

    Extend existing8deli%ered CDS 1iew with5

    a+le col#mn Arithmetical N ,ASE e%pressions

    Diterals

    Extension *techni9!e+5

     Append to +ase iew

    :ot allowed on 1iews5

    incl#ding

  • 8/17/2019 Experience Exchange CDS Hands on Session

    19/22

    © 2015 SAP SE or an SAP affiliate company. All rights resered.

    Exa'0le

  • 8/17/2019 Experience Exchange CDS Hands on Session

    20/22

    © 2015 SAP SE or an SAP affiliate company. All rights resered.

    &i'itations

    Dimitation of OE%tension/.I(,DUCE is not s#pported implicitly

    CoesnQt s#pport pro%y redirect iews

    Dimitation of e%tend iew(ot allowed on iews/

    incl#ding

  • 8/17/2019 Experience Exchange CDS Hands on Session

    21/22

    CDS Hands On

    DetRs Start

  • 8/17/2019 Experience Exchange CDS Hands on Session

    22/22

    © 2015 SAP SE or an SAP affiliate company. All rights resered.

    /hank yo!