SAP BI项目 FIAR模块ETL设计说明书
错误!未找到引用源。
当前版本: 拥有者: 最后更新日期: 最后更新者: 作者: 创建日期: 1 / 22
优选
批准者: 批准日期:
修订历史
版本号 更新日期 修订作者 主要改变描述 2 / 22
优选
目录
1.概述5
2.ETL系统架构设计6
2.1FIAR ETL系统逻辑架构6 2.2FIAR ETL数据流7
2.2.1顶正逾期账龄分析数据流7 2.2.2数据源环境7
3.FIAR模型设计9
3.1PSA设计9 3.1.1PSA数据源9 3.1.2信息包9
3.2Level 1 ODS层设计10
3.2.1FI_D120:客户: 带有增量提取的行项目10 3.3Level 2 EDW层设计12 3.3.1顶正-逾期账龄分析12 3.4Level 3 DM层设计23 3.4.1DTP25 3.4.2转换26
4.数据加载流程32
3 / 22
优选
1. 概述
本项目ETL部分的核心功能就是按照本设计说明书的架构,将数据由数据源系统(SAP R3)加载到数据仓库(SAP BW)中。其实现的困难在于ETL工作将面临复杂的源数据环境,包括多种R3标准数据源和增强结构、繁多的数据种类、巨大的加载数据量、错综复杂的数据关系和参差不齐的数据质量,这些都使ETL的架构和应用设计面临相当的挑战。 通过高效的ETL系统结构、层次化的应用功能划分和BW标准的元素,ETL系统和应用架构设计需要能够达到以下目标:
➢ ➢ ➢ ➢
支持在此框架下实现BW数据仓库所需要的ETL功能;
支持在规定的时间窗口能够完成数据加载工作,即需要满足日常数据加载的性能需求; 能够支持有效的应用程序开发模式,提高开发效率,尽量减少应用开发成本; 减少系统维护的复杂性,支持后续增加新数据或功能的开发工作。
ETL设计说明书为ETL开发提供指导,着重叙述数据仓库系统ETL系统的架构、功能和实施过程,其中包含了主要数据转换过程以及涉及到的客户化例程的说明。
ETL过程依赖于源数据的准备就绪,本设计说明书同时也列出了模块所对应的SAP标准数据源和主数据数据源。 由于ETL的复杂性,本设计尝试从多个层面进行说明,希望能够尽可能回答开发过程中所面临的问题达到指导开发的目的,但实际开发过程中,开发人员仍然可能遇到设计说明书没有涉及的问题,因此,遵循设计的基本思想,通过开发人员的反馈,在开发的过程中不断地完善和修正设计,对于ETL的开发是非常重要的。对于任何ETL开发过程中遇到的技术问题,开发人员需要与设计人员协商讨论,以迅速解决问题,保证开发顺利进行。
而同时,为保证ETL系统架构的完整、统一、程序的可维护性以及开发的可管理性,对设计的修改必须得到控制,重要的变动必须通过版本管理流程来协调进行。 本设计说明书将包括以下部分:
1. 架构设计:设计对应模块ETL系统的逻辑架构以及分析数据流。
2. ETL过程说明:包括ETL过程涉及到的各步骤说明,如信息包的更新机制,转换过程中涉及到的特定例程控制,
DTP的执行和更新机制等等。
3. 数据加载流程:说明了对于本模块而言在运行特定步骤之前需满足的条件。
4 / 22
优选
2. ETL系统架构设计
2.1 FIAR ETL系统逻辑架构
上图是ETL系统逻辑架构。从宏观设计上,历史数据、初始数据加载和日常数据加载的ETL都将按照此架构设计。该架构将ETL作为一个整体来设计。
对于数据仓库的加载,ETL分为数据抽取(Extract)、数据转换(Transform)以及数据加载(Load)3个阶段。
5 / 22
优选
2.2 FIAR ETL数据流
2.2.1 顶正逾期账龄分析数据流
2.2.2 数据源环境
数据源全部由SAP系统提供,数据源包括两种类型
2.2.2.1 业务数据数据源
➢ ➢ ➢
0FI_AR_4——客户:带有增量提取的行项目 0FI_GL_4——总分类账:带有增量提取的行项目 2LIS_13_VDITM——开票凭证项目数据
2.2.2.2 主数据数据源
➢ ➢
0CUST_SALES_ATTR——客户号 0MATERIAL_ATTR——物料(属性)
6 / 22
优选
3. FIAR模型设计
3.1 PSA设计
3.1.1 PSA数据源
FIAR模型的PSA业务数据源包含0FI_AR_4,并且使用0FI_GL_4得到凭证对应的业务围,使用2LIS_13_VDITM得到销售给客户的物料类型,从而给客户分类;
3.1.2 信息包
0FI_AR_4信息包包含增量、全量及初始化信息包
初始化信息包
增量信息包:此信息包放在处理链里
全量信息包
7 / 22
优选
3.2 Level 1 ODS层设计
3.2.1 FI_D120:客户:带有增量提取的行项目
FI_D120是写优化DSO,其结构与PSA一样,存储最原始的财务凭证,其结构如下:
8 / 22
优选
在0FI_AR_4到FI_D120的数据加载中,在DTP中没有过滤,在提取方式的设置如下所示:
3.3 Level 2 EDW层设计
3.3.1 顶正-逾期账龄分析
3.3.1.1 FI_D220:客户(按账期分类) 3.3.1.1.1 设计初衷:
顶正原来的报表中,客户分为预付货款、月结零天、月结30天、月结60天、月结90天、月结120天、月结180天、其他这几类,其中预付货款、月结零天、月结30天、月结60天、月结90天、月结120天、月结180天是按客户的“月结条件”分的,“其他”是按销售给客户的物料的物料类型分的(销售组织不是4200,也不是4210,也不是42Z6,物料的物料类型是FERT——成品) 上面涉及到2类数据:
A) 一个是主数据(客户销售视图主数据,数据源是0CUST_SALES_ATTR),每个客户在一组“销售组织”、
“分销渠道”和“产品组”下,都对应一个月结条件。
B) 另外一个是业务数据(销售订单行项目,数据源是2LIS_13_VDITM),记录销售给客户的物料。
根据上面分析,设计了FI_D220,用客户号做主键,定义了一个和报表同名的分类信息对象——ZZQ(账期),ZZQ(账期)这个信息对象中维护了数据:
1——预付货款 2——月结零天
9 / 22
优选
3——月结30天 4——月结60天 5——月结90天 6——月结120天 7——月结180天 8——其他
然后,根据客户主数据和销售订单数据为每个客户附上ZZQ(账期)的值。
3.3.1.1.2 DSO—— FI_D220
FI_D220是写优化DSO,其结构如下:
3.3.1.1.2.1 根据销售订单信息给客户分类
3.3.1.1.2.1.1 转换
10 / 22
优选
3.3.1.1.2.1.2 开始例程
sort source_package by sold_to ascending createdon ascending. delete adjacent duplicates from source_package paring sold_to. loop at source_package assigning 优选 00 where customer = data: zmaterial type char3 , l_matl_type type /bi0/oimatl_type, zcustomer type char2 , zact_asgn type char2, zpmnttrms type char4.. call function 'CONVERSION_EXIT_ALPHA_OUTPUT' \"去掉前导零 exporting input = source_fields- material importing output = zmaterial. zmaterial = zmaterial+0(3). zcustomer = source_fields-sold_to+0(2). select single matl_type into l_matl_type from /bi0/pmaterial where material = source_fields-material. select single act_asgn into zact_asgn from /bi0/pcust_sales where cust_sales = source_fields-sold_to and salesorg = source_fields-salesorg and distr_chan = source_fields-distr_chan and division = source_fields-division . select single pmnttrms into zpmnttrms from /bi0/pcust_sales where cust_sales = source_fields-sold_to and salesorg = source_fields-salesorg and distr_chan = source_fields-distr_chan and division = source_fields-division .* 版费-销售组织是42Z4,物料以428开头,客户的分配组是01款或02:月结 if source_fields- salesorg = '42Z4' and zmaterial = '428' . if zact_asgn = '01' or zact_asgn = '02' .* if zpmnttrms = '0000'. result = '01'.* 预结付货零30天 elseif zpmnttrms = '1010' or zpmnttrms = '1007' or zpmnttrms = '3030' . resu lt = '02'.* 月天 elseif zpmnttrms = '3001' or zpmnttrms = '3002' or zpmnttrms = '3003' or zp mnttrms = '3004' or zpmnttrms = '3005' or zpmnttrms = '3006' or zpmnttrms = '3007' or zpmnttrms = '3008' or zpmnttrms = '3009' or zpmnttrms = '3010' or zpmnttrms = '3020' or zpmnttrms = '3025' or zpmnttrms = '3130' . result = '03'.* 月结60天 elseif zpmnttrms = 'AB14' or zpmnttrms = '4510' or zpmnttrms = '3145' or zp mnttrms = '6000' or zpmnttrms = '6001' or zpmnttrms = '6002' or zpmnttrms = '6003' or zpmnttrms = '6004' or zpmnttrms = '6005' or zpmnttrms = '6006' or zpmnttrms = '6007' or zpmnttrms = '6008' or zpmnttrms = '6009' or zpmnttrms = '6010' or zpmnttrms = '6015' or zpmnttrms = '6025' or zpmnttrms = '9961' or zpmnttrms = '7B00' . result = '04'.* ult = '05'.* 月结月结90120天 elseif zpmnttrms = '9991' or zpmnttrms = '9992' or zpmnttrms = 'AC03' . res 月天 elseif zpmnttrms = '6026' or zpmnttrms = '99C1' or zpmnttrms = 'AD01' or zpmnttrms = 'AE01' . result = '06'.* 结180天 elseif zpmnttrms = '99D0' . result = '07'. endif. endif.* 销售组织 不是4200,也不是4210 elseif source_fields-salesorg <> '4200' and source_fields-salesorg <> '4210' and source_fields-salesorg <> '42Z6'.* 如果物料类型是FERT(成品), 账期类型设成08-其他 if l_matl_type = 'FERT'. result = '08'. endif.* 如果物料的科目设置组是88,账期类型设成08-其他:* IF SOURCE_FIELDS-accasgntyp = '88'.* RESULT = '08'.** 如果物料的科目设置组是04或05,账期类型设成09-应收账款-供应商:* ELSEIF SOURCE_FIELDS-accasgntyp = '04' OR* SOURCE_FIELDS-accasgntyp* = '05'.* RESULT = '09'. endif. 12 / 22 优选 3.3.1.1.2.1.3 DTP 根据需求调研结果,只取ZTZ(顶正)的数据,而且过滤掉销售组织是4200、4210和42Z6的销售记录。 提取模式是Delta: 13 / 22 优选 3.3.1.1.2.2 根据客户主数据给客户分类 3.3.1.1.2.2.1 转换 3.3.1.1.2.2.2 开始例程 sort source_package by cust_sales descending . delete adjacent duplicates from source_package paring cust_sales. loop at source_package assigning * 销售组织是4200或42Z6:if source_fields-salesorg = '4200' or source_fields-salesorg = '42Z6'.* 预付货款 if source_fields-pmnttrms = '0000'. result = '01'.* 月30结零天天 elseif source_fields- elseif source_fields-pmnttrms = '1010' or source_fields-pmnttrms = '1007' or source_fields-pmnttrms = '3030' . result = '02'.* 月结14 / 22 优选 pmnttrms = '3001' or source_fields-pmnttrms = '3002' or source_fields-pmnttrms = '3003' or source_fields-pmnttrms = '3004' or source_fields-pmnttrms = '3005' or source_fields-pmnttrms = '3006' or source_fields-pmnttrms = '3007' or source_fields-pmnttrms = '3008' or source_fields-pmnttrms = '3009' or source_fields-pmnttrms = '3010' or source_fields-pmnttrms = '3020' or source_fields-pmnttrms = '3025' or source_fields-pmnttrms = '3130' . result = '03'.* 月结60天 elseif source_fields- pmnttrms = 'AB14' or source_fields-pmnttrms = '4510' or source_fields-pmnttrms = '3145' or source_fields-pmnttrms = '6000' or source_fields-pmnttrms = '6001' or source_fields-pmnttrms = '6002' or source_fields-pmnttrms = '6003' or source_fields-pmnttrms = '6004' or source_fields-pmnttrms = '6005' or source_fields-pmnttrms = '6006' or source_fields-pmnttrms = '6007' or source_fields-pmnttrms = '6008' or source_fields-pmnttrms = '6009' or source_fields-pmnttrms = '6010' or source_fields-pmnttrms = '6015' or source_fields-pmnttrms = '6025' or source_fields-pmnttrms = '9961' or source_fields-pmnttrms = '7B00' . result = '04'.* 月月结结90120天天 elseif source_fields-pmnttrms = '9991' or source_fields- elseif source_fields-pmnttrms = '6026' or source_fields- pmnttrms = '9992' or source_fields-pmnttrms = 'AC03' . result = '05'.* pmnttrms = '99C1' or source_fields-pmnttrms = 'AD01' or source_fields-pmnttrms = 'AE01' . result = '06'.* 月结180天 elseif source_fields- pmnttrms = '99D0' . result = '07'. endif.endif. 3.3.1.1.2.2.3 DTP 根据需求调研结果,只取销售组织是4200和42Z6的客户。 提取模式是完全: 15 / 22 优选 3.4 Level 3 DM层设计 DataMart层是企业数据仓库的最终数据层,所有的报表基于这一层开发,所以其设计需要满足Function Spec所有报表需求;在FI-AR模型中,FI_IC011是顶正逾期账龄的数据;其模型如下: 16 / 22 优选 3.4.1 DTP DTP中加了过滤器,过滤掉了除ZTZ(顶正)之外的其他公司的数据。 提取模式是Delta: 17 / 22 优选 3.4.2 转换 转换规则如下图: 18 / 22 优选 销售组织 根据客户编号去FI_D220找到销售组织 data: l_salesorg type char4 .select single salesorg into l_salesorg from /bic/afi_d22000 wh19 / 22 优选 ere customer = source_fields-debitor .if sy-subrc = 0. result = l_salesorg.else. result = ''.endif. 科目分配类型 根据客户编号去FI_D220找到科目分配类型 data: l_accasgntyp type char2 .select single accasgntyp into l_accasgntyp from /bic/afi_d22000 where customer = source_fields-debitor .if sy-subrc = 0. result = l_accasgntyp.else. result = ''.endif. 账期 根据客户编号去FI_D220找到账期 data: l_zzq type char2 .select single /bic/zzq into l_zzq from /bic/afi_d22000 where customer = source_fields-debitor .if sy-subrc = 0. result = l_zzq.else. result = ''.endif. 重新计算基限日期 *--Create by Tiger*--Last Update on 2009.10.28*--根据客户(销售视图)的付款条件、凭证类型和凭证记账日期重新计算基限付款日期所在年月 data: l_pmnttrms type /bi0/oipmnttrms , l_date type d , l_m type tfmatage.* SELECT SINGLE pmnttrms INTO l_pmnttrms FROM /bi0/pcust_sales* WHERE cust_sales = SOURCE_FIELDS-debitor AND* pmnttrms <> ''. l_pmnttrms = source_fields-pmnttrms. if source_fields-ac_doc_typ = 'RV'. \"如果凭证类型是RV(转帐(销售转帐)),则重新计算基限付款日期* 预付货款 if l_pmnttrms = '0000'. l_m = 0.* 月结零天 elseif l_pmnttrms = '1010' or l_pmnttrms = '1007' or l_pmnttrms = '3030' . l_m = 0.* 月结30天 elseif l_pmnttrms = '3001' or l_pmnttrms = '3002' or l_pmnttrms = '3003' o r l_pmnttrms = '3004' or l_pmnttrms = '3005' or l_pmnttrms = '3006' or l_pmnttrms = '3007' or l_pmnttrms = '3008' or l_pmnttrms = '3009' or l_pmnttrms = '3010' or l_pmnttrms = '3020' or l_pmnttrms = '3025' or l_pmnttrms = '3130' . l_m = 1.* 月结60天 elseif l_pmnttrms = 'AB14' or l_pmnttrms = '4510' or l_pmnttrms = '3145' or l_pmnttrms = '6000' or l_pmnttrms = '6001' or l_pmnttrms = '6002' or l_pmnttrms = '6003' or l_pmnttrms = '6004' or l_pmnttrms = '6005' or l_pmnttrms = '6006' or l_pmnttrms = '6007' or l_pmnttrms = '6008' or l_pmnttrms = '6009' or l_pmnttrms = '6010' or l_pmnttrms = '6015' or l_pmnttrms = '6025' or l_pmnttrms = '9961' or l_pmnttrms = '7B00' . l_m = 2.* 3' . l_m = 3.* 月月结结90120天 elseif l_pmnttrms = '9991' or l_pmnttrms = '9992' or l_pmnttrms = 'AC0 20 / 22 优选 天 elseif l_pmnttrms = '6026' or l_pmnttrms = '99C1' or l_pmnttrms = 'AD01' or l_pmnttrms = 'AE01' . l_m = 4.* 月结180天 elseif l_pmnttrms = '99D0' . l_m = 6. else. l_m = 0. endif. call function 'FIMA_DATE_CREATE' exporting i_date = source_fields-pstng_date i_months = l_m i_set_last_day_of_month = 'X' importing e_date = l_date. else. \"如果不是RV的凭证类型,则仍然保留原来的基限付款日期 l_date = source_fields-bline_date. endif. result = l_date+0(6). 0FS_DACC(借方科目) 根据财务凭证号,去FI_D116找到对应的总账科目 data: l_fs_dacc type /bi0/oigl_account.select single gl_account into l_fs_dacc from /bic/afi_d11600 where p_code = source_fields-p_code and fiscper = source_fields-fiscper and ac_doc_no = source_fields-ac_doc_no and gl_account <= '5210999999' and gl_account >= '5210000000'.if sy-subrc = 0. result = l_fs_dacc.else. result = ''.endif. 0BUS_AREA(业务围) 根据财务凭证号,去FI_D116找到对应的业务围 data: l_bus_area type /bi0/oibus_area .select single bus_area into l_bus_area from /bic/afi_d11600 where p_code = source_fields-p_code and fiscper = source_fields-fiscper and ac_doc_no = source_fields-ac_doc_no and gl_account = source_fields-gl_account and item_num = source_fields-item_num.if sy-subrc = 0. result = l_bus_area.else. result = ''.endif. 21 / 22 优选 4. 数据加载流程 次序 说明 一: 装载FIAR数据前的准备: 1: 二: FIAR主数据和相关模块数据的装载: 1: 数据源 客户编号(销售视图) (属性)0CUST_SALES_ATTR 开票凭证项目数据2LIS_13_VDITM 总分类帐:带有增量提取的行项目0FI_GL_4 备注 此数据加载放在主数据处理链中,每天执行一次,抽取增量数据 此数据源加载放在SD处理链中,每天执行一次,抽取增量数据 此数据源加载放在FIGL处理链中,每天执行一次,抽取增量数据 三: FIAR交易数据的装载: 1: 数据源 客户:带有增量提取的行项目0FI_AR_4 每天执行一次,抽取增量数据 2: DSO L1 (FI_D116)GL4总帐数据 (写入优化的 ) (SD_D130)开票凭证项目数据 (写入优化的 ) (FI_D120)客户:带有增量提取的行项目 此数据源加载放在FIGL处理链中,每天执行一次DTP 此数据源加载放在SD处理链中,每天执行一次DTP 每天执行一次DTP 3: DSO L2 (FI_D220)客户(按账期分类) (写入优化的 ) 先执行SD_D130的加载,再执行0CUST_SALES的加载,因为如果数据冲突,以主数据为准。每天执行一次DTP 4: CUBE (FI_IC011)FIAR:行项目-顶正 每天执行一次DTP,执行DTP之前,因保证FI_D116的数据是最新的。 *科莱特信息技术所有,请注明出处。 22 / 22
因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- baijiahaobaidu.com 版权所有 湘ICP备2023023988号-9
违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务