Reading Queries from within planning functions

Hi all,
Does anyone of you have experience with the following thrilling task: We want to read specific queries from within a BPS function, handing over parameters like company code and profit center, retrieving the query results and writing them into a cube.
Is this feasible and would anyone know about the function modules to use?
Many thanks in advance,
Andreas Krüger

Andreas,
I found a soultion for your problem.
I tried at in my system and it works fine.
Pl do the following:
1. Have a multiarea with actual and plan areas or have one area but make sure you load data from actual to plan.
2. In the level, select all the charactetirtics and key figures that you wish to see in the report.
3. Make a layout and configure it accordingly. If header has mutiple values, make sure you have a variable on that.
4.Make a folder and execute it.
5. When the folder is opened, all the data in the cube will be displayed in the change mode.
6. View the date and change them if you wish, save.
Let me know if you ned any help.
Ravi Thothadri

Similar Messages

  • Invoking "this" from within a function

    Assume we are in this situation:
    mc.onRollover=function()
    trace(this);
    function dosmthing()
    trace(this);
    The first trace(this) would render the path of the movieclip,
    mc. The second one, however, would render "undefined". Is there a
    way of retrieving the path of the movieclip from within the
    function? I can't hardcode it, since it's dinamically assigned.

    try using a variable:
    mc.onRollOver=function() {
    var t:MoveClip = this;
    trace(t);
    function dosmthing() {
    trace(t);
    //OR pass a reference of 'this' to the function ...
    mc.onRollOver=function() {
    dosmthing(this);
    function dosmthing(t:MovieClip) {
    trace(t);
    'dosmthing' is a 'nested' function, not an 'assigned'
    function, so does not have a path reference.

  • Changing Property Values from within a Function

    I'm wondering how I can change a property of an instance from
    within a function inside a method. I have some code here...
    Basically I just need to set _lynn_idle to false when a tween is
    occuring and _lynn_idle to true when the tween is finished.
    Unfortunately I can't seem to simply set it to false or true inside
    these listener functions like I'm able to anywhere else (seems the
    variable is only local to the function when I need it to access the
    variable associated with the instance). Any help is much
    appreciated.

    Inside callback handlers the class members go out of scope.
    To remedy use a local (local to the function) reference to the
    current object.

  • ORA-14551 Call to a proc that performs INSERT from within a FUNCTION

    Anyone,
    I have written a number of functions that serve to convert an old_value to a new_value. But there are some times when the conversion fails. I wish to log those exceptions into a table and move on. I undertand FUNCTIONS are not to insert data but that is why I created a PROC and want to be able to call it from within the FUNCTIONs.
    Is there any way to get around the ORA-14551 error?
    Here is what I have:
    CREATE OR REPLACE FUNCTION MAXIMO.fcn_get_worktype
      ( worktype_IN IN varchar2,
        siteid_IN IN varchar2)
      RETURN  varchar2 IS
      var_worktype varchar2(5);
    BEGIN
         IF siteid_IN IN ('ML','OK','BE') THEN
            BEGIN
                 SELECT NVL(NEW_WTYPE,NULL)
                INTO var_worktype
                 FROM MAXIMO.MAX411_WBK_WORKTYPE$
                 WHERE OLD_WTYPE = worktype_IN;
            EXCEPTION
                WHEN NO_DATA_FOUND THEN
                    MAXIMO.SP_CONVERSION_EXCEPTION('WORKTYPE', 'WORKTYPE', worktype_IN, siteid_IN);
                    var_worktype := 'XX';
                     RETURN var_worktype;
            END;
        END IF;
        RETURN var_worktype ;
    END;And here is my PROC:
    CREATE OR REPLACE PROCEDURE MAXIMO.sp_conversion_exception (table_IN IN VARCHAR2, column_IN IN VARCHAR2, value_IN IN VARCHAR2, tab_ID IN VARCHAR2)
    IS
    BEGIN
        INSERT INTO MAXIMO.MAX411_CONVERSION_EXCEPTIONS
             ( TABLE_NAME,
             COLUMN_NAME,
             VALUE ,
              TAB_ID)
        VALUES
             ( table_IN,
             column_IN,
             value_IN,
              tab_ID );
        EXCEPTION
            /* If value was already recorded then do not record again, Key is on all three columns */
            WHEN DUP_VAL_ON_INDEX
                THEN
                    NULL;
        COMMIT;
    END;Can anyone shed any light on how I can stop getting:
    ERROR at line 1:
    ORA-14551: cannot perform a DML operation inside a query
    ORA-06512: at "MAXIMO.SP_CONVERSION_EXCEPTION", line 5
    ORA-06512: at "MAXIMO.FCN_GET_WORKTYPE", line 16
    ORA-01403: no data found
    ORA-06512: at "MAXIMO.LOAD_PM", line 181
    ORA-06512: at line 1
    Thanks in advance for any help I can get...
    Miller

    You need a PRAGMA AUTONOMOUS_TRANSACTION in your exception procedure, eg:
    CREATE OR REPLACE PROCEDURE MAXIMO.sp_conversion_exception (table_IN IN VARCHAR2, column_IN IN VARCHAR2, value_IN IN VARCHAR2, tab_ID IN VARCHAR2)
    IS
      PRAGMA AUTONOMOUS_TRANSACTION
    BEGIN
      ...

  • Need help to call a simple function from within another function?

    I created a movieclip which has a function in its one and only frame.
    function testx() {
    x = x+2};
    This movieclip is in the main timeline (in its own layer).
    In another layer on the timeline I have created a single keyframe with a button instance called myBtn
    myBtn.onRelease = function() {
    var x
    x =2
    testx(2);
    trace (x);
    What I want to do is call the function in the movieclip frame from the button press function. However, I can't seem to reference it properly.
    Can anyone help me to basically call a simple function from within another function?

    Yes am using CS4.  Have saved it as CS3 now.  Ok the file is somewhat complicated and what I am testing is not what I ultimately want to do but if I can pass that variable I can figure it out.  In terms of describing the file I think the only parts of importance are what I put in my previous post (please let me know if there is something I should be telling you that I have missed).  I am 99.9% sure that I am using the correct instance name.
    Scene1 Layer3 Frame1 has the function call for the button.
    myBtn.onRelease = function() {
    var x
    x = 2
    testx(2);
    trace (x);
    Slideshow layer //Actions Frame1 has the function
    function testx(x) {
    x = x+2};
    thank you so much for helping me.

  • Is it possible to fire DDL queries from within a trigger?

    Hi,
    In Oracle 8.0.5, Is it possible to fire DDL queries from within a trigger?
    e.g. when no. of rows is multiple of 1000, I wish to call a procedure which
    analyzes the table and finds the size of the table. I am getting :
    "ORA-04092: cannot COMMIT in a trigger" error message.
    Regards
    Sanchayan

    One way around this is to use the AUTONOMOUS_TRANSACTION pragma, but I think that was introduced in 8i. Check your docs. Another way is to set up a procedure to do the ANALYZE and in your trigger submit a job using DBMS_JOB to run that procedure.
    Anyway, the second option is best because you really don't want to impose the overhead of running an ANALYZE onto a DML transaction.
    You are also going to run into the mutating table problem: you can't find out how big the table is, because you can't run queries against the table from within a trigger. You could use DATE_LAST_ANALYZED from USER_TAB_COLUMNS, but really you should just schedule jobs to run ANALAYZE at regular intervals - once a day, once a week, once a month, depending on the volatility and usage of any given table.
    Cheers, APC

  • Does exist a way to read data from IP planning cube with ABAP?

    Hello All.
    My scenario is as follows:
    I have an ODS where we store costcenters to be planned. This ODS is loaded via a manual falt file load (regular dta transfer process).  In order to avoid inconsisten data in the planning cube, I want to check in my ODS load process, if any costcenter which is already planned (it has planned data in my planning cube) is being deleted in the loaded file.
    To do this, I need to access my planning data cube ( i guess also planning buffer), so my question is if there is any function module which retrieves data from a planning level as reference data.
    Thanks a lot and best regards,
    Alfonso.

    Hi Alfonso,
    note 1101726 shows how the plan buffer can be read.
         l_r_plan_buffer = cl_rsplfa_plan_buffer=>if_rsplfa_plan_buffer~get_instance( i_infoprov ).
         l_r_plan_buffer->get_data( EXPORTING i_t_charsel = l_t_charsel       
                                              i_include_zero_records = rc_false
                                              i_r_msg = l_r_msg
                                    IMPORTING e_r_th_data  =  l_r_th_data
                                    EXCEPTIONS OTHERS  = 2 ).  
    Please take a look at the note. You do not need to implement the after_burn_selection exit, but you can find sample code how to read the planning buffer. Please give it a try.
    Another solution would be to use the function module RSDRI_INFOPROV_READ. But you need to make shure that you first close the yellow request. This can be done using function module RSAPO_SWITCH_BATCH_TO_TRANS.
    Hope this helps
    Matthias Nutt
    SAP Consulting Switzerland

  • Reading files from within helper classes

    From within a servlet, I can get the servlet context to get a path to the "web" directory of my project and easily access properties files for my project. If I create another package in my project to hold helper classes that perform some specific function and want to create and/or read from a properties file, I get a path to the bin directory of my servlet container:
    Servlet Path: D:\Documents and Settings\Josh\My Documents\Josh\Projects\ServletSandBox\build\web\
    Helper Class File Path: D:\Program Files\Apache Software Foundation\Apache Tomcat 6.0.14\bin\test
    I'd like to develop my helper packages as reusable APIs, so they're not tied directly to my project or to a servlet in general, but I'd like the properties files to stay somewhere in my project folder, preferably in the WEB-INF directory with the servlet's own specific properties file.
    I can't figure out the best way to handle this. I wanted to just be able to pass the helper class a String if somebody wanted to specify a filename other than the default filename. Does it make sense to specify a file URL instead? Is there any other way to get the calling servlet's context path without having to pass in a variable?
    Thanks

    It seems that the helper API shouldn't need to be given a path to its own config file. I would like to have code that will load the file regardless of whether or not its in a stand alone java app or a servlet. Whenever the helper API is jarred up and imported into my servlet, it can't find the config file unless it's in the "D:\Program Files\Apache Software Foundation\Apache Tomcat 6.0.14\bin\test" directory. OR, if I use the current thread to get the loader, it will locate it in the "classes" folder, which is the only solution I can come up with that will let me write code to load the file that will work, regardless of its implementation.
    The "project" folder I'm talking about is just the NetBeans "project" folder for the servlet, or the "ServetSandBox" folder in my example. I guess that doesn't really matter in the context of the servlet though.
    So is using the current thread the appropriate way to do this? When you say that code will work if I put the resource in the WEB-INF directory, that seems to only be true if I try to load it from the servlet itself, not the helper class. The helper class doesn't find the resource in the WEB-INF directory.
    Also, I would like to be able to write the default values to a new config file if one doesn't exist. How in the heck do I get a pointer to the "classes" folder, or any other folder that I can also read from using the classloader, so I can write to a new file?

  • Read data from SNP planning book

    Hi Frnds,
    We are faced with a situation in which we need to read certain key figures such as PIR's, Goods Issue from SNP Planning book.
    We tried using BAPI "BAPI_PBSRVAPS_GETDETAIL" to retreive data. But it seems that we are giving wrong input data to the BAPI. Could you please let us know what to be fed into the BAPI in simple terms? If there is any example code for the same , would be very much appreciable.
    Orelse if there is some other way to retreive this data kindly suggest us accordingly...
    Many thanks in advance.
    Regards,
    Karthick

    Hi Karthick,
    The parameters for calling BAPI_PBSRVAPS_GETDETAIL really depends on your Planning Area and Planning Book configurations. The planning book configuration will limit what Characteristics and Key Figures will you be able to read using BAPI_PBSRVAPS_GETDETAIL. Let me give you an example.
    Assumptions: The planning book is configured as follows:
    Name = ZPB1
    Data view  = DV1
    The DV1 data view contains the characteristics 9AMATNR and ZCNTRY and Key Figures ZKF1 and ZKF2.
    Assuming also that we have the following data currently in livecache:
    9AMATNR-ZCNTRY-ZKF1-ZKF2
    000001234-PH       - 143  - 567
    000007891-PH       - 245  - 782
    000007891-US       - 124  - 890
    Let's further assume that you want the data aggregated to country level (e.g. char ZCNTRY), you have 1 planning version 'ZPAV1' and you only want the data for Country=PH, then here are the parameters that you need to pass to  BAPI_PBSRVAPS_GETDETAIL:
    PLANNINGBOOK = 'ZPB1'
    DATA_VIEW = 'DV1'
    SELECTION =  9AVERSION I EQ ZPAV1, ZCNTRY  I EQ 'PH'
    GROUP_BY = 'ZCNTRY'
    KEY_FIGURE_SELECTION  = ZKF1, ZKF2
    Hope this helps. Please post again if you have any questions. I can give you sample code if you can post your email address.
    Message was edited by:
            Emmanuel Nepomuceno (added planning version to selection)

  • View db alerts generated in planning book A from within planning book B?

    Hi,
    I have a db alert macro implemented as a default macro in one of our SNP planning books/data view. This is correctly generating db alerts per the criteria coded into the macro. In Alert Monitor, the database alerts show the planning book (book A) and data view (view 1) from which the alerts were generated.
    The planners monitoring this specific alert do not have/should not have access to planning book A and data view 1,  but will have access to a different planning book (B)/data view (2) within the same planning area.
    Is it possible to generate a db alert from a default macro residing in planning book A, data view 1 but have the db alert as viewed in Alert Monitor display a different planning book (B), data view (2) so that when the user launches Supply Network Planning by right clicking on the db alert, the user is taken to planning book B, data view 2 with the alert selection loaded?
    In short, I need to generate db alerts via a default macro in one planning book/data view but must enable planners who monitor these alerts to do so in a different planning book, data view -- all within the same planning area.
    I saw an earlier thread (id 4517019) that seemed to indicate this was possible to assign db alerts generated in one planning book to another planning book,  but it was not clear how to implement this. We are on APO version 4.0. In the macro's Alert/status element properties I do see a section called 'Different Source' which allows me to specify a different planning book and macro. However, I do not understand how this is meant to be used and whether this will be useful to me.
    I would appreciate any help you can offer.
    Thanks!
    - Heidi

    Saradha,
    Thank you for your reply! I checked the various versions of SAP help and found that only as of Release SCM 4.1 can you assign the alerts that are generated in a planning book/ data view to another planning book/data view via the mechanism you explained.  That tells me that perhaps in SCM 4.0 there is no straightforward way of doing this.
    In 4.0, when I double click the macro alert element I see different attributes - one of them is in a section titled 'Different Source' and contains to fields - one that allows you to specify a planning book and the other to specify a macro in that planning book. I'm experimenting with that now to better understand what it's purpose is. If you have any idea, please let me know. Otherwise, thanks very much for your response!
    Thanks,
    - Heidi

  • Accessing a VAR from within a Function

    I'm sure this is a simple question, but I have been batteling
    it all night. I am pulling data from a database, this works fine.
    the data loads into flash fine, but I cant figure out how to use
    this data outside of the function.
    I have looked at global var, timeline vars, but I must be
    missing something. I have attached my code, if you run it, it will
    load the data, I left the link live.
    In the function the data traces correctly, outside of the
    function it fails.
    Thanks
    ~Chris

    Ok, I attempted this last night, and I am unning into an issue.
    Heres what I have, I am pulling data from a mySQL database, into a
    php file that includes XML, Here is the PHP Script.
    $query = "SELECT * FROM Teams WHERE active = 'Y'";
    $resultID = mysql_query($query, $linkID) or die("Data not
    found.");
    $xml_output = "<?xml version=\"1.0\"?>\n";
    $xml_output .= "<teamData>\n";
    for($x = 0 ; $x < mysql_num_rows($resultID) ; $x++){
    $row = mysql_fetch_assoc($resultID);
    $xml_output .= "\t<item>\n";
    $xml_output .= "\t\t<teamName>" . $row['TeamName'] .
    "</teamName>\n";
    $xml_output .= "\t\t<manager>" . $row['Manager'] .
    "</manager>\n";
    $xml_output .= "\t\t<order>" . $row['LeagueOrder'] .
    "</order>\n";
    $xml_output .= "\t</item>\n";
    $xml_output .= "</teamData>";
    echo $xml_output;
    ?>
    NOTE: This script does run fine, if I run the PHP I do get the
    correct results.
    so I modified the Action Script you sent me a little to fit
    my PHP script. but I must be missing something. I think the problem
    is, what part of my XML goes after "studentData
    newTextField.text = studentData
    .teamName + " :: " + studentData.manager + " :: " +
    studentData
    .order;
    Thanks Again for the help
    /////////////////////////////////////////////////////////////////////////////////////

  • How do you "Instantiate" a Nested Table from within a FUNCTION?

    , I managed to compile and create the FUNCTION.
    But when I invoked it,
    ORA-06531: Reference to uninitialized collection
    ORA-06512: at "DEV.SPGETPARENTSTABLE", line ...
    I think I need to somehow *"Instantiate"* the Nested Table and I didn't:
    CREATE OR REPLACE FUNCTION spGetParentsTable
    ObjectId number,
    ObjectClassifier varchar2
    RETURN types.TmpHiearchyMapTableType
    IS
    TmpHierarchyMap types.TmpHiearchyMapTableType;
    ThisTempId varchar2(32);
    CURSOR spGetParents_cursor IS
    SELECT
    ReferencedId Id,
    ParentId,
    ChildId,
    FROM TMP_HIERARCHYMAP
    WHERE TmpUID = ThisTempId;
    BEGIN
    SELECT sys_guid() INTO ThisTempId FROM dual;
    spRecursiveGetParents(ObjectId, ObjectClassifier, ThisTempId);
    FOR oMap in spGetParents_cursor LOOP
    TmpHierarchyMap.Extend(); **** BUT I haven't "Instantiate" the Nested Table yet ****
    TmpHierarchyMap(TmpHierarchyMap.Count) := TmpHierarchyMapObjType( oMap.Id
    , oMap.ParentId
    , oMap.ChildId
    END LOOP;
    DELETE FROM TMP_HIERARCHYMAP WHERE TmpUID = ThisTempId;
    RETURN TmpHierarchyMap;
    END spGetParentsTable;

    It's annonyingly trivial to fix. In your declaration section try
        TmpHierarchyMap types.TmpHiearchyMapTableType :=  types.TmpHiearchyMapTableType();
        ...Cheers, APC
    blog: http://radiofreetooting.blogspot.com

  • Reading Data From a Different Planning Package in a Exit Function

    Hi,
    Is it possible to read data from a planning level / package other than the package that the exit function was executed with?  I want to read data into an internal table from another package and use that data in combination with the data in the current package to create new records.  If this is possible sample code for how to read data from a different package would be appreciated.
    Thanks!
    Mel Waldner

    Hi,
    As an example lets say you have restricted 0calmonth in your package to 6.2007. In the planning layout to fetch values for 5.2007 (read only), you can take 0calmonth in data columns, and for this column restrict it as 5.2007.
    Similarly in Planning functions, you can mark 0calmonth as field to be changed and fetch data for 5.2007.
    Hope this helps.

  • Error in reading data from planning book

    Hi Guys,
    I am facing error in reading data from SNP planning book .
    When i try to read single product data for simulation version , it gets loaded correctly.
    However, when i try loading data for more than one product, then i get error "Product does not exist".
    I checked all products are assigned to model-version.
    I tried running consistency check as well and after it finished got message as "All inconsistencies can not be corrected".
    Please let me know if any one had faced this error.
    Thanks.

    Hi,
    Consistency check should solve the problem in this case. Try running it specifically on the version you are using. It should work.
    Regards,
    Guru Charan.

  • How to get planning function in customized data slice?

    Hi all,
    we are using a customized data slice which implements IF_RSPLS_DATASLICE. Now we have the requirement that the data slice only protects the data when it calls via query. The data slice will not protect data if a planning function is executed. How can we implement this requirement? Is it possible in the method IF_RSPLS_DS_METHODS ~ IS_PROTECTED to read this information from an instance of the planning function (CL_RSPLS_CR_CONTROLLER?) or the buffer or something else? Or can we find some information about the query?
    At the moment we only check if a planning sequence is called by a process chain. This works fine
    IF sy-batch IS NOT INITIAL.
        e_noinput = rs_c_false.
        EXIT.
      ENDIF.
    Thanks for your help!

    Hi,
    I think this topic was already discussed in this forum.
    By design, it should not matter whether a query or a planning function is not allowed to change records. This is what data slices were designed for.
    OK, you need a different behaviour.
    1. Maybe you can detect from the planning function filter or query filter whether you run function or a query. If this is the case use the method IS_OVERLAPPING of the data slice. There you get the filter as a I_TSX_SELDR or as a range table when you call SELDR_TO_RANGE. When you return r_is_overlapping = rs_c_false. the data slice will not be called.
    2. Another option is to call the factory of the data slice and to use a flag in the data slice that indicates that the data slice is used in the context of a planning function. The factory method is GET_INSTANCE. Set a break point there to find out how the system calls this method. But when to call the factory? Check note 1101726. This note provides infrastructure to change the filter of a planning function at run time. But you can use this exit to call the factory method mentioned above. The nice thing is that you can raise the excpetion EMPTY in the exit, thus the function will not be called. So use a planning sequence with dummy1, your function, dummy2. For dummy1 switch on flag on, raise EMPTY, dummy1 will not be executed (almost no run time is needed), then 'your function' will be called (do nothing in the exit', then function dummy2 will be called, here switch the flag off again.
    Check also the following link where the above technique is used to for the conditional execution of planning functions:
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/a0785271-1446-2d10-6987-d1e44f08e97c
    Regards,
    Gregor

Maybe you are looking for