Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Code for Transformation

Former Member
0 Kudos

I have amont key figure for every fiscal period (0FISCPER) in my source cube. In my target cube i have to update it in such a way that the totals for periods 1, 2 and 3 will be aggregated to period 3 in the target. For periods 4,5,6 it should be for period 6. If we have it for only period 1 it should still sit against period 3 and when period 2 amount comes it gets added to the existing amount in period 3. All this while except period 3, 6, 9 and 12, the others hould remain blank. How can i achieve such a update. I am on BI 7.0 and using transformation rules.

Thanks,

Rashmi

1 ACCEPTED SOLUTION

Former Member
0 Kudos

I am not sure how will you handle this in BW but here is sample logic.

case fiscperiod.

when '01', '02' '03'.

target-amount = target-amount + source-amount.

when '04', '05' '06'.

target-amount = target-amount + source-amount.

when '07', '08' '09'.

target-amount = target-amount + source-amount.

when '10', '11' 12'.

target-amount = target-amount + source-amount.

endcase.

Hope this case statement helps.

ashish

5 REPLIES 5

Former Member
0 Kudos

I am not sure how will you handle this in BW but here is sample logic.

case fiscperiod.

when '01', '02' '03'.

target-amount = target-amount + source-amount.

when '04', '05' '06'.

target-amount = target-amount + source-amount.

when '07', '08' '09'.

target-amount = target-amount + source-amount.

when '10', '11' 12'.

target-amount = target-amount + source-amount.

endcase.

Hope this case statement helps.

ashish

0 Kudos

Ashish,

I am updating the same key figure from source to target. How should i handle such a situvation.

Rashmi

0 Kudos

You can do this in update routine / Transfer routine.

Before triggering the rules, routine will trigger.

Her you can accumulate data records based upon fiscal period and populate another internal table. This internal table you can read in respective update rule and get the amount value.

Suppose there are 3 records in source data table REC1, REC2, REC3. And respective periods are 01 / 02 / 03.

You can sum up this in Start routine and keep one entry in start routine base table or if you need all 3 records then populate another internal table with sum (amount) and some set of keys which you can use in update rules to read table and get value.

Hope i am not confusing you.

ashish

0 Kudos

Can you actually give me the total code with syntax. I will give you the technical names of the objects

Fiscal Period= 0FISCPER

AMOUNT=0AMOUNT.

I am updating from my source cube to the target cube y the logic i have explained below. I have also got one more characterisitc ZQTR and as you would noticed in the logic, what i have to esentially do is the amount in that quater should be updtaed to the last period of the target cube. So can you please give me the complete code for this.

Thanks,

Rashmi

0 Kudos

I will try but here is sample -

DECLARE LT_DATAPACKAGE LIKE DATA_PACKAGE.

LOOP AT DATAPACKAGE.

LT_DATAPACKAGE = DATAPACKAGE.

IF DATAPACKAGE-FISCPER = '01' OR '02'.

LT_DATAPACKAGE-FISCPER = '03'

ELSEIF DATAPACKAGE-FISCPER = '04' OR '05'.

LT_DATAPACKAGE-FISCPER = '06'

ELSEIF DATAPACKAGE-FISCPER = '07' OR '08'.

LT_DATAPACKAGE-FISCPER = '09'

ELSEIF DATAPACKAGE-FISCPER = '10' OR '11'.

LT_DATAPACKAGE-FISCPER = '12'

ENDIF.

COLLECT LT_DATAPACKAGE.

ENDLOOP.

DATAPACKAGE[] = LT_DATAPACKAGE[]

FREE LT_DATAPACKAGE.

Here in above logic i am collecting all record for each quarter and modifying value of fiscal period based upon respective range.

Hope this helps.

ashish