Quantcast
Channel: SCN: Message List - Data Warehousing
Viewing all articles
Browse latest Browse all 3366

Transformation Routine

$
0
0

Olla Guru's

 

Hope someone can be of assistance, I want to calculate a value based on certain criterias. This is records generated from BPS.

 

There are records that lies against characteristic statistical keyfigure (SKF) CS149 and CS158. What I want to achieve is when 0QUANTITY against CS149 <> 0, then the 0VALUE_LC against CS149 must used, in addition a value lies against SKF CS158 (0PRICE) which must be added to the 0VALUE_LC that we got from CS149.... gosh, this sounds so confusing... hehe

 

Let me try explain it this way, there are tonnages allocated from a specific vendor/material to a specific plant (CS149-0QUANTITY), these tonnages cost us x amount of transport fees (CS149-0VALUE_LC). The supplier itself asks x amount per ton (CS158-0PRICE). The result is X = QTY * (PRICE + TRP). The code below works like this, but because we have auditing on this infocube, there are multiple records and I suppose I need to drop the records in an internal table to have it more consolidated, calculating it line by line based on my criteria is not working.

 

data venprice type f.

data trpprice  type f.

data allocqty  type f.

data allocval  type f.

data allocven type /BI0/oicreditor.

 

check source_fields-plant NE ' '.

 

if source_fields-material cs 'red_anth' and source_fields-stkeyfig eq 'cs149'.

     allocqty = source_fields-quantity

     trpprice = source_fields-0value_lc

     allocven = source_fields-creditor.

 

elseif source_fields-material cs 'red_anth' and source_fields-stkeyfig eg 'cs158'.

     venprice = source_fields-0price.

 

endif.

 

if allocqty <> 0 and allocven = source_fields-creditor.

     result = (trpprice + venprice) * allocqty

else.

     result = 0.

endif.

 

 

Hope I am making sense, hehe, again I suppose the logic above will apply correctly, but I need the data consolidated I suppose in an internal table based on:

  • posting period
  • plant
  • vendor (creditor)
  • material
  • statistical key figure

 

Where the vendor number is the link between the records from CS149 and CS158...

 

And this is where I am struggling... :-)

 

Thanks Everyone,

Rudi


Viewing all articles
Browse latest Browse all 3366

Trending Articles