新建网站的评估,wordpress开发团队,做造价在那个网站比较好,用u盘做网站本文目录 本系列文章目标开发步骤数据库表设计借贷初始化数据 会计凭证 Service 定义生成Fiori App更新CDS AnnotationApp运行 本系列文章
SAP CAP篇一: 快速创建一个Service#xff0c;基于Java的实现 SAP CAP篇二#xff1a;为Service加上数据库支持 SAP CAP篇三#xff… 本文目录 本系列文章目标开发步骤数据库表设计借贷初始化数据 会计凭证 Service 定义生成Fiori App更新CDS AnnotationApp运行 本系列文章
SAP CAP篇一: 快速创建一个Service基于Java的实现 SAP CAP篇二为Service加上数据库支持 SAP CAP篇三定义Model SAP CAP篇四为CAP添加Fiori Elements程序(1) SAP CAP篇五为CAP添加Fiori Elements程序(2) SAP CAP篇六为CAP添加Fiori Elements程序(3) SAP CAP篇七为CAP添加Fiori Launchpad入口 (Sandbox环境) SAP CAP篇八为CAP添加App Router并支持Fiori Launchpad (Sandbox环境) SAP CAP篇九升级为SAP CDS 7.0, CAP Java 2以及Spring Boot 3 SAP CAP篇十理解Fiori UI的Annoation定义 SAP CAP篇十一支持Media Object图片、附件等 SAP CAP篇十二AppRouter 深入研究 SAP CAP篇十三拥抱TypeScript SAP CAP篇十四写个ERP的会计系统吧Part I SAP CAP篇十五写个ERP的会计系统吧Part II SAP CAP篇十六写个ERP的会计系统吧Part III
目标
基于前一篇的基础继续开发ERP系统。
本篇侧重于会计凭证会计凭证是会计事务在系统的承载。
会计凭证的创建——需要符合基本的会计等式即“有借必有贷借贷必相等”。从业务意义上来说会计凭证是企业各种报表的基础。
开发步骤
数据库表设计
从数据库层面来定义会计凭证。
借贷
借贷的定义DebitCreditIndicator如下
type DebitCreditIndicatorEnum : String(1) enum { debit D;creidt C;
}cds.odata.valuelist
entity DebitCreditIndicators: sap.common.CodeList {key DebitCreditIndicator: DebitCreditIndicatorEnum;
}初始化数据
在db文件夹下创建DebitCreditIndicator.csv用以在初始化数据。
DebitCreditIndicator;name
D;Debit
C;Credit会计凭证
会计凭证的如下
entity Documents: managed {key ID: Int32;Company: Association to one dbcompany.Companies not null;PostingDate: Date cds.on: {insert: $now, update: $now }; Description: String(100);Items : Composition of many {key ID: Int16;DebitCreditIndicator: Association to one DebitCreditIndicators not null;Account: Association to one dbaccount.Accounts not null;Amount: Decimal(15, 2) not null;Currency: Currency not null;Description: String(100);};
}Service 定义
更新FinanceService添加如下Entities。
readonly
entity DebitCreditIndicators as projection on dbdocument.DebitCreditIndicators;这里用readonly限制借贷定义为只读。
entity Documents as projection on dbdocument.Documents;同时需要指定Documents 为Odata.draft.enabled这样Fiori Elements会自动启用编辑功能Create, Update。
annotate FinanceService.Documents with odata.draft.enabled;生成Fiori App
通过Fiori: Open Application Geneator来创建Fiori App。 查看生成的App的Information 更新CDS Annotation
annotate service.Documents with (UI.SelectionFields: [Company_ID,PostingDate],UI.LineItem : [{$Type : UI.DataField,Label : ID,Value : ID,},{$Type : UI.DataField,Label : Company,Value : Company_ID,},{$Type : UI.DataField,Label : Posting Date,Value : PostingDate,},{$Type : UI.DataField,Label : Description,Value : Description,},]
);
annotate service.Documents with (UI.FieldGroup #GeneratedGroup1 : {$Type : UI.FieldGroupType,Data : [{$Type : UI.DataField,Label : ID,Value : ID,},{$Type : UI.DataField,Label : Company,Value : Company_ID,},{$Type : UI.DataField,Label : PostingDate,Value : PostingDate,},{$Type : UI.DataField,Label : Description,Value : Description,},],},UI.Facets : [{$Type : UI.ReferenceFacet,ID : GeneratedFacet1,Label : General Information,Target : UI.FieldGroup#GeneratedGroup1,},]
);App运行 后续的文章里面将开始定义凭证。