(BW) Run the Start Routine Only Once

I understand that for every data package from ODS to Cube, the start routine is run.  But I need to run it only once.  Is there anyway to achieve this in ABAP?

I once had that same requirement, but in a datasource in R3. I'm not sure if the same solution would work in BW, though. I used a memory id to keep the variable value between packets:
DATA: ... n_globalvar TYPE n ...
then I added...
IMPORT n_globalvar FROM MEMORY ID 'ZMEMID01'.
...at the start of the routine to retrieve to the variable the value from the memory id.
At the end of the code, I exported the variable back to the same memory id...
EXPORT n_globalvar to MEMORY ID 'ZMEMID01'.

Similar Messages

  • Need to run start routine only once

    I understand that for every data package from ODS to Cube, the start routine is run.  But I need to run it only once.  Is there anyway to achieve this?  As the programming logic doesn't really do anything to the data package, I don't need it to be in the start routine.  But as I populate a database table using that routine, which in turn is used in update routines, I need to kick it off before the load from ODS to cube happens.  I think an ABAP routine variant can be kicked off in process chains.  Did anyone use the variant and know how to kick off the routine?  Do I have to write this logic in a function module and then kick it off using ABAP variant in Process chains? 
    I would prefer a way to limit my start routine to run once for every data load rather than kicking it off through process chain.  Can someone discuss which is a good approach and how I go about it?  Thanks for your inputs.
    Sam

    Hi Sameer,
    Let me recap you req. You want to populate a database table in your start routine and need to do it once for a load.
    There is no possible way to limit the no. of times a Start routine is run, but you can find some worksaround.
    Is there anyway you can identify that your DB table is updated with new records, i.e.
    1> You delete and refill table every time
    2> You have some kind of time stamps.
    If one of the above case is true, then you can use that as a check in the Start routine to limit the no. of times the DB table is being populated.
    Regards,
    Sree

  • Execute ABAP code in Start Routine only once

    I have ABAP code in a start routine that I only want to execute once. Is there a way to tell this is first execution of the start routine?
    Also can I find out these value in the start routine ABAP:
    1. How many data packets there are?
    2. What data packet I am processing?
    Regards,
    Mike...

    Hi,
    I've just setup a little test:
    TRules, Start Routine Global Decl:
    DATA: GVI TYPE I, GVN(5) TYPE N.
    Start Routine:
    IF GVI IS INITIAL.
    GVI = 1.
    ELSE.
    ADD 1 TO GVI.
    ENDIF.
    MOVE GVI TO GVN.
    This is basically counting the times the start routine is executed and populating the var GVN; I am posting GVN in a char ZTESTGV in the target cube. I am posting as well the datapakID in my cube.
    I have loaded two requests (each 4 packets)
    the first one first to PSA and then from the PSA to the target: this is Serially using one single process. Here's the result in the cube:
    Request________________________________DATAPAKID_____ZTESTGV
    REQU_8B5ASGQNYYNIV1OJN68HFH1SR____________1____________1
    REQU_8B5ASGQNYYNIV1OJN68HFH1SR____________2____________2
    REQU_8B5ASGQNYYNIV1OJN68HFH1SR____________3____________3
    REQU_8B5ASGQNYYNIV1OJN68HFH1SR____________4____________4
    In this case the global variable is persistent accross packets.
    the second request is loaded in paralell: this is, multiple processes are executed at the time. Here's the result in the cube:
    Request________________________________DATAPAKID_____ZTESTGV
    REQU_14QVH21BSVH44FAJW94BD7N2H____________1____________1
    REQU_14QVH21BSVH44FAJW94BD7N2H____________2____________1
    REQU_14QVH21BSVH44FAJW94BD7N2H____________3____________1
    REQU_14QVH21BSVH44FAJW94BD7N2H____________4____________1
    In this case the global variable is always1 !!
    This is logic since several a process cannot access the internal memory used by another one...
    Conclusion; the global variable will work only if the load is serial...
    hope this helps...
    Olivier.

  • Start routine: only once per teh load but not once per data packet

    Hi,
    I would like to execute some code in start routine (in update rules) only once per the load but not once per the data packet.
    How can I implement this.
    Regards,

    I once had that same requirement, but in a datasource in R3. I'm not sure if the same solution would work in BW, though. I used a memory id to keep the variable value between packets:
    DATA: ... n_globalvar TYPE n ...
    then I added...
    IMPORT n_globalvar FROM MEMORY ID 'ZMEMID01'.
    ...at the start of the routine to retrieve to the variable the value from the memory id.
    At the end of the code, I exported the variable back to the same memory id...
    EXPORT n_globalvar to MEMORY ID 'ZMEMID01'.

  • How to run the processRequest initialization only once

    My home page has a table that is initially populated based on the users userId.
    The user can then select a differnt user to display data for.
    From the table, the user can drill down to another page. If the user uses the browser back button (need to press twice), he is returned to the search results correctly.
    If instead the user clicks on the returnNavigation link, the query initialization in the processRequest is fired again.
    Is there a way to only fire this query initialization when the page is first loaded ?
    Similiar type of problem where I set the pagetitle to a parameter passed from the original page. If the user then drills to a 3rd page and returns using the returnNavigation link, the data is still the same but the page title (set in the processRequest section) is set to null

    Well, first thing is that issue subject is kind of misleading. You cannot have control over the inherent calls to processRequest but what is required is putting up some logic to overcome your issues.
    You can maintain a session flag to track your status of first time page load. With the help of this flag, you can conditionally initialize the query. Same applies to page title issue.
    One more suggestion, never use browser back button.
    --Shiv                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Why java allow start() method only once for a thread

    Hi ,
    Why java allows start method only once for thread . suppose
    Thread t = new Thread();
    t.start();
    say at later stage if again we call t.start() IllegalStateException is thrown , even though isAlive method returns false.
    Hence the question , why start() method is allowed only once.If you need start a thread , we need to create a new instance.

    Really. Why do you think that? Do you have any evidence? It is one of the first things I would think of, personally.Considering that the Thread API doesn't allow you to specify a stack address (only stack size), I think it demonstrates they wanted to remove that capability from their Thread API all together. That missing "capability" makes me believe they want me to believe it's not something I need to worry about when using their API... I think the exact semantics of the Thread class and its methods were driven by how to make it most understandable and usable for their customers. I'm certain this issue was one of many that was given considerable thought during the design and implementation of the JVM and the underlying runtime classes.
    Do I have any evidence? No. But if you can point me at some first-hand information on this, I'd love to read it. Most of what I've found is second or third hand accounts. (and I mean that sincerely, not as a smart-ass remark or rebuke of your comments).
    On the one hand you seem to think the Java API designers are idiots, on the other hand you think that they should be. I can't make it out.I thought my position was that the Java developers were talented enough to implement platform in whatever way their API called for; hence, the designers made a choice about how they wanted their API to be used by their customers. They decided which capabilities they wanted to include or exclude, and created an API that was consistent with their vision for this technology. While I'm certain technical limitations had an effect on the API design, I certainly don't think the API was dictated by the them.
    I think the current design of the Java Thread API was a reflection of their vision to make Threading easier and more accessible to Joe Programmer, not limitations in the implementation. I never said it was wrong or that I could do better... I just said I think they could have done something different if they decided it would have made for a better customer experience. But hey, maybe I'm wrong.

  • My macbook pro won't start up. Instead of the apple logo appearing in the start up only a grey folder with a ? At the center appears

    My macbook pro won't start up. Instead of the apple logo appearing in the start up only a grey folder with a ? At the center appears

    Boubert,
    the question mark in the folder typically represents the inability to recognize a valid filesystem on the volume being booted from. You can try this, although it might not make a difference: boot your MacBook Pro into Recovery mode by holding down a Command key and the R key as it starts up. Once the OS X Utilities menu appears, select Disk Utility. On the left-hand side of the Disk Utility window, select your internal disk’s boot partition (typically called “Macintosh HD”). On the right-hand side, select the First Aid tab if it’s not already selected, then press the Verify Disk button if it’s not greyed out; if it is greyed out, or if it reports that errors were found, press the Repair Disk button. Once the verification/repair is completed, exit Disk Utility and select Restart from the Apple menu to restart in normal mode. Is it able to boot normally now?

  • Diff between the Start routine and Update rules?

    Hi Gurus
    Diff between the Start routine and Update rules?
    Thanks in advance
    Raj

    Hi,
    Routines are like conditions or business rules that could be applied to filter the data while entering the BW system or could be used to apply certain conditions on the info objects itself.Update rule level you manipulate your data and  write your start routine.
    There are 4 types of routines
    1. Start routine- Could be used at two levels (transfer rule level and the Update rule level)
    This Start routine written at the transfer rule level helps filter the necessary data coming from the source system.
    For Example: If you decide to extract data that contain only quantity greater than 500 , then you could specify the Start rouitne to achieve this.
    The Start routine at the Update rule level provides similar functionality but at this point it helps direct specific data to 
    different data targets.  For Example: If there 3 data targets being fed from the Infosource, you may want to apply some condition to each data target, like send year 2000 data ti Data target1, 2001 to data target 2 and so on.  This can be achieved by using Start routine at the Update rule level
    2. Transfer Routine: This feature is available at the transfer rule levels
    While performing the transfer rules operation, there are 4 features available to the developers to create business rules on top pf the Infoobjects.
    1. You could do a one to one mappping of the Infoobject
    2. Provide a constant value
    3. Include a formula
    4. Write an ABAP routine.
    These 4 options refers to the transfer routine
    3. Update Routine:
    The limitations of just having 4 options in the transfer routine is overcome at the update rule level. There are various other 
    sophisticated features avaialable apart from the 4 options mentioned above. These business rules could be specified pertaining to each data target.
    4. Conversion Routine: It provides functionality to do Currency and unit conversion.
    Regards.

  • How to write the start routine in the transformations ?

    Hi Experts,
    I am working on BI 7, As I want to write a start routine in transformations of 0FIGL_O02 DSO, to allow the GL accounts with cost center data. Already there is a delete statement please find.
    *DELETE SOURCE_PACKAGE where BAL_FLAG = 'X'. I had made comment to allow the G/L accounts. since I have some GL Accounts which does'nt have the cost center data, so in this case I have to write a ABAP code to allow this G/L accounts with cost center data.
    So Let me know if anyone can help me how to write the ABAP code in the start routine.
    Thanks
    sekhar

    Hi Experts,
    I am working on BI 7, As I want to write a start routine in transformations of 0FIGL_O02 DSO, to allow the GL accounts with cost center data. Already there is a delete statement please find.
    *DELETE SOURCE_PACKAGE where BAL_FLAG = 'X'. I had made comment to allow the G/L accounts. since I have some GL Accounts which does'nt have the cost center data, so in this case I have to write a ABAP code to allow this G/L accounts with cost center data.
    So Let me know if anyone can help me how to write the ABAP code in the start routine.
    Thanks
    sekhar

  • The field "SOURCE_PACKAGE" is unknown IN THE START ROUTINE?

    Hi all,
    i am trying to create a start routine in the DTP FROM THE CUBE TO THE OPEN HUB.
    But when i check the syntax : it throws me an error message stating.
    The field "SOURCE_PACKAGE" is unknown IN THE START ROUTINE?
    how come the source package is unknow in the start routine can anyone pls advise  me on this!!
    DATA: l_tabix TYPE sy-tabix, wa_source_package TYPE tys_sc_1.
    LOOP AT SOURCE_PACKAGE INTO wa_source_package.
    l_tabix = sy-tabix.
    IF wa_source_package-SALES EMP EQ ' '.
    DELETE SOURCE_PACKAGE
    WHERE SALESEMP EQ ' '.
    INDEX l_tabix.
    ENDIF.
    ENDLOOP.

    Hi Pooja,
    I think that the error comes from the delete statement.
    As you already said, the SOURCE_PACKAGE is from BI7.0. That means that the LOOP AT statement cannot be wrong (although I prefer field-symbols)
    I would restate you code like below:
    DATA: l_tabix TYPE sy-tabix,
          wa_source_package TYPE _ty_s_sc_1.
    LOOP AT SOURCE_PACKAGE ASSIGNING <source_fields>.     "<source_fields> is declared as line from source_package
    * l_tabix = sy-tabix.
      IF <source_fields>-SALES_EMP IS INITIAL.
        DELETE <source_fields> FROM SOURCE_PACKAGE.
    * If this line does not work, try to add TABLE after the FROM-statement
    *WHERE SALESEMP EQ ' '.
    *INDEX l_tabix.
      ENDIF.
    ENDLOOP.
    Hopefully this will help.
    Alternatively you can try a single statement, because it is not necessary to do a loop.
    DELETE SOURCE_PACKAGE WHERE sales_emp IS INITIAL.
    Good luck!
    Steven Groot
    Edited by: S. Groot on Aug 11, 2010 7:50 AM

  • BW7.3 SOURCE_PACKAGE and DATA_PACKAGE are incompatible in the Start Routine

    Hi Gurus,
    a face a strange behavior with BW7.3 and the Inventory Cube 0IC_C03:
    the standard scenario works well when I activate the cube and its transformations ..bx, bf and um. Then I have modified the InfoCube 0IC_C03 and added some field like 0customer or 0doc_number etc. I also added the fields to the InfoSource 2LIS_03_BF_TR and everything was as usual.
    Then I wanted to activate the transformation TRCS 2LIS_03_BF_TR -> CUBE 0IC_C03 when I had the error
    "E:In PERFORM or CALL FUNCTION "ROUTINE_9998", the actual parameter "SOURCE_PACKAGE" is incompatible with the formal parameter "DATA_PACKAGE".
    I already tried to copy and paste the structure of tys_SC_1 to tys_SC_1_full but whenever I activate the transformation my changes are dropped while the error remains. I assume, that the problem is due the compilation process.
    Any hints to solve the problem? Thank you in advance.

    Hi Cemal,
    When we do the modifications at times the field structures inside the start routine are not update so that updation is required to be done manually. Copy the field list of structure (inside the start routine)  tys_SC_1 (this is gryed out i.e. change disabled) and paste the same structure to tys_SC_1_full & tys_TG_1_full.
    Check the routine and save it.
    Hopefully it will solve your problem.
    Regards,
    Dipika

  • Hello, i created 5 different books (photo album) and i would like to know if it's possible to make one single order (and pay the transportation fees only once...) i couldn't find how

    hello, i created 5 different books (photo album) and i would like to know if it's possible to make one single order (and pay the transportation fees only once...) i couldn't find how

    Soory, no, it is not possible. You can only combine multiple copies of the same book into one order.
    Regards
    Léonie

  • Poplulate key figure thru the start routine

    Hi Experts,
    I have update rules for my cube. In the start routine there, if i wrote abap code would it automatically fill the value of key figures in the cube. Can we do that with the ABAP code ?
    Or do i have to go to each key figure's routine and then refer to the internal table data in the update rules etc.
    If someone has done this before, would you pls walk me thru it.
    Thank you,
    T

    Hi Tia Ismail,
    I hope it is wrong to update the cube fields directly in the start routine.
    i,e
    <i>add DATA_PACKAGE-/bic/zslsgm to /bic/ft_mismets-/bic/Zslsgm.
    add DATA_PACKAGE-/bic/zsalesamt to /bic/ft_mismets-/bic/Zsalesamt.
    add DATA_PACKAGE-/bic/zinvlines to /bic/ft_mismets-/bic/zinvlines.</i>
    The above statements are wrong.
    Then start routing you will update the values (from blank to some value) for these fields. And also make 1 to 1 mapping Between these KF of info cube to Fields of Communication structure. i,e
    Zslsgm(Info cube KF) <---> Zslsgm(Communication structure field)
    Zsalesamt(Info cube KF) <---> Zsalesamt(Communication structure field)
    zinvlines (Info cube KF) <---> zinvlines(Communication
    structure field)
    The code you have to use in Start routine is :
    tables: /bic/pzproduct,
    /bic/ft_mismets.
    DATA ITAB like /bic/pZproduct occurs 0 with header line.
    select * from /bic/pzproduct into table itab where /bic/zproductlike 'misc%' and /bic/t_miscper is not null.
    Loop at DATA_PACKAGE.
    Loop at itab where
    /bic/zproduct <> DATA_PACKAGE-/bic/zproduct.
    DATA_PACKAGE-/bic/zslsgm = 0.
    DATA_PACKAGE--/bic/zinvlines = 0.
    DATA_PACKAGE-/bic/zsalesamt  = 0.
    Modify DATA_PACKAGE.
    endloop.
    ENDLOOP.
    With rgds,
    Anil Kumar Sharma .P
    Message was edited by: Anil Kumar Sharma

  • Not able to debug the start routine

    Dear All,
    I am facing a weired situation.
    I have a transformation(DSO -> Cube) with start routine. I am able to debug the routine in Development System.
    I transported the routine to Production System successfuly, but i am not able to debug the start routine there. I have all the necessary authorisations(SAP_ALL, SAP_NEW)
    I am perplexed. Never seen such issue before.
    Can someone help me here?
    Regards,
    Avinash.
    Edited by: Avinash Kumar on Nov 5, 2008 11:16 AM

    Dear Jerry,
    Thanks for writing.
    I followed the instruction, but it didn't work.
    Can there be any technical reason for data package to be empty, even if the source has data(Note: There is no filter in DTP)?
    Also, i just checked with other start routines...I am not able to debugg there also. System is not entering the debug mode.
    Here, the patch level is: 0010. Can this be the villain?
    Please advise.
    Regards,
    Avinash.
    Edited by: Avinash Kumar on Nov 6, 2008 4:26 AM
    Edited by: Avinash Kumar on Nov 6, 2008 4:51 AM

  • What is the logic behind the start routine

    Dear One's,
    Kindly take a moment and explain the logic behind this start routine written in update rules of ODS.
    PROGRAM UPDATE_ROUTINE.
    $$ begin of global - insert your declaration only below this line  -
    $$ end of global - insert your declaration only before this line   -
    The follow definition is new in the BW3.x
    TYPES:
      BEGIN OF DATA_PACKAGE_STRUCTURE.
         INCLUDE STRUCTURE /BIC/CST_T07_O006.
    TYPES:
         RECNO   LIKE sy-tabix,
      END OF DATA_PACKAGE_STRUCTURE.
    DATA:
      DATA_PACKAGE TYPE STANDARD TABLE OF DATA_PACKAGE_STRUCTURE
           WITH HEADER LINE
           WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 0.
    FORM startup
      TABLES   MONITOR STRUCTURE RSMONITOR "user defined monitoring
               MONITOR_RECNO STRUCTURE RSMONITORS " monitoring with record n
               DATA_PACKAGE STRUCTURE DATA_PACKAGE
      USING    RECORD_ALL LIKE SY-TABIX
               SOURCE_SYSTEM LIKE RSUPDSIMULH-LOGSYS
      CHANGING ABORT LIKE SY-SUBRC. "set ABORT <> 0 to cancel update
    $$ begin of routine - insert your code only below this line        -
    fill the internal tables "MONITOR" and/or "MONITOR_RECNO",
    to make monitor entries.
    DATA: ITAB_/BIC/AT07_O00600 TYPE SORTED TABLE OF /BIC/AT07_O00600
          WITH HEADER LINE
          WITH UNIQUE DEFAULT KEY INITIAL SIZE 0,
          DATA_PACKAGE_NEW TYPE STANDARD TABLE OF DATA_PACKAGE_STRUCTURE
          WITH HEADER LINE
          WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 0.
    sort the datapackage based on lead number and lead program definition
    SORT DATA_PACKAGE BY /BIC/TLDNR /BIC/TLDPRGFTE.
    from the resources ODS read all lead values based on the values those
    SELECT * FROM /BIC/AT07_O00600 INTO TABLE
             ITAB_/BIC/AT07_O00600
             FOR ALL ENTRIES IN DATA_PACKAGE
             WHERE /BIC/TLDNR = DATA_PACKAGE-/BIC/TLDNR.
    FIELD-SYMBOLS: <LS_DATA_PACKAGE> TYPE DATA_PACKAGE_STRUCTURE.
    FIELD-SYMBOLS: <LS_/BIC/AT07_O00600> TYPE /BIC/AT07_O00600.
    loop at internal table of ODS to check if there are lead program defin
    from the source which mean the values of lead program definition in OD
    values of lead program definition in datapackage.
       LOOP AT ITAB_/BIC/AT07_O00600 ASSIGNING <LS_/bic/at07_o00600>.
         READ TABLE DATA_PACKAGE
          TRANSPORTING NO FIELDS
          WITH KEY
          /BIC/TLDNR = <LS_/bic/at07_o00600>-/BIC/TLDNR
          /BIC/TLDPRGFTE = <LS_/bic/at07_o00600>-/BIC/TLDPRGFTE
          BINARY SEARCH.
          IF SY-SUBRC <> 0.
    new lines with zero values are inserted because there are no correspon
    DATA_PACKAGE_NEW-/BIC/TLDNR = <LS_/BIC/AT07_O00600>-/BIC/TLDNR.
    DATA_PACKAGE_NEW-/BIC/TLDPRGFTE = <LS_/BIC/AT07_O00600>-/BIC/TLDPRGFTE.
      DATA_PACKAGE_NEW-/BIC/TLDFTE = 0.
      APPEND DATA_PACKAGE_NEW.
         ENDIF.
      ENDLOOP.
    append the new records which are created for the leads in the datapack
      APPEND LINES OF DATA_PACKAGE_NEW TO DATA_PACKAGE.
    reset the sorting of the datapackage back to its original state
      SORT DATA_PACKAGE.
    if abort is not equal zero, the update process will be canceled
      ABORT = 0.
    $$ end of routine - insert your code only before this line         -
    ENDFORM.
    Thanks in advance

    hi,
    it's retrieve data from table /BIC/AT07_O00600
    and add to data package, so your records will be more than from source
    hope this helps.

