ABAP Start Routine

Hello,
I am writing a Start Routine in my update rules from an ODS into another ODS.  My start routine is basically just restricting some data from being updated into my data target.  I am restricting based on 0VYPTE = 20.  That is, if a records has 0VTYPE = 20 I am deleting it from the data_package.  If I debug through the program, it works correctly with one record but when I throw in about 120K records it doesn't work. Can someone please have a look and tell me what is wrong here?
LOOP AT DATA_PACKAGE.
     <b>IF DATA_PACKAGE-VTYPE NE 10.</b>
       DELETE DATA_PACKAGE.
         CONTINUE.
     ELSE.
       IF DATA_PACKAGE-/BIC/CASES NE 'CS'.
             PERFORM load_mrscube_tables USING DATA_PACKAGE-SOURSYSTEM.
             PERFORM BASEUNIT_CONVERT tables
                                          MONITOR
                                 using    DATA_PACKAGE-MATERIAL
                                          DATA_PACKAGE-SOURSYSTEM
                                          DATA_PACKAGE-/BIC/CASES
                                          'CS'
                                          DATA_PACKAGE-/BIC/CASES_REV
                                 changing
                                          quant_out.
                 EXIT.
             EXIT.
     modify DATA_PACKAGE.
       ENDIF.
     ENDIF.
ENDLOOP.

Hi Nyrvole,
   Try to change the code this way and check(debug).
DELETE DATA_PACKAGE WHERE VTYPE NE 10.
LOOP AT DATA_PACKAGE.
IF DATA_PACKAGE-/BIC/CASES NE 'CS'.
PERFORM load_mrscube_tables USING DATA_PACKAGE-SOURSYSTEM.
PERFORM BASEUNIT_CONVERT tables
MONITOR
using DATA_PACKAGE-MATERIAL
DATA_PACKAGE-SOURSYSTEM
DATA_PACKAGE-/BIC/CASES
'CS'
DATA_PACKAGE-/BIC/CASES_REV
changing
quant_out.
EXIT. -- WHY THIS EXIT FOR...??
EXIT. -- WHY THIS EXIT FOR...??
modify DATA_PACKAGE. -- ARE YOU CHANGING ANY RECORDS..??
ENDIF.
ENDLOOP.
Put break-point after end loop and dugug and see the no of records.
Hope it Helps
Srini

