cancel
Showing results for 
Search instead for 
Did you mean: 

Database access in update rules

Former Member
0 Kudos

Hi all,

I am planning to write an ABAP routine for a update rule. Now I want to know whether I can find out some data from some tables. These data are a part of my master data.

Let me explain; I have a field in the communication structure called BookID and two dimensions in the cube called BookID and AuthorName. Now both these dimensions are characteristic infoobjects with some master data already uploaded.

I have to write a update rule routine, where I'll fetch the AuthorName from the BookID. AuthorName is an attribute of BookID.

Can you tell me if this is possible? If yes, then which are the database tables I need to look at? Also, some code examples will really help.

If it's not possible, please suggest some way to do it. Currently I have AuthorName as "Master data attrib. of" BookID. But still it doesn't update the records. New records are being created with only BookID. No AuthorName.

Please help.

Thanks,

Satyajit.

Accepted Solutions (1)

Accepted Solutions (1)

edwin_harpino
Active Contributor
0 Kudos

hi,

are you going to update AuthorName in master data BookID or AuthorName in the cube ? do the AuthorName set as 'navigational' attribute of BookID ?

Both are possible for update.

Master data has 3 tables (beside other table) : text, attribute and hierarhy.

For master data that's not time-dependent, attribute are stored in /bi0/p[infoobject name] - without 0, e.g infoobject 0customer has /bi0/pcustomer table for attribute. for our own created infoobject it's stored in /biC/p[infoobject name], e.g ZCUSTOMER has /bic/pZcustomer table.

For update in infocube, if you didn't set it as navigational attribute, you may use Update Method 'Master data attrib. of'.

sample code :

data : it_data_package like DATA_PACKAGE occurs 0 with header line,

begin of it_authorname occurs 0,

/bic/zbookid like /bic/pzbookid-/bic/zbookid,

end of it_authorname,

l_tabix like sy-tabix.

tables : /bic/pzbookid.

select /bic/zbookid

from /bic/pzbookid

into corresponding fields of table it_authorname

for all entries in data_package

where /bic/zbookid = data_package-/bic/zauthorname.

loop at DATA_PACKAGE.

....

endloop.

Former Member
0 Kudos

Hi all,

thanks for your prompt replies. Just one question: what if I don't have AuthorName as a part of the InfoSource Communication Structure?

Thanks,

Satyajit.

Former Member
0 Kudos

Hi A.H.P,

as for your question, I would be updating the infocube. Can I still use "Master data attrib. of" in this case? Or do I need a start routine?

Thanks,

Satyajit.

Former Member
0 Kudos

If you have the Info Object in your Info Provider..Its OK even if you donot have it in the Communication structure..

The Update Logic can also be implemented in the Update Rules to the Info Provider..

The other way wuld be to mark it as a navigational attribute and use it.

Ashish..

Former Member
0 Kudos

Hi Ashish,

I am updating the infocube from an ODS. I don't have AuthorName in the ODS. Am I doing it wrong?

Thanks,

Satyajit.

Former Member
0 Kudos

This is what I understand..

You have Author name in your Cube and not in ODS..

You need to update author name in the Cube only..

Author name is already populated as attribute of BOOKID.

So assuming that you donot need the Author in ODS..There are 2 ways to get Author Name into your cube..

1. Populate Author Name in the update rules to the cube by a update routine as suggested earlier..

2. Mark Author name as navigational attribute of BOOKID, so that you will be able to use it in your queries for navigation purposes as well..

Hope this solves your problem..

Let me know

Ashish..

edwin_harpino
Active Contributor
0 Kudos

hi,

2. Mark Author name as navigational attribute of BOOKID .....

and mark it in your infocube >> edit >> 'navigation attribute', in switch on/off screen, mark BOOKID__AUTHORNAME >> activate infocube. you may need to reactivate update rules.

Former Member
0 Kudos

Hi,

As our friends said, you can follow either procedure .

<i>1. Populate Author Name in the update rules to the cube by a update routine as suggested earlier..</i>

So, here the cube will have Author Name value as it was at the time of data loading. So even later , the value is changed in master table cube will have old value.

And also code the prgram as start routine, it is good pratice for performance point of you.

<i>2. Mark Author name as navigational attribute of BOOKID, so that you will be able to use it in your queries for navigation purposes as well..</i>

So, here the cube will have Author Name value as it is at the time of Query execution(current value). So even later , the value is changed in master table cube will have current value.Actually the cube does not store these values for 'Author Name'.It fetches the values from master data at the time of qury execution.

With rgds,

Anil Kumar Sharma .P

Former Member
0 Kudos

Thanks all of you for your replies. I think I know what I have to do.

Satyajit.

Former Member
0 Kudos

Hi Satyajit Chakraborty ,

I hope, you have enough answers for your question.If so, kindly close the thread. And Kindly post two different question as two threads.

With rgds,

Anil Kumar Sharma .P

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Satyajit,

You will need to include the master data table for BOOKID, which might be like /BIO/M<b>BOOKID</b>

BOOKID being your InfoObject technical name..

SELECT SINGLE <b>AUTHORNAME</b> INTO RESULT

FROM /BI0/MBOOKID WHERE BOOKID EQ TRAN_STRUCTURE-BOOKID.

AUTHORNAME - Technical name of author info object

Hope it helps..

Ashish..