Attribute or routine first in update rule

Hi
In my update rules if i populate a characteristics from master data (Ex: 0MATL_GRP from 0MATERIAL) and write a routine to populate other keyfigure based on the attribute. Will it work when i execute the infopackage.
My requirement is after populating the 0MATL_GRP only, the key figure should be calculated based on the 0MATL_GRP.
Hope i am clear.
Regards
Annie

Hi
Thanks for the replies:
PB: <b>One more way is..just add 0MAT_GRP in the ODS and in the update rules; select the update method as "Master Data Attr. of" - 0MATERIAL (0MAT_GRP is an attribute of 0MATERIAL), so no need to populate in the start routine.</b>
Now if i add 0MAT_GRP in ods and in the update rules; select the update method as "Master Data Attr. of" - 0MATERIAL (0MAT_GRP is an attribute of 0MATERIAL)
And in INCENTIVE keyfigure if i write a routine based on 0MAT_GRP and execute the infopackage, will my requirement be met.
Condition is: After populating the 0MAT_GRP only my kf routine should run.
So will execute infopackage will 0MAT_GRP is an attribute of 0MATERIAL) run <b>first?</b> or routine in kf
Regards
Annie

Similar Messages

  • How to get the PSA name in a Start Routine in the Update Rules of a Cube.

    Hi all.
    I have an InfoSource that loads data directly in an Infocube.
    In the Start Routine of the Update Rules I need to retrieve the PSA table name for that InfoSource, to access it and check some data.
    I can't use the PSA name you seen in the DataFlow because it will change once the update rules are transported to another system.
    Please advice.
    Thanks!!!

    Hi,
    we do it as follows:
    first get the request ID:
    DATA: tp_request(30)   VALUE 'REQUEST'.
    FIELD-SYMBOLS: <wa> TYPE ANY, <tp_req> TYPE ANY, <tp_dtp> TYPE ANY.
    READ TABLE datapak ASSIGNING <wa> INDEX 1.
    IF sy-subrc <> 0. ABORT = 4. ENDIF.
    ASSIGN COMPONENT tp_request  OF STRUCTURE <wa> TO <tp_req>.
    IF sy-subrc <> 0. ABORT = 4. ENDIF.
    requnr = <tp_req>.
    then we get the table with
    SELECT odsname_tech FROM rstsodspart WHERE request = requnr.
    you may need to adjust this code, I've just pasted the relevant parts...
    another way is to get this info from RSTSODS where the different versions are maintained...
    let me know if you need further detail about this stuff...
    hope this helps...
    Olivier.
    Message was edited by:
            Olivier Cora

  • How to calculate the runntime of a routine in an update rule

    I'm facing a performance problem with the loading of an ODS.  After some analysis I'm almost sure that the problem is due two routines (in the update rule) that are looking into master data tables 200.000 times ( quantity of records loaded every day).  But before moving that logic back into the extractor I need to be sure that the runntime will be reduced.  Is there any way to obtain the amount of time spent by those routines?.  I have been checking into the transactions ST03N and STAD but I'm not able to find this information.
    Thank you very much in advance.
    My best regards.
    Pablo Mazzucchi

    Hi,
    For performance problem you can try to get the look data in an internal table at start routine and use them and read for the fields you need which will help you in decreasing the run time vs hitting the database direclty for getting the look up information.
    This will bring you a noticable change in run time of data load.
    Lets wait if some other has routines to get run time of the routine
    Thanks,
    Arun.

  • Filtering records using a start routine inside the update rules for a dmart

    Hi
    I am using a start routine inside the update rules. I want to filter out all records that have 0 in all three fields. My problem is that it not only filters these records, but also filter records with negative values, which I do not want. Only 1 field has a negative value, the other 2 have 0.
    I have tried:
    DELETE DATA_PACKAGE where  /BIC/ZBILLCONS = 0 and /BIC/ZBREVPRIM = 0  and /BIC/ZBREVSUBO = 0 .
      DELETE DATA_PACKAGE where ( /BIC/ZBILLCONS = 0 and /BIC/ZBREVPRIM = 0  and /BIC/ZBREVSUBO = 0 ).
    also tried:
    delete DATA_PACKAGE where /BIC/ZBILLCONS IS INITIAL and
    /BIC/ZBREVPRIM IS INITIAL and  /BIC/ZBREVSUBO IS INITIAL.
    The records are going to 1 cube and 1 ODS, I only have the start routine in 1 update rule. I  view the filtering in the PSA.
    Has anyone ran into this before?

    Try
    delete data_package where /BIC/ZBILLCONS = '0' and /BIC/ZBREVPRIM = '0' and /BIC/ZBREVSUBO = '0' .
    OR
    delete data_package where /BIC/ZBILLCONS EQ '0' and /BIC/ZBREVPRIM EQ '0' and /BIC/ZBREVSUBO EQ '0' .
    Good luck!

  • How can I view the code for a routine in an update rule

    on loading data for 0PLANT_ATTR, I am getting an error for No Local Currency found in Plant 1000 and SAles Org 6000. 
    in looking at the update rules for this, I see that there is a routine for the update of the local currency:
    Perform GET_LOCCURRCY_FOR_PLANT
    USING COMM_STRUCTURE-PLANT
    COMM_STRUCTURE-SALESORG
    CHANGING hlp_monitor
    RESULT
    hlp_subrc.
    How do I see the code behind this?  I want to make sure that I understand everything that needs to be populated in Master Data so that I can ask my functional consultant to update all the necessary fields.
    Thanks
    JP

    Hi Riccardo,
    When I double click on it, I get a message at the bottom that says program reindexed. 
    After looking again, I found that when I double clicked on the comm structure, then the routine, I was able to see it.
    Thanks
    JP

  • ABAP assistance - start routine logic in update rule

    I have used an existing update rule and have based my logic around the same.  The purpose of the rule is to look up customer master data and get a subset of customer numbers from the transaction records so that the values for customer number from the transactional data will not be updated if it does not match with existing master data customer numbers.
    The loads are full and we drop the data before we load.
    I have listed the logic below (the number at the front is to be considered as the line number) and a list of open questions that I have thereafter:
    Start routine logic:
    1  DATA: l_index LIKE sy-tabix.
    2  DATA: BEGIN OF ls_customer,
    3        customer TYPE /BI0/OICUSTOMER,
    4        objver TYPE RSOBJVERS,
    5     END OF ls_customer,
    6      lt_customer LIKE TABLE OF ls_customer.
    7  REFRESH: lt_customer.
    8  LOOP AT DATA_PACKAGE.
    all customers from data package
    9    ls_customer-custno = DATA_PACKAGE-custid.
    10  ls_customer-objver = 'A'
    11    APPEND ls_customer TO lt_customer.
    12   ENDLOOP.
    12  SORT lt_customer.
    13  DELETE ADJACENT DUPLICATES FROM lt_customer.
    14   IF NOT lt_customer[] IS INITIAL.
    15    SELECT /BI0/OICUSTOMER RSOBJVERS
    16      FROM /BI0/PCUSTOMER
    17      INTO CORRESPONDING FIELDS OF TABLE lt_customer
    18      FOR ALL ENTRIES IN lt_customer
    19      WHERE ls_customer-custno = DATA_PACKAGE-custid
    20      AND ls_customer-objver = 'A'
    21    SORT lt_customer BY customer ASCENDING                    
    22  ENDIF.
    Questions
    Line
    1 - what is the purpose of this line? What is it that is being declared
    2 - in some code I have seen this line with OCCURS 0 at the end what does this mean with and without the term?
    4 - I am using the Data Element name is this correct or should I use the field name?
    3 - 5 here I declare an internal structure/table is that correct?
    6 - here I declare a work area based on the internal table is that correct?
    7 - What would happen if I avoided using the REFRESH statement?
    8 - 12 - Is this syntactically correct, I am trying to get a set of data which is the customer numbers which match the master data customers and the master data record is án active version and than appendíng to the work area?
    13 - My understanding is this will reduce the number of records in the work area is this correct and needed?
    14 - 22 I am trying to identify my required set of data but feel I am repeating myself, could someone advise?
    Finally what logic would I actually need to write in the key figure object, could I use something like:
    Result = lt_customer.
    Thanks
    Edited by: Niten Shah on Jun 30, 2008 8:06 PM

    1. This line is not required
    2. OCCURS 0 is the OLD way of defining an internal table with that structure.  As it is, it just defines a flat structure.
    3. Data element is usually best
    3-5 Yes
    6. No.  Here you are declaring a table of the type of the flat structure.  Just as the ABAP says!
    7. Nothing.  But by putting this in, you ensure that you know the state of the table (empty) before you start looping through the data package
    8-12. You can tell if it is syntactically correct by pressing Ctrl-F2 when in the editor.  Looks ok.
    13. Ensures your list of customers contains no duplicated.  The code up to this point is building a list of all the unique customers in the data package.
    14-22. Goes to the database and brings back ONLY those customers which are found in the master data.  Looks ok.
    This is a start routine (that's why you've got a data package).  You don't use result.  You should update the datapackage.  But this you haven't done.  Double click on the table name /BIC/PCUSTOMER to get the correct field names.
    So you have to loop through the data package again, and check if the customer in the datapackage is lt_customer.  If it is, fine, otherwise you blank it and report an error, or set an error message or whatever.
    I wouldn't do it like this.  I'd do something like this:
    STATICS: st_customer TYPE HASHED TABLE OF TYPE /bi0/oicustomer
                                  WITH UNIQUE KEY TABLE_LINE.
    * st_customer retains its value between calls, so only populate if empty
    * In one run of the infopackage, this will mean you do only one read of
    * the master data, so very efficient.
    IF st_customer IS INITIAL.
      SELECT customer FROM /BI0/PCUSTOMER
                              INTO TABLE st_customer
                              WHERE objvers EQ 'A'. " Only active values
    ENDIF.
    * Go through data package
    LOOP AT DATA_PACKAGE.
    * Check whether the customer exists.
      READ TABLE st_customer TRANSPORTING NO FIELDS
                  WITH TABLE KEY table_line = DATA_PACKAGE-custid.
      CHECK sy-subrc IS NOT INITIAL.
    * If you get here, the customer isn't valid.  So I'm just setting it blank
      CLEAR DATA_PACKAGE-custid.
      MODIFY DATA_PACKAGE. " Updates the datapackage record
    ENDLOOP.
    Even this is not fully optimised, but it's not bad.
    I strongly suggest that you get yourself sent on the basic ABAP programming course if you're going to do a lot of this.  Otherwise, read the ABAP documentation in the help.sap.com, and, from the editor, get the cursor on each ABAP keyword and press F1 to read the ABAP help.
    matt

  • Routine /Formula in update rule

    Hello
    I am trying to use formula function in update rule but its giving me error
    scenerio here is
    I tried with routine syntax wise itz correct but not working
    here is the example
    fill theIF 'KNART' eq 'ZP01'. internal table "MONITOR", to make
    result value of the routine
    RESULT = 'KNVAL'.IF 'KNART' eq 'ZP01'.
    ENDIF.
    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.
    trying to update with knval( avleble in commication structure) only if other(KNART is eq zp01) i found sysntaxwise code is correct but its giving me shortdump at teh time of loading
    any input will be great help
    cheers
    Praveen

    Hi
    I tried with this code though its syntax wise correct but again its not working
    IF COMM_STRUCTURE-KNART eq 'ZP01'.
    RESULT = COMM_STRUCTURE-KNVAL.
    ELSE.
    RETURNCODE = 1.
    ENDIF.

  • ABAP routine/lookup in update rule

    Hello Gurus, I am trying to do a lookup from 2 ODS's into one. I am trying to join sales and delivery data.
    My current idea is that I will use the 2LIS_11_V_SSL extractor that has SO, SOitm, DO, DOitm data and bring that into an ODS that has those four items as the key.
    During that update, I will need specific fields (mostly key figures - Net Price from the SalesOrder ODS, and Del. Qty from the DelOrder ODS).
    The SO and DO ODSs each have a key of SO/SOitm and DO/DOitm respectively.
    What I am trying to do is write a routine for each of the necessary fields to do a lookup on the source ODS and bring in the field value according to the SO/SOitm or DO/DOitm key.
    A simplified example
    <u>Target ODS</u> Initially coming from 2LIS_11_V_SSL (keys)
    <b>SO
    SOitm
    DO
    DOitm</b>
    Net Price
    Del. Qty
    <u>SO ODS</u>          
    <b>SO              
    SOitem</b>          
    Net Price       
    <u>Del Order ODS</u>
    <b>DO
    DOitm</b>
    Del Qty.
    I have the 4 key fields coming from another extractor, need to lookup the key figures from the other ODSs on the load
    If I could get some example code on how to do this I would greatly appreciate it! I was told an internal table might do the trick, but after scouring the forums I can't find anything that seems close enough.
    Thanks!
    Justin
    Message was edited by: Justin  Molenaur
    Message was edited by: Justin  Molenaur

    Ajay (or anyone else)...one more question
    Is there a way to limit the number of times that the net price field may be written.
    for example, a SO item may be associated with multiple delivery order items, so you only want to write the net price field once PER sales order item. If we did it just like above, everytime a sales order item had multiple delivery order items, there would be multiple net price values for each delivery order item, which is not correct (see spreadsheet).
    Sales Order     Sales Order item     Delivery Order     Delivery Order item     Net Price (SO)     Del Qty (Del)
    1     10     100     10     15     150
    2     10     101     10     25     200
    <u>2     20     101     20     <b>50</b>     250
    2     20     101     30     <b>50</b>     299</u>
    3     10     102     10     23     213
    4     10     102     20     27     476
    So the challenge would be to create a counter(?) or something that will only allow a SOitm to have only one net price.
    Thanks for you help!
    Justin
    Message was edited by: Justin  Molenaur
    Message was edited by: Justin  Molenaur

  • Routine in update rule

    hi,
    i am writing some logic in the start routine of the update rule to a cube from ODS.inside the logic i am using 3 diff. custom function modules which fetch data from 3 diff. queries and populate data in 3 internal tables. But my problem is when i use these 3 function modules, only the first function module populates the data in the first internal table and the rest 2 are not populating data in internal tables but when executed individually, they are working fine.I have to obtain all the data before looping at data package , so i used these 3 function modules serially outside the loop and trying to fetch data and store in internal tables for further processing.
    But, only one fm is working .
    Any help is appreciated.
    Thanks in advance.

    hi,
      I have no short dumps and the return code of the function module is equal to zero.i am passing correct parameters only .In my custom fm , i am using standard bapis to generate session id's for the fms.
    For the first fm the session id is 0001 and the result is correct and for the second and third fm, the session id is 0002 and 0003 , so the fms are not returning correct result.Inside my custom fm , when i tried to forcefully put 0001 in session id , then the fms are not giving results saying that Session id 0001 unknown.Any help or analysis is really appreciated.
    Thanks in advance.

  • Dependant routines in Update Rules ?

    Hello all
    Is it possible to create a routine in the Update Rules that uses a result of a previous routine in the same set of Update Rules ?
    For example:- I have a routine in the Update Rules for converting sales units from the communication structure to base units of measure. In the same set of Update Rules I then want to use that base UOM to fill a characteristic that evaluates quantity bands. Can this be done? If so how do you ensure that the sales unit to base unit conversion works first?

    see this article too..
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/60cecb1d-0a01-0010-8289-b14fd99062fa
    (the difference being that instead of select on the MD tables,u will loop on the data package and place it into work-area..declare work_area like data_package or like commn structure..
    declare internal table with key fields,and the field for base UoM,also have field for sales unit(but may not be required)..
    cal base UoM in loop and then set..
    ITAB-BASEUOM = calculated-BASEUoM
    iTAB-key field1 = WA_keyfield1.
    APPEND ITAB.
    then in the update routine..
    do READ on ITAB as in the document.
    Vishvesh

  • Transport routine in update rule

    Dear All,
    I have new routine in update rule, after development test is ok,
    I transported to quality environment, but return with error code: 8.
    The new routine and changed update rule are in same request number.
    I think maybe I must separate and transport the routine first,
    before I transport the update rule.
    Now, how transport this routine?
    I also confused to find the routine generated number because there are a lot of routine
    in this update rule.
    I already triggered by update the routine again (to prompt request window),
    transported the request and I have the same result.
    Any help will be appreciated. Thanks.
    Regards,
    Steph.

    Hi ,
    Pls check below threads , may be it helpful to you.
    https://forums.sdn.sap.com/click.jspa?searchID=21044655&messageID=6432928
    https://forums.sdn.sap.com/click.jspa?searchID=21044655&messageID=6427473
    https://forums.sdn.sap.com/click.jspa?searchID=21044655&messageID=6855315
    Thanks & Regards,
    Ramnaresh .P.

  • Help needed on start routines in update rules

    Hi All,
    I want to extract data from two data sources(For ex 2LIS_02_HDR, 2LIS_02_ITM).
    I am using 2 first layer ODS' and one second layer ODS for consolidation.I want to write a start routine in the update rules so that the data of the MATNR(Material Number) field from 2LIS_02_ITM will be populated in the second layer ODS when the keys (EBELN) of the datasources are equal in the first layer ODS'.
    Can anyone send me the code for this requirement?
    Thanks in Advance,
    Sanjana.

    i am assuming u have a direct transformation with 2lis_02_hdr
    and u want to look up on the DSO of 2lis_02_ITM to get the material.
    MATNR = 0material
    EBELN = 0docnum.
    put this code in the start routine of the transformation of 2lis_02_HDR.
    TYPES: BEGIN OF s_itm,
                material TYPE /bi0/oimaterial,
                docnum TYPE /bi0/oidocnum,
                END OF s_itm.
        DATA: wa_itm TYPE s_itm,
              t_itm TYPE STANDARD TABLE OF s_itm.
    LOOP AT DATA_PACKAGE.
            SELECT material
                          docnum
            FROM /bic/aDSO_itm
       APPENDING TABLE t_itm
       WHERE docnum = <comm_structure>-docnum.
    endloop.
    IF NOT t_itm[] IS INITIAL.
          SORT t_itm ASCENDING BY docnum.
         DELETE ADJACENT DUPLICATES FROM t_itm      COMPARING docnum.
         ENDIF.
    Now write this below code in the update routine of 0material in the transformation from 2lis_2_HDR.
    CLEAR RESULT.
    READ TABLE T_itm INTO WA_Itm WITH KEY
          DOCNUM  = comm_structure-docnum.
    BINARY SEARCH.
    IF SY-SUBRC = 0.
      RESULT = WA_itm-material.
    ENDIF.

  • Start Routine in Update Rule

    I want to replace all '# ' values showing up in a report with  space. For this I plan to write a Start Routine in the Update Rules which should scan all the data coming in into the cube and replace all  null or '' with space.
    What is the best way to write this routine. It should check all data in all the fields of the data load coming in.
    Thanks

    Hi,
         The space is shown as # in the BW Reports, to confirm check the value in the cube for this field, so
          you need to change that to some other character like X or Y or explain your end users that SAP
          designates a space as # and it will be displayed that way in the reports.
    Regards,
    Raj

  • How to debug start routines of update rules from ODS to InfoCube

    Dear gurus,
      I have an update rule from ODS to InfoCube. I wrote a start routine in the update rule. Now I want to debug it. I went to monitor and simulate update the data package and only got the prompt "No data exists in the corresponding PSA table". So how can I debug this start routine?
      Thanks in advance.
    Jin Ming

    Jin,
    In order to use PSA between ODS and InfoCube, you may have to use an exclusive InfoPackage and load separately. In that InfoPackage, choose the radio button to use a PSA.
    I think you are currently updating the InfoCube directly without using a separate InfoPackage.
    Look for an InfoSource under DataMarts (search for 8<ODS Technical name>) and create your InfoPackage there.
    Good luck.

  • Convert ABAP code in start routine/update rule to transform. start routine

    Dear BW ABAPers,
    I have created a custom purchasing info cube (YCP_PURC1) based on 0CP_PURC1 standard cube. I would like to convert this new data flow to BI7 (from 3.x), and convert the standard update rule to transformation. I would need to rewrite the below start routine from the standard update rule to a start routine ABAP code in the newly created  transformation / start routine. My ABAP knowledge is limited. Will you please help?
    *this is the start routine from the update rule. As a side note, the data source is 2LIS_02_SCL.
    LOOP AT SOURCE_PACKAGE.
        IF (     SOURCE_PACKAGE-cppvlc  EQ 0
             AND SOURCE_PACKAGE-cppvoc  EQ 0
             AND SOURCE_PACKAGE-cpquaou EQ 0 ).
          DELETE SOURCE_PACKAGE.
          CONTINUE.
        ENDIF.
    no_scl is initial ( e.g. for good receipts, billing)
    value has to be set depending on storno
        IF SOURCE_PACKAGE-no_scl IS INITIAL.
          IF SOURCE_PACKAGE-storno = 'X'.
            SOURCE_PACKAGE-no_scl = -1.
          ELSE.
            SOURCE_PACKAGE-no_scl = 1.
          ENDIF.
          MODIFY SOURCE_PACKAGE.
        ENDIF.
      ENDLOOP.
    if abort is not equal zero, the update process will be canceled
      ABORT = 0.
    Many thanks and look forward to your kind feedback.
    Kind regards,
    Csaba

    Dear All, Durgesh,
    thanks to you all for your valuable input. Mainly the ABAP part was more interesting for me.
    Durgesh, thanks for your input, it was useful. I just had to change the info objects to data source fields and add the lines before the loop:
    DATA: I_PACKAGE TYPE TYT_SC_1.
        FIELD-SYMBOLS <i_package> TYPE tys_sc_1.
        I_PACKAGE[] = SOURCE_PACKAGE[].
        LOOP AT SOURCE_PACKAGE assigning <i_package>.
          IF ( <i_package>-BWGEO EQ 0
          AND <i_package>-BWGEOO EQ 0
          AND <i_package>-BWMNG EQ 0 ).
            DELETE SOURCE_PACKAGE index sy-tabix.
            CONTINUE.
          ENDIF.
    no_scl is initial ( e.g. for good receipts, billing)
    value has to be set depending on storno
          IF <i_package>-NOSCL IS INITIAL.
            IF <i_package>-ROCANCEL = 'X'.
              <i_package>-NOSCL = -1.
            ELSE.
              <i_package>-NOSCL = 1.
            ENDIF.
          ENDIF.
        ENDLOOP.
    Points have been assigned accordingly.
    Thanks,
    Csaba

Maybe you are looking for