Domain Modelling mu SAP CAP

Introduction

Domain Model mu SAP CAP ndi chitsanzo chomwe chimalongosola zinthu zosasunthika, zokhudzana ndi deta za dera lazovuta malinga ndi zitsanzo za mgwirizano wa mabungwe. M'nkhaniyi tiphunzira Domain Modelling mu SAP CAP mwatsatanetsatane.

Domain Modelling

M'mawu osavuta, CDS mu SAP CAP imapanga chitsanzo cha domain m'njira yomwe imatanthawuza vuto la bizinesi malinga ndi makiyi, minda ndi zolemba. Khodi yopangira mtundu wa domain imalembedwa mu CDS schema (db/schema.cds). Zitsanzo za madambwe izi zitha kugwiritsidwa ntchito mu Tanthauzo la Utumiki, Mitundu Yolimbikira, Ma Databases kapena kugwiritsidwanso ntchito mkati mwachitsanzo china.

Chitsanzo:

Namespace empInfo; kugwiritsa ntchito {Ndalama, yoyendetsedwa} kuchokera ku '@sap/cds/common'; bungwe Ogwira ntchito: oyendetsedwa {key ID: Integer; Dzina loyamba: Chingwe chokhazikika (111); LastName: Chingwe chokhazikika (1111); woyang'anira: Mgwirizano kwa Otsogolera; tsikulojoining: Integer; malipiro: Decimal (9,2); ndalama: Ndalama; }

 

Muchitsanzo ichi tapanga fayilo schema.cds pomwe tapanga bungwe la Ogwira ntchito lomwe limaphatikizapo zambiri za Wogwira Ntchito.

Dongosolo lonseli lapatsidwa dzina la empInfo

Dongosololi limagwiritsa ntchito mtundu wokhazikika wa data mwachitsanzo, Ndalama. Kugwiritsa ntchito mtundu wamtundu wa data wotere kumatithandiza kubweretsa zonse zomwe zafotokozedweratu zothandiza zokhudzana nazo.

Timagwiritsa ntchito CDS kupanga Model. Mu CDS imeneyo, timagwiritsa ntchito

  1. Mabungwe oyimira gulu la zinthu zapadera mwachitsanzo:
    1. Employee Basic Information
    2. Zambiri Zolumikizana ndi Antchito
    3. Zambiri za Malipiro Ogwira Ntchito
  2. Mabungwe ofotokozera maubwenzi
    1. Kugwirizana kwa Manager kupita ku bungwe lina lomwe lidzakhala ndi mndandanda wa Oyang'anira

Kutchula Msonkhano & Malangizo

  1. Dzina la bungwe liyenera kuyamba ndi chilembo chachikulu ndipo liyenera kuwerengedwa ndi anthu komanso kudzifotokozera - mwachitsanzo, Ogwira Ntchito
  2. Yambani zinthu ndi zilembo zazing'ono - mwachitsanzo, firstName
  3. Ndibwino kugwiritsa ntchito mabungwe ambiri - mwachitsanzo, Ogwira Ntchito
  4. Ndibwino kugwiritsa ntchito mtundu umodzi wa mitundu - mwachitsanzo, Ndalama
  5. osabwereza zomwe zikuchitika - mwachitsanzo, Employees.name m'malo mwa Employees.EmployeeName
  6. amakonda mayina a liwu limodzi - mwachitsanzo, malipiro m'malo mwa salaryAmount
  7. gwiritsani ntchito ID pamakiyi apamwamba aukadaulo - mwachitsanzo, ID ya ID ya Wantchito
  8. Mutha kugwiritsa ntchito Namespace kupanga mabungwe anu kukhala apadera. Zili ngati lingaliro la kasitomala mu SAP pomwe mutha kukhala ndi ma schema obwereza (mafayilo a cd) okhala ndi Namespace apadera kuti muwasiyanitse. Malo a mayina ndi osankha, gwiritsani ntchito malo ngati mafanizidwe anu angagwiritsidwenso ntchito m'mapulojekiti ena. Kumapeto kwa tsiku amangokhala ma prefixes, omwe amangogwiritsidwa ntchito ku mayina onse ofunikira mufayilo. - Mwachitsanzo,

namespace laputopu; gulu Dell {}

..… ikufanana ndi:

laputopu.Dell {}

  1. Mutha kugwiritsa ntchito magawo amtundu wamalo osankhidwa. - Mwachitsanzo,

namespace laputopu; gulu Dell {}           //> laputopu.Dellnkhani Apple {nthu MacBookPro {}       //> laputopu.Apple.MacBookPro     gulu MacBookAir {}}

 

Mabungwe

Mabungwe ali ngati matebulo okhala ndi makiyi oyamba. Titha kuchita ntchito ya CRUD pogwiritsa ntchito Mabungwewa. Zisungeni mobisa momwe mungathere. Osapitirira Normalize izo. Osagwiritsa ntchito mitundu yosagwiritsidwanso ntchito. Gawoli ndi lachitsanzo chokha, mawu okhawo okhudzana ndi magawo omwe ayenera kuwonjezeredwa ndipo palibe zaukadaulo (zomveka) zomwe ziyenera kuwonjezeredwa.

mitundu

Mitundu ili ngati Domain mu SAP ABAP, inkagwiritsa ntchito kufotokozera mtundu wa zinthu za Data.

Zotsatira

Mbali ndizowonjezera za Ma Models ndipo zimagwiritsidwa ntchito makamaka kukulitsa matanthauzidwe ndi mafotokozedwe omwe alipo. Chitsanzo chikafotokozedwa, titha kugwiritsa ntchito mafayilo osiyanasiyana a cd (Aspect) kuti tiwonjezere zolemba pamwamba pa ntchito inayake.

Mwachitsanzo-

  • CD- Chitsanzo chanu chachikulu cha domain, chosungidwa choyera, chosavuta komanso chomveka
  • audit-model.cds- imawonjezera magawo owonjezera ofunikira pakuwunika mufayilo
  • auth-model.cds- amawonjezera zofotokozera za chilolezo.

Mafungulo Oyambirira

Monga matebulo & CDS mu SAP ABAP, timasunga makiyi Oyambirira a Gulu pogwiritsa ntchito mawu osakira kiyi.

Kiyi yoyambirira itha kugwiritsidwanso ntchito pachitsanzo chonsecho pogwiritsa ntchito njira ya matanthauzidwe ofanana.

Titha kupanga common.cds Model komwe matanthauzidwe onse omwe amafanana amatha kusungidwa.

// matanthauzo wamba

bungwe StandardEntity {kiyi ID : UUID; } Tsopano matanthauzo awa atha kugwiritsidwanso ntchito monga pansipa: pogwiritsa ntchito { StandardEntity } kuchokera ku './common'; bungwe Wogwira ntchito : StandardEntity { dzina : Chingwe; ... } Woyang'anira bungwe : StandardEntity { dzina : Chingwe; ...}

 

Fayilo wamba idapangidwa kale mwachisawawa ndi chinthu chomwe chidatchulidwatu cuid.

Kupanga ma UUID ku OData

CDS imayika ma UUID kupita ku Edm.Guid, mwachisawawa, m'mitundu yonse ya OData. Komabe, muyezo wa OData umayika malamulo oletsa ma Edm.Guid - mwachitsanzo, zingwe zokhazokha zimaloledwa - zomwe zingasemphane ndi zomwe zilipo kale. Chifukwa chake, timalola kuti mapu osasinthika asokonezedwe motere:

mabuku olemba {

key ID: UUID @odata.Mtundu:'Edm.String';

...

}

Ngati ndi kotheka, mutha kuwonjezeranso ndemanga @odata.MaxLength kuti muchotse katundu wofananira nawonso.

Msonkhano

Amagwiritsidwa ntchito kutanthauza mgwirizano pakati pa zinthu ziwiri. Monga ABAP CDS, apanso timagwiritsa ntchito mawuwa Mgwirizano. Apa, mawu ofunika ambiri chikuwonetsa a 0..* kadinali. Zoletsa za cardinality zitha kuwonjezeredwa ngati cholepheretsa (kumene chikhalidwe) - mwachitsanzo, kugwiritsa ntchito ayi null.

nyimbo

Mosiyana ndi Mayanjano pomwe timagwirizanitsa gawo la bungwe ndi zinthu za gulu lonse, zolembedwazo zimangotanthauza gawo la chinthu china. Ili ndi mwayi wowonjezera pazochita zozama zodziyendetsa nokha (Ikani / Sinthani) ndikuchotsa kwapang'onopang'ono (Kuchotsa tebulo la Multi Dependent).

// Tanthauzirani Maoda okhala ndi Zinthu Zomwe zilima Orders {kiyi ID: UUID; Zinthu : Kupangidwa kwa Order_Items zambiri pa Items.parent=$self;}Order_Items { // idzafikiridwa kudzera mu Maoda okha  kholo lofunika : Association to Orders; buku lofunikira : Association to Books; kuchuluka: Integer;}

Zochita Zabwino Kwambiri

  1. Osawonjezera zambiri zaukadaulo mu Ma Models, timagwiritsa ntchito Zotsatirachifukwa cha icho
  2. ntchito mayina achidule ndi zitsanzo zosavuta zathyathyathya
  3. Osachulutsa Zomwe zili mu Models
  4. Gwiritsani ntchito mndandanda wamagulu am'deralo ngati mukuchitadi ndi katundu wambiri komanso ma voliyumu. Apo ayi, sankhani ma UUIDs

Mpaka pano zomwe taphunzira: Kupanga Chitsanzo ndi Mbali pamwamba pake.

Domain Modelling mu SAP CAP

Kusiya ndemanga

Tsambali likugwiritsa ntchito Akismet kuchepetsa spam. Phunzirani momwe deta yanu ikufotokozera.