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.

Similar Messages

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

  • 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

  • Help on Start Routine at Transfer Rule.

    Hi guys,
    We r extracting data from generic extractor into BW.My target is to fill Attributes of 0Customer(Infoprovider) Infoobject.
    We have added two navigational attributes to it CLASS A and CLASS B.
    Data coming from R/3 has three fields Customer,Class,n field called as ATWRT.
    For each customer there are two records .
    For Ex
    Customer                         Class                          ATWRT
    001                                   A                                 FOOD
    001                                   B                                 Supermarket
    002                                   A                                 Chain
    003                                   B                                  Magnum
    In the target customer is key
    Now the TASK is that in the target the definition for class A which is present in ATWRT should go to navigational attribute ClassA
    n Defination for B should go in NAV Attribute CLASS B . that means there should be single record in the target comprising both value in NAV attribute.
    For Ex
    Customer                Class A                             Class B
    001                         FOOD                                Supermarket
    002                         Chain                                  Magnum
    i want to write program in start routine of transfer rules. If u can suggest any other method also it will good to me to sort this issue. Suggestions are expected.
    Points will be awarded for the write suggestion.
    Pls help me out.

    Dennis,
    Thank you so much for the quick response.
    I think it is working. I only have one concern!!!!.
    I feel like during the testing I found something weird that eventhough there are only 8 records in the psa and four records only have the value ('status') that we need from customer master data-field1, it is still picking the 5th record, not sure why.  I see that once it is written in to the data target then the value is showing it as 'status' and in psa it is different.
    So I wonder if it is converting that field in the routine based on our constant!  Please let me know your input.
    p.s data target does not have the field1 available.  So just like you corrected my code it has to bring it from customer master data and join customer to with the customer-field1 =' status', then pick else delete other records.
    Regards,
    Su

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

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

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

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

  • ABAP HELP in Start routine

    Hello everybody,
    I have written a code to delete some records in start routine, we are using BI 7.0.
    here is the code,
    TYPES: BEGIN OF tys_SC_3,
    TCTUSERNM TYPE /BI0/OITCTUSERNM,
    END  OF tys_SC_3.
    DATA zz_s_SC_3 type sorted table of tys_SC_3 with unique key TCTUSERNM.
    DATA zz_s_SC_4 like line of zz_s_SC_3.
    select TCTUSERNM from /B12/ARIAO0100 into table zz_s_SC_3
    where TCTIOBJNM = '0TCAIPROV' and TCTLOW = '/MRG/RIMAC_01'.
    DELETE SOURCE_PACKAGE where TCTUSERNM NOT IN zz_s_SC_3.
    When I am running this code,I am getting an error
    "E:"ZZ_S_SC_3" does not have the structure of a selection table."
    can anybody out there help me out,
    Thank you,
    Karthik

    Hi,
    you need to define zz_s_SC_3 as:
    data: zz_s_SC_3 type standard table of rsrange.
    do the select as:
    select TCTUSERNM as low from /B12/ARIAO0100 into table zz_s_SC_3
    modify zz_s_sc_3 to set the fields sign and option to 'I' and 'EQ' for all records then it will work.
    Siggi

  • Start Routine or Update Rule Routine

    Hello Dear Friends
    I have a requirement here to create an object lets call it TYPE and i am using another infoobject called movement type.
    My requirement in the cube is that TYPE should indicate A if movment type is 123 or 456 and B if movment type is 789.Anything else  other than these numbers dont need to make it in the cube either for Movement type or for TYPE and needs to be deleted.I believe this will be a routine in the Start Routine.If not please let me know.Also if someone can give me the code on how to write the routine will be really appreciated.
    Thanks again.

    hi,
    Go for an Update routine as you do not have the TYPE in the Data source.
    if ( comm_structure-momenttype = '123' or
       comm_structure-momenttype = '456' ).
      comm_structure-type = 'A'.
    elseif comm_structure-momenttype = '789' .
      comm_structure-type = 'B'.
    endif.
    Adn in the start routine :
    delete data_package where momenttype ne '123' and
                                             momenttype ne '456' and
                                             momenttype ne '789' .
    If you can add the type in the data source then  write the below code.
    delete data_package where momenttype ne '123' and
                                             momenttype ne '456' and
                                             momenttype ne '789' .
    loop at data_package.
    if ( data_package-momenttype = '123' or
       data_package-momenttype = '456' ).
      data_package-type = 'A'.
    elseif data_package-momenttype = '789' .
      data_package-type = 'B'.
    endif.
    modify data_package.
    endloop.
    good luck

  • ABAP help for start routine.

    Hi ,
    We have two Sales ODSs. The first ODS has a key Sales Order, Sales Order item.
    The second, sales order, sales order item, fiscal period. ODS1 feeds ODS2.
    sample data :
    2LIS_11_VAITM
    SO   SOITEM    OCALDAY   AMOUNT    RECORDMODE
    ABC 10             07/03/07     100
    ABC  10            08/05/07     -100             X
    ABC  10            08/05/07      110             Y
    ODS1 (KEY : SALESORDER, SALESORDERITEM)
    SO   SOITEM    OCALDAY   AMOUNT    
    ABC  10            08/05/07      110          
    ODS2 (KEY: SALESORDER, SALESORDERITEM, FISCPER)
    SO   SOITEM    OFISCPER   AMOUNT    
    ABC  10            07/07    100
    ABC  10            08/07     10             
    To achieve this, in the update rules from ODS1 to ODS2, we convert the ocalday into fiscal period and then sum records with record mode X and record more Y , by key sales order, sales order item and fisc per.
    How to write this in ABAP?
    Message was edited by:
            CC

    HI,
    SO SOITEM OCALDAY AMOUNT RECORDMODE
    ABC 10 07/03/07 100
    ABC 10 08/05/07 -100 X
    ABC 10 08/05/07 110 Y
    ODS1 (KEY : SALESORDER, SALESORDERITEM)
    SO SOITEM OCALDAY AMOUNT
    ABC 10 08/05/07 110
    ODS2 (KEY: SALESORDER, SALESORDERITEM, FISCPER)
    SO SOITEM OFISCPER AMOUNT
    ABC 10 <b>07/07</b> 100 fiscal period is not the calender month
    ABC 10 <b>08/07</b> 10
    you can do this..
    data : lv_fiscper(5) type c.
      lv_fiscper = 0calday+4(2).
    if lv_fiscper >= 4.
    lv_fiscper = lv_fiscper - 3.
    else.
    lv_fisper = lv_fiscper + 9.
    endif.
    this will give  you the fiscal month then just do this.
    concatenate lv_fiscper '/' 0calday+2(2) into lv_fiscper..

  • COLLECT statement in start routine of update rules for data coming from R/3

    Hi,
    I have more than one record with the same key combination that comes from R/3. I have a condition wherein I write into an error log. Hence I want only ione entry to be written into a error log and not multiple instances.
    I had written a similar one for ODS.
    Loop at IT_ODS into WA_ODS.
    Collect WA_ODS into IT_SUM.
    How to collect data that is coming in from R/3. Any inputs?

    Hi,
    I think, by using ATEND you can acheive control break logic.
    Regards,
    -Vj

