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.

Similar Messages

  • 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

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

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

  • 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

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

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

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

  • 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

  • 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

  • Routine in Update rule (Urgent)

    Hi
    My issue is a bit typical.
    We enhanced 0MATERIAL_ATTR datasource to get one field from ZTABLE1 from R/3 called "Product type" and this is working fine and populated to 0MATERIAL.
    In R/3, Our clients are giving the incentives to the customers based on their bill value. Incentives are maintained in ZTABLE2 master data in R/3.
    There are three types of incentives 1. special 2. period 3. policy.
    Incentives should be calculated based on the "product type"
    I maintained ZTABLE2 (incentive) in BW ODS.
    When i pull the 2LIS_13_VDITM, incentive value should be calculated from the ODS based on the product type in 0MATERIAL.
    How can i do it?
    One more thing.
    Product type is NAV Attr to 0MATERIAL.
    Now in Update rule if i put product type and populate as"Master data attribute"
    and add a keyfigure called ZINCENTVAL and write a routine , Will it work?
    Regards
    Annie
    Please get back to me if you dont understand the question?

    First define the two tables you use:
    DATA: g_workarea LIKE /BIC/AZTABLE2,
          l_/BIC/AZTABLE2_itab TYPE HASHED TABLE OF /BIC/AZTABLE2
    WITH
          UNIQUE KEY [enter your unique key here],
          g_key1_save LIKE /BIC/AZTABLE2-key1,
          g_key2_save LIKE /BIC/AZTABLE2-key2,
          l_days_open type i,
          l_index like sy-tabix.
    DATA: g_workarea2 LIKE /BI0/pmaterial,
          l_/BI0/pmaterial_itab TYPE HASHED TABLE OF /BI0/pmaterial
    WITH
          UNIQUE KEY material,
          g_material_save LIKE /BI0/pmaterial-material,
          l_days2_open type i,
          l_index2 like sy-tabix.
    Then define the checks you want to make:
    FORM check_producttype USING    l_producttype
                        CHANGING g_workarea2 LIKE /BI0/pmaterial.
      IF l_material NE g_material_save.
        CLEAR g_workarea2.
        SELECT SINGLE * FROM /BI0/pmaterial INTO CORRESPONDING FIELDS OF
    g_workarea2 WHERE
                        material = l_material AND
                        objvers = 'A'.
        g_material_save = l_material.
      ENDIF.
    ENDFORM.
    FORM check_incentive USING    l_key1 l_key2
                        CHANGING g_workarea LIKE /BIC/AZTABLE2.
      IF l_key1 NE g_key1_save OR
          l_key2 NE g_key2_save.
        CLEAR g_workarea.
        SELECT SINGLE * FROM /BIC/AZTABLE2 INTO CORRESPONDING FIELDS OF
    g_workarea WHERE
                        key1 = l_key1 AND
                        key2 = l_key2
        g_key1_save = l_key1.
      g_key2_save = l_key2.
      ENDIF.
    ENDFORM.
    Finally, execute your whole thing:
    PERFORM check_producttype USING  COMM_STRUCTURE-material
                             CHANGING g_workarea2.
    PERFORM check_incentive USING  COMM_STRUCTURE-key1
                             CHANGING g_workarea.
    IF g_workarea2-producttype EQ ...
    ELSE.
    ENDIF.
    and so on...
    RESULT =...
    Hope this helps.

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

  • Process: Start Routine, Delta, Update Rules

    Hi SDN,
    Can someone point to detailed discussion on the events related to loading, such as:
    Start Routine is exectued before each data package, or entire load?
    Update rules are applied row by row or the entire KYF column in a data package is processed first?
    When is delta determined, before Start Routine is executed, or, after it is executed, and before update rules are applied? This is important to know if we are dropping records from the data package.
    If you have the answers, would love to hear and appreciate.
    Thanks.
    Saf.
    P.S. I always award points.

    Thanks Farhan,
    If you don't mind, can you outline how delta is determined, between ODS and ODS and ODS and Infocube. If I am correct, records in the sender object are marked as sent. Can I look at the field where the flag is?
    Also, you are saying that only those records make up the data package which are new, in case of a delta load. That means, if there were no new records, Start Routine would not even execute, or it still will but do not have any records processed?
    I already awarded the points.
    Thanks.
    Saf.

Maybe you are looking for