Similar Messages

  • BW-ABAP start routine code logic

    Hello friends,
    I am writing start rotine code between ODS and InfoCube.I need your help determining the right logic.
    Requirement is as follows.
    1. Create one database table to store GL account ranges.
    2. This table will have multiple ranges of GL account.
    3. Write a code such a way that only GL acc. range in this table is included and  
        all the other records containing GL acc. outside this range should be deleted.
    Here is the logic which I have developed.
    Please help me with your suggestion.
    Message was edited by:
            John Anderson

    Hi John,
       I did not check the syntax of this program and I am very bad at remembering the syntax. Let me know if you face any problem with the code I am supplying.
    Code removed ....
    Best Regards,
    Kazmi
    Message was edited by:
            Kazmi

  • Append Duplicate entries in Start Routine through ABAP code

    Hi Experts,
    I need to write an ABAP code in the start routine for the following conditions.
    For every record in fiscal period (FISCPER) which has non u2013quarter months eg if Jan/Feb ie (001.2007 or 002.2007) I need to create an additional duplicate record which keeps all the other values same but negates the key figures and replaces the month by a quarter ending month
    Eg: if my records are
    FISCPER   COMP_CODE    GLACCT       BALANCE
    001.2007     1000                     6789090       70
    002.2007      1000                    6789090       80
    I need to create/append duplicate entries by negating the Balance value and replacing the Fiscper with 003.2007
    FISCPER COMP_CODE   GLACCT   BALANCE
    003.2007    1000                6789090    -70
    003.2007    1000                6789090    - 80
    Hence the entire structure should now look like:
    001.2007       1000        6789090         70
    002.2007       1000        6789090         80
    003.2007       1000        6789090        -70
    003.2007       1000        6789090       - 80
    Similarly, I need to append duplicate entries for all non quarter ending months and replacing the Fiscper with the quarter ending month and also negate the Key figure value.
    Hence, similarly,
    001.2007        1000            6789090             70
    002.2007        1000            6789090             80
    003.2007        1000            6789090             -70
    003.2007        1000            6789090            - 80
    004.2007        1000            6789090              30
    005.2007        1000            6789090              90
    006.2007        1000            6789090             -30
    006.2007        1000            6789090             -90
    I am very new to ABAP, can someone please provide the ABAP start routine code for this..
    Regards,
    Dipali

    Hi,
        Check the below code. Paste it in yr Start Routine.
    '*'Begin of code
    DATA : wa_Data_Package LIKE Data_Package.
    DATA : t_Data_Package LIKE Data_Package.
    DATA : wa_temp LIKE Data_Package-BALANCE.
    Loop at Data_Package into wa_Data_Package.
    IF ( wa_Data_Package-FISCPER EQ 001/2007 ) or
         ( wa_Data_Package-FISCPER EQ 002/2007 ).
      wa_temp = wa_Data_Package-BALANCE.
      t_Data_Package-FISCPER = 003/2007.
      t_Data_Package-BALANCE = -wa_temp.
      Clear : wa_temp.
    ELSEIF ( wa_Data_Package-FISCPER EQ 004/2007 ) or
                 ( wa_Data_Package-FISCPER EQ 005/2007 ).
      wa_temp = wa_Data_Package-BALANCE.
      t_Data_Package-FISCPER = 006/2007.
      t_Data_Package-BALANCE = -wa_temp.
      Clear : wa_temp.
    ELSEIF ( wa_Data_Package-FISCPER EQ 007/2007 ) or
                 ( wa_Data_Package-FISCPER EQ 008/2007 ).
      wa_temp = wa_Data_Package-BALANCE.
      t_Data_Package-FISCPER = 009/2007.
      t_Data_Package-BALANCE = -wa_temp.
      Clear : wa_temp.
    ELSEIF ( wa_Data_Package-FISCPER EQ 010/2007 ) or
                 ( wa_Data_Package-FISCPER EQ 011/2007 ).
      wa_temp = wa_Data_Package-BALANCE.
      t_Data_Package-FISCPER = 012/2007.
      t_Data_Package-BALANCE = -wa_temp.
      Clear : wa_temp.
    ENDIF.
    APPEND t_Data_Package to Data_Package
    Endloop.
    '*'End of code
    Regards,
    Balaji V

  • ABAP code for BI 7.0 transformations start routine

    Hi all,
    I am trying to update data from DSO1 (Source1: transaction data) to Infocube(TARGET)
    In the transformations Start routine, I have to read DSO2(Source2: Master data) for some fields.
    DSO1 has CUSTOMER as part of key
    DSO2 has CUSTOMER (key) and other fields....FIELD1, FILED2, FIELD3
    Infocube to be updated with FIELDS1,2 & 3 WHILE READING DSO2.
    WHERE DSO1 CUSTOMER matches with DSO2 CUSTOMER.
    Also, data NOT TO BE UPLOADED into Infocube if FIELD1 in DSO2= NULL
    Please give me the abap code for the above logic.
    Appreciate any help in this regard.
    Thanks.

    This is a doc from this site:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/6090a621-c170-2910-c1ab-d9203321ee19
    Ravi Thothadri

  • Start Routine (ABAP) in Transformations

    Hi Experts,
    As i am new to BW please update me with the required ABAP Code or atlease with the skeleton  Code
    Source & target fields
    Emp_ID       ZEMP_ID  (CHAR)
    Start Date:  ZESTA_DT (DATS)
    End Date  :  ZEEND_DT (DATS)
    My requirment is to write a start routine that split the record in to 2
    Emp_ID-Start_Date-Termination Date
    0001----01/01/2005---01/01/2008
    0002----01/01/2007---
    (Termination date will be blank if emp is still working)
    As per my requirment i would like to see data in DSO as
    Emp_ID-Start_Date-Termination Date
    0001----01/01/2005---
    0001----01/01/2005---01/01/2008
    0002----01/01/2007---
    I want to split the records of an employee
    Please let me know if u need any information
    Thanks

    Hi bw learner,
    In Update rules, at any keyfigure, you write a routine with return table check box selected.
    Write the below code.
    first of all you need to declare a internal table of type data target
    (Example: DATA: ITAB LIKE /BIC/FZ_CUBE). here i consider Z_CUBE as data target.
    then loop the DATA_PACKAGE.
    loop at DATA_PACKAGE.
    transfer corresponding values from DATA_PACKAGE to itab.
    then assign itab-Termination Date = ZEEND_DT.
    append ITAB to RESULT_TABLE.=
    endloop.
    By this, whatever the records that are present in the RESULT_TABLE will be added into the Data target.
    I hope you can handle now.
    Regards,
    S P.

  • 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

  • ABAP Code Problem in Start Routine to Fill the value from Look-up Table ???

    Hi all,
         I am trying to fill the values of DOC_NUMBER & PLANT from look-up table /BIC/AZSD_O0700 (Billing Item ODS) for each BILL_NUM in Start Routine for Update Rules of Billing Header ODS and modify the data_package.
    What is wrong with the below ABAP code, PLEASE ???
    data: it_data type standard table of data_package_structure
            with header line
            with non-unique default key initial size 0.
    types: begin of billing_item_type,
                 BILL_NUM          like /BIC/AZSD_O0700-BILL_NUM,
                 DOC_NUMBER   like /BIC/AZSD_O0700-DOC_NUMBER,
                 PLANT               like /BIC/AZSD_O0700-PLANT,
             end of billing_item_type.
    refresh it_data.
    clear it_data.
    it_data[] = DATA_PACKAGE[].
    refresh DATA_PACKAGE.
    clear DATA_PACKAGE.
    loop at it_data.
        select DOC_NUMBER PLANT into (it_data-DOC_NUMBER, it_data-PLANT)
               from /BIC/AZSD_O0700
               where  BILL_NUM  = it_data-BILL_NUM
               and    FISCVARNT = it_data-fiscvarnt.
        endselect.
        if sy-subrc = 0.
           move-corresponding it_data to DATA_PACKAGE.
        endif.
      endloop.
      modify DATA_PACKAGE.
    Thanks,
    Venkat.

    Hi Venkat,
      Two things -One is the performance and the other ... there is no Append  within the loop.
      Try moving the select statement ousdie the loop to improve performance and move the modify statement into the loop ... change modify to append. Code below.
       Let me know if you need more help.
    Best regards,
    Kazmi
    data: it_data type standard table of data_package_structure
    with header line
    with non-unique default key initial size 0.
    types: begin of billing_item_type,
    BILL_NUM like /BIC/AZSD_O0700-BILL_NUM,
    DOC_NUMBER like /BIC/AZSD_O0700-DOC_NUMBER,
    PLANT like /BIC/AZSD_O0700-PLANT,
    end of billing_item_type.
    refresh it_data.
    clear it_data.
    it_data] = DATA_PACKAGE[.
    refresh DATA_PACKAGE.
    clear DATA_PACKAGE.
    loop at it_data.
    select DOC_NUMBER PLANT into (it_data-DOC_NUMBER, it_data-PLANT)
    from /BIC/AZSD_O0700
    where BILL_NUM = it_data-BILL_NUM
    and FISCVARNT = it_data-fiscvarnt.
    endselect.
    if sy-subrc = 0.
    move-corresponding it_data to DATA_PACKAGE.
    Append DATA_PACKAGE.
    endif.
    endloop.

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

  • ABAP code in start routine (delete no in)

    In my start routine, I would like to delete some data package whose employee id is not in the selection list.
    but there are some ABAP grammer error in the where condition. Can somebody help this? I tried to read the document for 'WHERE - IN seltab', but still I could not give the right code.
    <p>
      employeeid_itab type table of string.
      select /bic/zpe_employeeid into table employeeid_itab from /bic/pzpe_employeeid.
      DELETE SOURCE_PACKAGE where ZEMP_employee_ID NOT IN employeeid_itab.
    It seems that internal table employeeid_itab could not be directly used after the IN keyword.
    how can I do this?
    Edited by: Ben Li on Feb 22, 2008 2:09 PM

    Hi Oscar,
          Actually I had tried this before, using the code like the following,
          <p>
    Types: EmployeeID(7) type  c.
    <p>
    data: sel_itab type  range of EmployeeID.
    <p>
    select /bic/zpe_employeeid into table sel_itab from /bic/pzpe_employeeid.
    <p>
    delete SOURCE_PACKAGE where zemp_employee_id  not in sel_itab.
    <p>
         The grammer check is OK, but when I debug it, I found that there are records in sel_itab, but all the records just have one charactor, actually, my employeeID have 7 charactors in database. So it does not work, I think I miss something in define  of the range table. Can you please figure out? Thanks a lot.

  • ABAP Code in Start Routine for restricing the data records from ODS1 - ODS2

    Hi
    I need small ABAP Code in Start Routine Of Update rules Of ODS . Im in BW 3.5 .
    I have records like below in first layer ODS and i want to restrict some records while going to second layer ODS ..
    ODS1 :-
    DocNO   EventType    Date
    123         001             08/08/2008
    123         003             08/08/2008
    123         011              09/08/2008
    I want one record in ODS2 for this document number whose EventType = 001 only and date of third record ... like below
    Doc NO     EventType      From Date          Todate
    123              001               08/08/2008         09/08/2008
    So how can i get like this record in the ODS2 which will get data from ODS1 . So i need to write the code in the start routine of the ODS2 .
    So please give the me the code for start routine ....
    Regards
    Suresh

    Its difficult in BW 3.5 to include this logic in START_ROUTINE as you cannot add the extra to_date field to the DATA_PACKAGE table.
    You need to create a new global internal table with the same structure of DATA_PACKAGE with additional field to_date. then use the logic to fill in the global internal table
    define a internal table new_data_package with the required structure like (docno, eventtype, fromdate todate)
    data: l_w_datapkg_001 type data_package,
    data: l_w_newdatapkg type new_data_package,
    data: l_w_datapkg_011 type data_package
    LOOP AT DATA_PACKAGE INTO l_w_datapkg_001 WHERE event_type = '001'.
    l_w_newdatapkg-docno = l_w_datapkg_001-docno.
    l_w_newdatapkg-event_type = l_w_datapkg_001-event_type.
    l_w_newdatapkg-fromdate = l_w_datapkg_001-date.
    MOVE CORRESPONDING FIELDS OF l_w_datapkg_001 INTO l_w_newdatapkg.
    READ TABLE data_package INTO l_w_datapkg_011
    WITH KEY docno = l_w_datapkg_001-docno
                     event_type = '011'.
    l_w_newdatapkg-to_date = l_w_datapkg_011-date.
    APPEND l_w_newdatapkg TO new_data_package          
    ENDLOOP.
    Now the new datapackage contains the ODS2 data that u needed

  • 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

  • Need help in ABAP coding in start routine

    Hi,
    I have a requriement like
    -To take the value of month which is an attribute of category(info Object) for which category value is 1. I need to apply the month obtained as the filter to another info object. I have opted to write this ABAP code in start routine. Can anyone guide me on this code.
    Thanks in advance.

    do you not have an abap-er at your disposal? i don't imagine this to be quick & dirty that can be written without access to your system! some analysis work may also be required before the actual coding can be done...so I wouldn't post the entire functional spec (business requirement) here hoping for a solution; that would be too weird.
    Regards.

  • ABAP routine - Transfer rules Start routine

    hello everyone,
    i need some help in writin an ABAP code. Well the logic is say i have a table which sends data to BW. the data comes like :-
    Order        Q1           
    101           50      
    101           20    
    102          10
    101           60
    But i want to store only 1 value for each order , i.e summarize the value so in when the data package comes , i want to check all records for one order and add the qty value for each order and store it in the ODS.
    so ODS for above eg should look like
    Order  qty
    101    130
    102       10
    Thanks,
    Will assign points to all helpful answers.
    Laura.

    Hi:
    If you add Order as the only Key FIELD in ODS and set the Key-figure Q1 to Aggregation, it will solve your problem. You don;t need additional code.
    NOTE: If this is not the case, its not easy to write this in ABAP. because, you don't know whether all Orders (e.g., Order #101) will come in the same DATA PACKAGE. They might be split into two different DATA PACKAGES and your Start Routine will Execute ONLT ONE DATAPACKAGE at a time.
    Chamarthy
    Message was edited by:
            Chamarthy

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

  • ABAP Code in Start Routine to fill a field

    Hello,
    with the following code in the start routine in BW3.5 I am trying to fill Intercompany-Indicator based on Distribution Channel. The main code is marked bold.
    Distribution Channel = DISTR_CHAN
    InterCompany-Indicator = G_CWWR14
    Pls help. Thanks.
    SD
    Intercompany Indicator
        IF NOT wa_daten-customer IS INITIAL.
          SELECT SINGLE /b05/s_rbkunde FROM  /b05/mrbcust INTO l_rbcust
                 WHERE  /b05/s_rbcust  = wa_daten-customer
                 AND    objvers        = 'A'
                 AND    datefrom      <= l_date
                 AND    dateto        >= l_date.
          IF sy-subrc EQ 0.
            SELECT SINGLE g_cwwr14 FROM  /b05/mrbkdbkrs INTO l_ii
                   WHERE  comp_code        = wa_daten-comp_code
                   AND    /b05/s_rbkdbkrs  = l_rbcust
                   AND    objvers          = 'A'
                   AND    datefrom        <= l_date
                   AND    dateto          >= l_date.
            IF sy-subrc = 0.
              wa_daten-g_cwwr14 = l_ii.
            ELSE.
              CLEAR wa_daten-g_cwwr14.
            ENDIF.
          ELSE.
            CLEAR wa_daten-g_cwwr14.
          ENDIF.
        ELSE.
          IF wa_daten-G_CWWR14 = ' '.
            CASE wa_daten-DISTR_CHAN.
              WHEN 'Y4'.
                wa_daten-G_CWWR14 = '4'.
              WHEN 'Y5'.
                wa_daten-G_CWWR14 = '2'.
              WHEN OTHERS.
                wa_daten-G_CWWR14 = '0'.
            ENDCASE.
          ENDIF.
        ENDIF.      " NOT wa_daten-customer IS INITIAL
        MODIFY DATA_PACKAGE FROM wa_daten.
      ENDLOOP.

    Hi Venkat,
      Two things -One is the performance and the other ... there is no Append  within the loop.
      Try moving the select statement ousdie the loop to improve performance and move the modify statement into the loop ... change modify to append. Code below.
       Let me know if you need more help.
    Best regards,
    Kazmi
    data: it_data type standard table of data_package_structure
    with header line
    with non-unique default key initial size 0.
    types: begin of billing_item_type,
    BILL_NUM like /BIC/AZSD_O0700-BILL_NUM,
    DOC_NUMBER like /BIC/AZSD_O0700-DOC_NUMBER,
    PLANT like /BIC/AZSD_O0700-PLANT,
    end of billing_item_type.
    refresh it_data.
    clear it_data.
    it_data] = DATA_PACKAGE[.
    refresh DATA_PACKAGE.
    clear DATA_PACKAGE.
    loop at it_data.
    select DOC_NUMBER PLANT into (it_data-DOC_NUMBER, it_data-PLANT)
    from /BIC/AZSD_O0700
    where BILL_NUM = it_data-BILL_NUM
    and FISCVARNT = it_data-fiscvarnt.
    endselect.
    if sy-subrc = 0.
    move-corresponding it_data to DATA_PACKAGE.
    Append DATA_PACKAGE.
    endif.
    endloop.

Maybe you are looking for

  • How to refresh value in selection screen field

    Hi Experts, I have a requirement to refresh the value in selection screen.while i run the report in selection screen i selecting one variant for look the output if i use some other field value with same variant without save its working fine i am avle

  • Sequence settings / render confusion

    Hi, One thing with FCP I never seem to understand is the way that it deals with sequence settings. I always find myself thinking: Final Cut Pro is smart, why can't it just figure out what my clip settings are and adjust it so that I don't have to do

  • Keynote kept crashing.  Won't start from the beginning.  Help!

    The keynote kept crashing.  I went to the website just now, but when I try to watch, I can't get back to the beginning, which I missed.  The only options are "watch live" and "start from pause," and neither of those is what I need to do.

  • Connect of 2 SAP BW systems to  one SAP Enterprise Portal

    Hi! I have 2 SAP BW systems that should be integrated into SAP Enterprise Portal. I currently have already one SAP system entry "SAP_BW" within SAP EP. Questions Is it possible to define second entry for second SAP BW system in order to use 2 SAP BW

  • Debbuging in back gorund mode

    hi , when i am debugging report in back ground i need to enter endless loop code in the program where i need to start debugging. how to enter the code in debugging mode and what is the use of that.