Sie sind auf Seite 1von 4

Sample BÄdI implementation

Disaggregation only happens on Entity dimension

Disaggregate value into all children base members averagely

It is highly recommended BÄdI only implements for InputSchedu1e

entity TYPE uir s dim handler,

entity members TYPE uia t dim membe r , " dimenszon members of Entity

entity TYPE REF TO if uia dim data, ' Obtect Reference to Dimenszon

hier info TYPE t hier, Hierach±es


Infos
hier info TYPE s hier,

hier name TYPE t hier name , Hierach±es name list

attr List TYPE t attr, " Attributes Infos

attr List TYPE s attr,

attr name TYPE t attr name , " Attributes name list

non base TYPE ui flg, ' 'X' =non base member; —base member
entity mbr TYPE Ilia t dim member , ' chi Iden entity
members
L num base TYPE i, ' number of children entity
members Lr
data TYPE
FIELD-SYMBOLS dim obi > TYPE uir s dim handler, REF TO
: data.
< LS record>
TYPE
entity> TYPE ui dim member , ' Entity member of current
records <
It
entity mbr> TYPE HASHED TABLE ' AIL entity members

entity mbr>
TYPE

caLc> TYPE ' 'Y' =non base member

storedcalc> TYPE ' 'Y' =non base member


base mbr> TYPE ui dim member
,

May 2010 1
How To. UsetheWriteBackPre- BAd
.. Process l

keyfigure> TYPE "


Keyfigure

Find the Entity dimension by its type

LOOP 10 obi> WHERE type uiOO cs dim type—entity.


Is entity = < Is dim obi>.
ENDLOOP .

PARENTH2

hier 1 ist ( IMPORTING et hier info


LOOP ÄT It hier info INTO LS hier info.

LS hier info—hier name TO It hier name .

ENDLOOP .

Get necessary Attributes (CALC and STORED CALC)

10 attr 1 ist ( IMPORT ING et attr List


LOOP ÄT It attr List INTO LS attr List
Lt hier info )

Lt attr List )
WHERE Attribute name uirO c attr caLc OR Attribute name uirO c attr storedcaLc.

LS attr 1 ist—attribute name TO It attr name.


ENDLOOP .

Get Member s

CALL METHOD 10 enti data


EXPORT ING
if ret hashtabtrue

i t attr list Lt attr name ' coLumns: Attributes name List

hier list Lt hier name ' coLumns: name 1 ist


IMPORT ING
er data data.
ASSIGN Ir TO < It entity mbr>.

' preparation: create data structure and assign fieLds


CREATE LINE OF array.

ASSIGN Ir TO < 1s record> .

ASSIGN COMPONENT 1s entity-dimension OF STRUCTURE record> TO . ASSIGN

COMPONENT uiro c keyfigure OF STRUCTURE record> TO keyfigure>.

LOOP ÄT ct array INTO record>.

TABLE entity mbr>

TABLE KEY (uiro c id) < 1 entity>

ASSIGNING mbr>.
IF sy—subrc 0
.
" If
non base =

ASSIGN COMPONENT uiro c entity TO caLc>.

Lf non base = caLc>.

COMPONENT uirO c attr storedcaLc OF STRUCTURE entity mbr> TO < If storedcalc>.

IF sy—subrc O < If storedcaLc>uirO cs calc—calculated member .


L f non base utrO cs calc—calculated member .
ENDIF .

Disaggregate non base member

IF If non base uirO cs calc—calculated member.


" more precise verszon is to retrieve only accessible member of IS USER

CALL METHOD 10 children rn_br

EXPORTING i _parent mbr< 1 entity>Parent level 99 99 = ALI children in any level; 1


direct child
if only base mbrabap trueOnly base member
IMPORTING
et member Lt entity
mbr.
" Re—calculate the keyf±gure, divide by N = number of base members

" Usually it doesn't matter with IF CALC DELTA = false,

if the operation is linear mathematical .

DESCRIBE TABLE Lt entity LINES L num base.


" Avoid divide by zero
IF L num base > O.

keyfigure> = < 1 keyf$ure> / 1 num base .

Copy N times with new base members


LOOP AT Lt entity mbr ASSIGNING base .

entity> = base mbr>.


" When IF CALC DELTA = true, appending means the Latest records take effects,

prevzous records with same dimension member will be overwritten. " The newly

appended records will also looped and processed.

record> TO ct array.
ENDLOOP .

divide by zero

" Remove the old one


DELETE ct array.

ENDIF .

ENDLOOP .

ENDMETHOD .

Das könnte Ihnen auch gefallen