cancel
Showing results for 
Search instead for 
Did you mean: 

Coding in Update Rules accessing a Z-Table

i807185
Associate
Associate
0 Kudos
136

Hi,

I have a datarecord that looks as follows:

0MATERIAL: 1000

ZMC (Manufacturing Company) 03

ZFAC (Facility ID) 16

ZSHIP (Total Shipments) 500 Units

<b>There is a Z-Table in R/3 (ZPLANT) that maps ZMC and ZFAC to R/3 Plants (ZPLANT).</b>

Assuming this Z-Table is available in BW <b>what would the coding in the update rules into a Cube look like to do that mapping?</b>

Thanks again

Christian

Accepted Solutions (0)

Answers (1)

Answers (1)

edwin_harpino
Active Contributor
0 Kudos

dear Christian,

try use start routine, assume the table in bw is zplant and has fields zmc and zfac ...

PROGRAM UPDATE_ROUTINE.

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

TABLES: zplant.

DATA: l_tabix like sy-tabix,

it_plant like zplant 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.

  • first select the master data to internal table, this to

  • avoid each time has to fetch from database table for

  • single record, for better performance

select * from zplant

into table it_plant.

  • if table zplant has high volume data, you can use for * select * from zplant

  • into table it_plant.

  • all entries

  • for all entries in data_package

  • where material ? = data_package-material.

loop at data_package.

l_tabix = sy-tabix.

move-corresponding DATA_PACKAGE to it_data_package.

read it_plant with key [field name e.g zplant] = it_data_package-[/bic/zplant] BINARY SEARCH

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

if sy-subrc = 0.

it_data_package-/bic/zmc = it_plant-zmc.

it_data_package-/bic/zfac = it_plant-zfac.

modify data_package from it_data_package index l_tabix.

endif.

endloop.

take a look some sample code

hope this helps.