Skip to Content
author's profile photo Former Member
Former Member

BAdi RSR_OLAP_BADI and RSDRI_INFOPROV_READ

Hi folks,

I try to use the RSR_OLAP_BADI to compute virtual key figures. These key figures are based on a lookup in an Info Cube which I do in the COMPUTE method of the implementation class. In this method I call the function module RSDRI_INFOPROV_READ for reading data out of an Info Cube. In some cases I get the error message

It seems that the function module has an internal state which would be overwritten through the invocation in the COMPUTE method.

Has anyone an idea how to prevent this? Or is there a better way to read from an Info Cube??

Thanks a lot for any advices!

Rgds,

Juergen

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Apr 25, 2005 at 11:28 AM

    Hi Jürgen,

    how often do you call the RSDRI_INFOPROV_READ? If possible you should call it only once and buffer all the data you need. The error message seems to indicate that the RSDRI_INFOPROV_READ (which is also used for query extraction) cannot be executed multiple times within itself.

    My suggestion would be to wrap the RSDRI_INFOPROV_READ into a wrapper class that buffers the data and call the method during step 3 of the variable exit.

    Best regards

    Dirk

    Add a comment
    10|10000 characters needed characters exceeded

    • Jürgen,

      as it has been pointed out already and as the error message says, you can't call RSDRI_INFOPROV_READ in this BADI. It does not make sense anyway for performance reasons, since the BADI is called once for each record but you certainly don't want to read the other InfoCube so often. Ideally there should be no database access within the COMPUTE method. Otherwise you will run into performance problems when users select a lot of data.

      I agree with Dirk. Do the RSDRI_INFOPROV_READ once in the variable exit, buffer the results in memory, and read whatever you need from memory in the COMPUTE method.

      Regards,

      Marc

      SAP NetWeaver RIG

  • author's profile photo Former Member
    Former Member
    Posted on Apr 27, 2005 at 02:08 PM

    Hi Jürgen,

    RSDRI_INFOPROV_READ cannot be called twice in the same context, because then some static variables would be overwritten. In your case it is called once by the query you are executing and a second time (for a different cube, but that does not matter) during your calculation of the virtual key figures. In that case you get the error message indicating a nested call.

    I have not tried yet, just an idea: is it possible to call your function module by CALL FUNCTION ... STARTING NEW TASK (asynchronous RFC)? In the ABAP documentation it is described how to receive results from asynchronous calls in topic RECEIVE RESULTS FROM FUNCTION

    Hope that helps

    Stephan

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Marc Bernard

      You could also use the dynamically assigned attributes.

      When you create the BAdI you should go to Goto->Sample Code->Copy. You can then add the attributes P_CHA_<IOBJ> and P_KYF_<IOBJ> as static instance attributes type I to the system. You can then access them in the COMPUTE method with the following meaning:

      value = 0 - Info Object is not in the query (and not defined as read_mode)

      value <> 0 - component in the c_s_data structure.

      So it would be

      IF P_CHA_0FISCPER > 0.
        ASSIGN COMPONENT P_CHA_0FISCPER 
          OF STRUCTURE c_s_data
          TO <f_fper>.
        <f_fper>+4(3) = '012'.
      ENDIF.
      

      (Code copied from another sample).

      Best regards

      Dirk

  • author's profile photo Former Member
    Former Member
    Posted on Apr 25, 2005 at 07:47 AM

    Sorry, I forgot the error message:

    You are executing a nested query. That is not possible.

    (translated from German by myself:-)

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.