Maybe you are looking for

  • "Playlists no longer exsist" message in iTunes when syncing my iPod Mini

    Whenever I plug my mini into my itunes the error message: "songs cannot be synced because all of the playlists selected for syncing no longer exist". I've tried restoring and reinstalling the software but it doesn't seem to be working. What's going o

  • Version 4 Bug - Multiple Object Editors of Same Object on Single Click

    Hi Jeff, thanks for your reply. You have missed that rule because you don't use SQL Developer for development. But never mind, lets go through it... 1) Of course I have both options activated (all preferences were imported from previous version). The

  • Why does my iMac keep waking every 2 minutes from 2:00 in the morning?

    Hi, I awoke the other night and happened to notice my iMac keeps waking from sleep every 2 minutes from 2:00 in the morning. The screen doesn't come on, I hear the harddrive power up for a little while then stop, 2 minutes later it happens again. I d

  • Oracle BAM Authentication Question

    We are facing a strange problem related to Oracle BAM authentication and I'd like to ask for opinions or suggestions. - We have a BAM Server called MYSERVER - MYSERVER is a Win2003 and BAM was installed using MYSERVER\Administrator account - We have

  • Issues with iPhone 5

    Hello all. I had an iPhone 5 running 7.0.1 if I am not mistaken, and right before I had it replaced it gave me an issue where when I would do a soft restart with holding the power and home button until the Apple logo appeared, it would shut down and