cancel
Showing results for 
Search instead for 
Did you mean: 

Populate fields in infocube

Former Member
0 Kudos

Hi geniuses,

Please help:)

Is it possible to populate fields in infocube in the start routine?

I am trying to load data from ODS to Infocube. They are 1:1 mapping, but there a few fields are not populated in ODS like occupy_percentage_low. Now I am asked to calculate those values in start routine and send the values to coresponding fields in the infocube.

I tried to use the following code, but there is no values in the cube after I load data to cube.

loop at data_package assigning <fs>.I

IF <fs>-/BIC/occupy / <fs>-/BIC/Totalavailable < '0.10'.

  • DATA_PACKAGE-/BIC/OCCU_LOW = 'Y'.

  • CONTINUE.

  • ENDIF.

ENDLOOP.

I also tried to use <fs>-/BIC/OCCU_LOW = 'Y'. In debugging mode, there is no value for <fs>-/BIC/OCCU_LOW either. Really lost!

Thanks!

Lin

Message was edited by: Lin Cong

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

hi Lin,

if the infoobject name is 0occupy and 0totalavailable then it should be like

<fs>-occupy / <fs>-Totalavailable

(without /bic/; /bic/ is for customized infoobject, e.g you have infoobject zoccupy then it will be like <fs>-/bic/zoccupy.

if the calculation didn't involved any data from other table, only from ods (occupy and Totalavailable are exist in ods) then you have no need to populate with start routine, you can simply populate e.g infoobject occupy_percentage_low using method 'routine', create routine and put code like

result = 'N'.

IF comm_structure-occupy / comm_structure-Totalavailable < '0.10'.

result = 'Y'.

ENDIF.

or ..

IF comm_structure-/BIC/zoccupy / comm_structure-/BIC/z... < '0.10'.

(zTotalavailable is too long for customized infoobject name, so the name should be not like that).

hope this helps.

Former Member
0 Kudos

Thank you AHP.

totalavailable is the name I made up in order to make its meaning clearly.

The value of totalavailable is not in the ODS but a master data table. I think I need to retrieve the values from master data table into an internal table. Then read the internal table, do calculation and populate fields in the infocube. Is it right?

Lin

0 Kudos

hi Lin,

yes, you are right, read from master data into internal table and read from internal table, you can calculate in start routine or individual routine for infoobject

check sample code with start routine

PROGRAM UPDATE_ROUTINE.

$$ begin of global - insert your declaration only below this line -

TABLES: /bic/p[masterdata].

DATA: l_tabix like sy-tabix,

it_masterdata like /bic/p[masterdata] occurs 0 with header line.

$$ begin of routine - insert your code only below this line -

  • fill the internal tables "MONITOR" and/or "MONITOR_RECNO",

  • to make monitor entries

data : it_data_package like DATA_PACKAGE occurs 0 with header line.

select * from /bic/p[masterdata]

into table it_masterdata.

loop at data_package.

l_tabix = sy-tabix.

move-corresponding DATA_PACKAGE to it_data_package.

read it_masterdata with key [field name] = it_data_package-[fieldname]

  • if more key add it_data_package-[fieldname] - without AND

if sy-subrc = 0.

*.... calculation

modify data_package from it_data_package index l_tabix.

endif.

endloop.

hope this helps.

Former Member
0 Kudos

Some doubts.

In the "*calculation" part of your code, am I suppose to use it_data_package-/bic/occupy_percentage_low = 'Y' to send value to infocube?

What if I have multiple calculations? I should modify data_package for every calculation?

Appreciate all your help.

Lin

0 Kudos

hi Lin,

yes, you are right

it_data_package-/bic/occupy_percentage_low = 'Y'

if you have multiple calculation,

you can modify data_package later,

put 'modify data_package from it_data_package index l_tabix.' after all calculation, like

read table ...

if sy-subrc = 0.

...

it_data_package-/bic/occupy_percentage_low = 'Y'

it_data_package-other infoobject = ' .... '

..

modify data_package from it_data_package index l_tabix.

endif.

or if read from other table or other calculation

if ...

endif.

if ...

endif.

modify data_package from it_data_package index l_tabix.

  • don't worry, if we modify data_package, and no value change, it will have just the same previous value as we have move data_package to it_data_package and we modifty from it.

hope this clears your doubt.

Former Member
0 Kudos

Hi AHP,

So appreciate!!

You cleared all my doubts.

Have a wonderful night,

Lin

Former Member
0 Kudos

Hi AHP,

I am coming back.

I wrote the code as you gave me. I still cannot send values to the target cube. I test it with a very simple logic.

The code is like:

LOOP AT DATA_PACKAGE.

l_tabix = sy-tabix.

MOVE-CORRESPONDING DATA_PACKAGE TO IT_DATA_PACKAGE.

IF it_data_package-/BIC/*** < 0.

it_data_package-/BIC/***_LOW = 'Y'.

LOWLINE-CARRID = it_data_package-/BIC/CARRID.

LOWLINE-FLIGHTID = it_data_package-/BIC/FLIGHTID.

APPEND LOWLINE TO LOWTABLE.

CONTINUE.

ENDIF.

modify DATA_PACKAGE from it_data_package index l_tabix.

ENDLOOP.

......

I delete the all the records that are not in the lowtable from datapackage.

In the target cube, I only see the records in the lowtable (I want), but not the 'low' column. Any clue?

Thanks!

Lin

0 Kudos

hi Lin,

welcome back

put a 'break-point.' in the routine,

and do debug, from monitor tab 'detail',

expand last node and choose one package

and right click 'simulate update' then choose 'debug update rules'.

hope this helps.

Former Member
0 Kudos

hehe:)

Well, there is no data in it_data_package?

Former Member
0 Kudos

J

Former Member
0 Kudos

Help, help..

I debug it again. I realized that

it_data_package-/BIC/occupy_percent_low is assigned to value 'Y'

But after Modify

The data_package-/BIC/occupy_percent_low is not changed. Any clue? Thanks a lot!

Former Member
0 Kudos

Never mind. I fixed it. Thank you anyway:)

Answers (1)

Answers (1)

Former Member
0 Kudos

The answer to your question is absolutly possible to add a field to your cube. Make sure you have that field to your comm. structure as well; and follow AHP's code.

Regards:

BK