Routine for Update rule in cube

Hi Friends,
       I have added a field to a cube, now i need to populate the same during the data is loading from the DSO to Cube.  Inupdate rule since we will get only te key figures, is it possible to access the dimensions in the routine. Please help me in giving some coadings for the routine for update rule.
Thanks
Prem

Hi,
one more suggestion..
create a end routine and update the key figures based on ur dimension values by useing resuly_package.
sample code:
[Transformation end routine|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/203eb778-461d-2c10-60b3-8a94ee91cbfc]
thnks.

Similar Messages

  • Start routine for  Update Rules

    I need to write a start routine for the update rules for an DSO with main idea as follows:
    I must compare the record that comes from the infopackage with the record that's already in my DSO. If the X date for the same 0PM_ORDER is the same as one in my DSO - do nothing
    If the X date is previous to the X date in my DSO for the same 0PM_ORDER - the new record must be created and at the same time all the records with subsequent(later) X dates for this 0PM_ORDER must be deleted.
    If the X date is later than the X date in my DSO for the same 0PM_ORDER - the new record must be created.

    Hi,
    Find the below code.
    DATA: BEGIN OF ITAB1,
    ZDATE TYPE /BIC/DATE
    END OF ITAB1.
    SELECT zdate FROM /BI0/QEMPLOYEE INTO corresponding
    fields
    of ITAB1 where employee = SOURCE_FIELDS-EMPLOYEE.
    IF ITAB1-ZDATE COMMUNICATE_STRUCT-DATE
    RESULT = ITAB1-CLM_IPAA.
    ENDIF.
    ENDSELECT.
    There will be an table for each DSO if you go for an manage DSO you will get three table i.e New,Active and Change Log take Active tables date field and compare with the communication structure that comes to routine.
    The above example is just an example table will be different from DSO to DSO.
    Let me know your thoghts.
    Regards,
    Shivu.

  • Start routine and update rules

    Hi,
    What is accessed first:-
    Start Routines or Update Rules?
    What is the use of global variables in start routine?
    Please reply.
    Thanks.

    Hi......
    You have different types of Routines in BW .
    1) Start Routine in Transfer Rules
    2) Transfer Routine in Transfer Rules.
    3)Start Routine in Update Rules
    4)Update Routine in Update Rules.
    The routines that you write in transfer rules are applicable to all the Data targets that get the data from that particular Infosource, when you are going to write some code in Transfer rules, you have to understand that you are going to manupilate the data that is going to get into BW .
    If you are going to write in Update Rules , then that logic is going to apply only for that particular Data target .
    Eg : Let suppose I have a Flat file that gets data from 3 countries, US, Canada and Mexico.
    Now I have prepared the data source for the same . But I dont want to have the data of Mexico in to BW itself.
    So I will write a Start routine at TR to eliminate the data of Mexico.
    My Next step is I want the data of US into one ODS and Canada data in to another ODS.
    For this I handle the dataflow at Start routine in Update rules, to eliminate Canada data for US ODS and Vice Versa.
    Global variables in Start routine
    You can have global variables, internal tables populated by the
    startup routine. This data will be available to the field
    routines. Create yourself a start routine, declare some
    variables in the global section, and then create a field
    routine. You will be able to use the globally declared objects
    in the field routine
    Please check below help link for routines in sap netweaver 2004s
    http://help.sap.com/saphelp_sem60/helpdata/en/e3/732c42be6fde2ce10000000a1550b0/frameset.htm
    How to guide "How to transformations routines".Please check the below link:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/dc1d9990-0201-0010-16aa-db3c4eb8b642
    start routine in transfer rules
    Look up to load master data
    excluding
    Start Routine in Transfer Rules
    Sample code in Update Rule to restrict data selection?
    Append Datapak - transfer start routine
    Excluding Blank field in Infopackage Filter
    Trans Routine ABAP help ..
    transfer routine
    Date key figure: Convert DATS format to DEC format
    Date Conversion in Flat File
    Transfer Routine ABAP
    conversion exit
    Date Conversion
    Problem with  conversion char to numc in transference rules
    conversion routine..?
    update routine
    How to call a function in Update Rules to reverse a key figure sign
    Need Sample Code for Update Rules
    Date calculation
    Difference between data in PSA and Data in Infocube
    No RETURNCODE <> 0 allowed in update routines in transfer mode
    the diffrerece between DEC and (yyyymmdd) 8 char in Time defination
    Access master data in update rules
    Date key figure: Convert DATS format to DEC format
    start routine in update rules
    Is it possible to read a third ODS in update rules between two ODS?
    update rule coding while loading data from ODS to CUBE
    Start Routine in Update Rules to populate additional fields from ODS
    Coding in Update Rules accessing a Z-Table
    Start routine
    Hope this helps you..........
    Regards,
    Debjani.........
    Edited by: Debjani  Mukherjee on Oct 1, 2008 4:58 PM

  • Key figure routine in update rules

    I have a Cube (X) that gets data from a ODS (A) but one of the key figures gets the data from another ODS (B) with a routine in update rules and I want to change it to ODS (C)
    A (All objects except one) - X (All objects except one)
    B (0DEB_CRE_LC) - X (0DEB_CRE_LC)
    select sum( DEB_CRE_LC )
             into RESULT
             from /BIC/AZDOC_SUB00
             where OI_EBELN EQ COMM_STRUCTURE-OI_EBELN
              and OI_EBELP EQ COMM_STRUCTURE-OI_EBELP
              and /BIC/ZCLASC_ID EQ COMM_STRUCTURE-/BIC/ZCLASC_ID
              and PSTNG_DATE LE l_datafim
              and PSTNG_DATE GE l_datainicio
              and /BIC/ZTPOPER = '9'.
    My problem is that my ODS (C) doesn't have 0DEB_CRE_LC and the values are divided in 2 key figures (D) & (E), I want to sum both key figures into 0DEB_CRE_LC of the cube.
    I tried a tip from a friend but didn't work, I'm lost (newbie), and apreciated some tips, it doesn't seem to sum anything
    data: result1 type /BIC/AZPUR_S0100-/BIC/ZSLIQ_VAL,
          result2 type /BIC/AZPUR_S0100-/BIC/ZSIVA_VAL.
    select sum( /BIC/ZSLIQ_VAL ) sum( /BIC/ZSIVA_VAL )
             into (RESULT1, RESULT2)
              from /BIC/AZPUR_S0100
               where OI_EBELN EQ COMM_STRUCTURE-OI_EBELN
                and OI_EBELP EQ COMM_STRUCTURE-OI_EBELP
                and /BIC/ZCLASC_ID EQ COMM_STRUCTURE-/BIC/ZCLASC_ID
                and PSTNG_DATE LE l_datafim
                and PSTNG_DATE GE l_datainicio.
      write result1.
      write result2.
    Many thankx

    data: result1 type /BIC/AZPUR_S0100-/BIC/ZSLIQ_VAL,
    result2 type /BIC/AZPUR_S0100-/BIC/ZSIVA_VAL.
    select sum( /BIC/ZSLIQ_VAL ) sum( /BIC/ZSIVA_VAL )
    into (RESULT1, RESULT2)
    from /BIC/AZPUR_S0100
    where OI_EBELN EQ COMM_STRUCTURE-OI_EBELN
    and OI_EBELP EQ COMM_STRUCTURE-OI_EBELP
    and /BIC/ZCLASC_ID EQ COMM_STRUCTURE-/BIC/ZCLASC_ID
    and PSTNG_DATE LE l_datafim
    and PSTNG_DATE GE l_datainicio.
    write result1.
    write result2.
    <u>RESULT = result1 + result2</u>
    I still have to test it, first i was getting syntax errors because I didn't put spaces right sorry

  • Deleting  rows with missing values in field in start routine of update rule

    Hello experts,
    how can I delet rows with missing values in a specific field in the start routine of update rules?
    I think ABAP code should look something like this:
    delete ...  from DATA_PACKAGE where Z_NO = ''.
    thanks in advance for any suggestions!
    hiza

    Write:
    delete data_package where field = value.
    Hope it helps.
    Regards

  • 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 a Globla Routine for Transfer Rules

    Hi Experts,
    How to write a Global Routine for Tranfer Rules ? Where all the infoobjects need to be grouped? Effect need to be shown on group of fields that are available in a single structure.
    Thanks in Advance
    Vara

    Hi,
    Are you aware of Start Routine available?.. This helps to write a routine on all the infoObjects available in Transfer Structure
    http://help.sap.com/saphelp_nw04/helpdata/en/b3/0ef3e8396111d5b2e80050da4c74dc/frameset.htm
    regards
    Happy Tony

  • 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.

  • 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

  • ABAP Help at start routine of Update rule

    Good After Noon All,
    My requirement is that cube ZAPO_C24M  there’s an UPDR flowing from 8ZAPO_C24M back to itself so to speak.The request is to change the data in the cube from Fiscal Year Variant Z3 to Z4.
    But in start routine  i have to  take the existing record and reverse all of the key figures, and also change the RECORDMODE of the record to indicate it is a reversal record. This for specific Country KR and for these country the Fiscal variant is Z3. Again in the start routine, create a new record identical to the existing record that has Fiscal Year Variant Z4 instead of Z3.
    So the idea is we’d load from the cube and send back to the cube one record that reverses out the existing data, and another record that contains the same data but with Fiscal Variant Z4 instead of Z3.
    Please Help me.
    Points will be awarded for the right answer

    Hi Vaishali,
    In the start routine copy the DATA_PACKAGE to a local table.
    Select the records where the specific country is KR.
    Delete all other records.
    Then read the records in loop, Keep one record same and just change the fiscal year variant.
    And for the same multiply all the key figures by -1.
    Transfer the content of the local table back to DATA_PACKAGE.
    maintain one to one mapping in the update rule.
    I am sure it will update, but you need to be sure that if you change Fiscal year variant then probably your fiscal period value should change. In that case you have to update it accordingly in the start routine.
    Regards.

  • 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.

  • Start routine at update rules.

    Hi all,
    I am working with Sales schedule line data.
    Data flow is R/3 -
    DSO----CUbe.
    I have to load all the data for all sales organizations till DSO.
    From DSO to CUbe I have to load the data only for 4 sales organizations.
    I am planning to write Start routine in the update rules.
    Could any body Please help me with code..
    REgards,
    MAdhu

    Place this code in your start routine:
    *remove sales organization, assume this is a standard infoobject
    this deletes all data except for the 4 sales orgs
    DELETE DATA_PACKAGE WHERE NOT ( /BI0/0SALES_ORG = 1 OR
                                                                   /BI0/0SALES_ORG = 2 OR
                                                                   /BI0/SALES_ORG = 3 OR
                                                                   /BI0/SALES_ORG = 4 ) .
    Also put restrictions in your infopackage, even though its redundant.

  • Access to unmapped field of ODS in the update rule of CUBE

    Hi Gurus,
    I have 8 fields in ODS out of which only 5 are mapped to the characteristics in the CUBE. I have to write a start routine in the update rules of the cube. But, I need to access one field, which is in ODS but not mapped to characteristic in the cube.
    So, is it possible to use that field in the logic of start routine. Or do I have to create a new characteristic in the CUBE for that 6th field also.
    Thanks,
    Regards,
    aarthi
    [email protected]

    Hi
    You certaily should insert your infobject field in the cube to populate it. After This you can choose if populate it by direct mapping or by routine.(start routine or transfer routine)
    A classic example of start routine to populate infobject from master data
    tables : /bi0/pcostcenter.
    data : lt_data_package like DATA_PACKAGE occurs 0 with header line,
    lt_costcenter like /bi0/pcostcenter occurs 0 with header line.
    select * from /bi0/pcostcenter into table lt_costcenter.
    lt_data_package[] = DATA_PACKAGE[].
    loop at lt_data_package.
    read table lt_costcenter with key costcenter = comm_structure-costcenter.
    if sy-subrc = 0.
    lt_data_package-/bic/zpcaccgh = lt_costcenter-/bic/zpcaccgh.
    modify lt_data_package.
    endif.
    endloop.
    DATA_PACKAGE[] = lt_data_package[].

  • 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.

  • Unit calculation at routine in update rule

    Hello,
    Can anybody explain me how to calculate unit in update rule routine.
    In update rule routine how to access infocube keyfigure like we access communication structure as comm_structure.
    Is there any sample code?
    Please help me out.
    Thanks,
    Regards,
    Steve

    Hi,
    You can find out the no of routines with standard Update rules.
    one of them is :
    <i>for 'Net weight in kilograms' 2LIS_13_VDITM-->0SD_C03</i>
    IF COMM_STRUCTURE-UNIT_OF_WT NE 'KG'.
        WEIGHT = COMM_STRUCTURE-GRS_WGT_DL.
        CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'
             EXPORTING
                  INPUT                = COMM_STRUCTURE-GRS_WGT_DL
                  UNIT_IN              = COMM_STRUCTURE-UNIT_OF_WT
                  UNIT_OUT             = 'KG'
             IMPORTING
                  OUTPUT               = WEIGHT
             EXCEPTIONS
                  CONVERSION_NOT_FOUND = 1
                  DIVISION_BY_ZERO     = 2
                  INPUT_INVALID        = 3
                  OUTPUT_INVALID       = 4
                  OVERFLOW             = 5
                  TYPE_INVALID         = 6
                  UNITS_MISSING        = 7
                  UNIT_IN_NOT_FOUND    = 8
                  UNIT_OUT_NOT_FOUND   = 9
                  OTHERS               = 10.
        IF SY-SUBRC NE 0.
          CLEAR MONITOR.
          MONITOR-msgno = '009'.
          MONITOR-msgid = 'SDBW'.
          MONITOR-msgty = c_msgty_e.
          MONITOR-msgv1 = COMM_STRUCTURE-UNIT_OF_WT.
          append MONITOR.
          RETURNCODE = 4.
          WEIGHT = 0.
        ELSE.
          RESULT = WEIGHT.
          RETURNCODE = 0.
        ENDIF.
      ELSE.
        RESULT = COMM_STRUCTURE-GRS_WGT_DL.
        RETURNCODE = 0.
      ENDIF.
    With rgds,
    Anil Kumar Sharma .P

Maybe you are looking for