Maybe you are looking for

  • Error while creating Order - ERROR S:\SAPAPO\RRP3

    Hello all. We have a planning version called "Planej". The goal of this version is for forecasting simulation . A few days ago, starts showing this error: "S:/SAPAPO/RRP:718 40401681 WAS0 Error occurred while creating order" I thinking in inconsisten

  • Billing document posting to FI

    Dear All, For one of the rarely use sale material, one of our end user created sales order without maintaining Account Assignment Group for Material. Then create delivery, Billing & created excise invoice. Thus very obvious that this billing document

  • Problem With loosing connection with wired PC

    I have a model WRT54GS wireless router. My computer is wired into the back of the router. I loose the connection to the internet sometimes and when I check the connection status it says my computer is connected to another Router. Then it asks me if I

  • Aperture novice needs help

    I just installed Aperture on my Macbook Air, and spent quite a bit of time editing, deleting, and re-dating photos.  Now I want to move the entire library, just as it is, to my existing iMac.  How do I do that? Also, after I do that, I'll want to mak

  • Help ,can anybody tell me how to develop a new menu

    Hi friends,     I want to develop a customized menu . I am using NWDS portal to develop it. I need some "howto". Thank you and best regards.  PS: then menu like the pic in the following link. http://lh3.ggpht.com/_EBROeKTXo_k/SVg-qq8I8oI/AAAAAAAAAD0/