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.

Similar Messages

  • 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

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

  • 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

  • Abap code in start routine

    hi,
    i have a code in this way in update routine of that info object
    instead of writng that code in update routine i want to write in start routine
    can any one tell me what r the changes i have to made
    please suggest me
    i will assigfn points
    CASE COMM_STRUCTURE-crm_ctstat.
    Contact Achieved
        WHEN '0'.
    Finished faultless
          RESULT = '20'.
          RETURNCODE = 0.
    Contact Not Possible (Missing Communication Data)
        WHEN '1'.
    Finished faulty
          RESULT = '10'.
          RETURNCODE = 0.
    Contact Not Possible (Incorrect Communication Data)
        WHEN '2'.
    Finished faulty
          RESULT = '10'.
          RETURNCODE = 0.
    Contact Not Permitted (Max. Usage BP List)
        WHEN '3'.
    Finished faulty
          RESULT = '10'.
          RETURNCODE = 0.
    Contact Not Permitted (Block Indicator for BP)
        WHEN '4'.
    Finished faulty
          RESULT = '10'.
          RETURNCODE = 0.
    Contact Not Possible (Technical Problems)
        WHEN '5'.
    Finished faulty
          RESULT = '10'.
          RETURNCODE = 0.
      ENDCASE.

    Hi,
    loop at datapackage.
    CASE datapackage-crm_ctstat.
    Contact Achieved
    WHEN '0'.
    Finished faultless
    RESULT = '20'.
    RETURNCODE = 0.
    Contact Not Possible (Missing Communication Data)
    WHEN '1'.
    Finished faulty
    RESULT = '10'.
    RETURNCODE = 0.
    Contact Not Possible (Incorrect Communication Data)
    WHEN '2'.
    Finished faulty
    RESULT = '10'.
    RETURNCODE = 0.
    Contact Not Permitted (Max. Usage BP List)
    WHEN '3'.
    Finished faulty
    RESULT = '10'.
    RETURNCODE = 0.
    Contact Not Permitted (Block Indicator for BP)
    WHEN '4'.
    Finished faulty
    RESULT = '10'.
    RETURNCODE = 0.
    Contact Not Possible (Technical Problems)
    WHEN '5'.
    Finished faulty
    RESULT = '10'.
    RETURNCODE = 0.
    ENDCASE.
    endloop.

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

  • Urgent : Doubt in writing a code in start routine

    Hi all ,
                 I am BI 7.0 system , I have doubt in writing a code in start routine .
    1) i have to extract the data first from a custom table based on one condition and then placing it into internal table .
    2) Now i have to loop at source_package for a particular region field say "ASIA". with this result i have to check for the correponding entries in custoom table .
       if condition is not true (i.e ) with entries or not matching then delete that particular record from source_package.
    i have written a small logic for this . but this is producing any ouput , Please check it and also let me know for modifications .
    thanks in advance.
    select * from zcsp
        into corresponding fields of TABLE itab_T
        where
        ZBUSINESSUNIT = 'BC'.
    loop at SOURCE_PACKAGE into ls_SOURCE_PACKAGE where /BIC/DPREGION = 'XE'.
                 loop at itab_t into itab_w where zcategory =
                   ls_source_package-/BIC/DPMAT/BIC/DPCAT.
                       if sy-subrc ne 0.
                         delete SOURCE_PACKAGE.
                       endif.
               endloop.
           endloop.

    You're deleting the entire input package.  You only want to delete the one row.
    DATA: g_tabix TYPE sy-tabix.
    SELECT * FROM zscp
    INTO CORRESPONDING FIELDS OF TABLE itab_t
    WHERE zbusinessunit = 'BC'.
    SORT itab_t BY zcategory.
    LOOP AT source_package INTO ls_source_package WHERE /bic/dpregion = 'XE'.
      g_tabix = sy-tabix.
      READ TABLE itab_t WITH KEY zcategory = ls_source_package-/bic/dpmat/bic/dpcat TRANSPORTING NO FIELDS BINARY SEARCH.
      IF sy-subrc NE 0.
        DELETE source_package INDEX g_tabix.
      ENDIF.
    ENDLOOP.

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

  • ?(Start) Routine to fill a flag for all Y_ID_i where X_IDij is max value

    Just one sentence: How can i write a routine to fill an infoObject with value "X", for the max value key_id X_IDij of every foreign key Y_ID_i.
    > More explanation------>
    I have such data rows in cube with main keys Xi and foreign keys Yi, characteristic Ci
    row1: X1   Y1  C1
    row2: X2   Y1  C2
    row3: X3   Y1  C3
    row4: X4   Y2  C4
    row5: X5   Y2  C5
    row6: X6   Y2  C6
    row7: X7   Y3  C7
    row8: X8   Y3  C8
    row9: X9   Y3  C9
    I want to display in the query for every foreign key Yi the once row with max Xi: Max from (X1, X2, X3); Max from (X4, X5, X6)..
    Those rows that will be displayed in query are row3, row6 and row9 because by Y1, X3 is the maximal value, for Y2 is X6 and for Y3 is X9. 
    How can i select those row in the query. So that, only one row (with max X) is diplayed for every foreign key.
    Thanks for helping.
    Arnaud
    Edited by: Arnaud on Aug 18, 2009 7:00 AM
    Edited by: Arnaud on Aug 18, 2009 1:17 PM
    Edited by: Arnaud on Aug 27, 2009 9:45 AM

    Hi Arnaud,
    You can use the below code in your start routine -
    DATA : IT_TAB TYPE DATA_PACKAGE OCCURS 0.
    IT_TAB[] = DATA_PACKAGE[].
    SORT IT_TAB BY Y DESCENDING X.
    DELETE ADJACENT DUPLICATES FROM IT_TAB COMPARING Y X.
    LOOP AT DATA_PACKAGE.
      READ TABLE IT_TAB WITH KEY X=DATA_PACKAGE-X
                                                          Y=DATA_PACKAGE-Y
                                                          Z=DATA_PACKAGE-Z
                                             BINARY SEARCH.
      IF SY-SUBRC EQ 0.
        DATA_SOURCE-FLAG = 'X'.
        MODIFY DATA_SOURCE.
      ENDIF.
    ENDLOOP.
    Here we are assuming that your data package contains the additional field FLAG.
    Regards,
    Saurabh

  • Code help - start routine

    I have two ODS's - ODS1 and ODS2 . ODS1 feeds data to ODS2 using an
    uppdate rule .ODS1 data is as follows
    Billno  Itemno cond keyfig
    10     1     a     1
    10     1     b     3
    10     1      c     5
    20     1     d     7
    20     1     e     8
    20     1     f     1
    20     1     g     1
    30     2     h     4
    30     3     h     2
    I need to populate a field in ODS2 (say sum) by summing
    all values of keyfig for each bill no . for example in the
    above case ods2-sum should be filled with values 9 ,16 and 6
    for billno's 10,20& 30 respectively .
    can someone pls help me with required code.
    thanks

    Hi,
    In the start routine write the selection:
    DATA: begin of it_int occurs 0,
                    billno type ods2-billno,
                    sum type ods2-sum,
                 end of it_int.
    select billno sum( keyfig ) from ods1
    into table it_int groupby billno orderby billno.
    In the update routine for ods2-sum read the it_init:
    read table it_int with key
    billno = COMM_STRUCTURE-billno.
    if sy-subrc = 0.
      result = it_int-sum.
    endif.
    Regards,
    Prema

  • 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

  • Need ABAP Code in BI routine

    Hi,
    I want to write a transfer routine, Can any one give me the ABAP Code...
    Here is what I want to do:
    1. Read by document Number at the Header level (identified by item = "#")
    2. Read the Status of the Header
    3. If the Status = deleted
    4. Read all the line items related to the Header
    5. Assign the Status of the line item = Status of the Header
    Thanks
    Edited by: tanu d on Aug 20, 2010 11:32 AM

    Hi,
    See the simple code.
    IF SOURCE_FIELDS-N_WBSEOM = ' '.
          RESULT = 'N'
        ELSE.
          RESULT = SOURCE_FIELDS-N_WBSEOM.
        ENDIF.
    OR
    IF SOURCE_FIELDS-N_WBSEOM IS INITIAL.
          RESULT = 'N'
        ELSE.
          RESULT = SOURCE_FIELDS-N_WBSEOM.
        ENDIF.
    Thanks
    Reddy
    Edited by: Surendra Reddy on Nov 25, 2009 5:38 AM

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

  • Start routine to update some fields of a ODS based on the another ODS

    Hi I know i have to do abap coding at the start routine to update a ODS based on another ODS. I have tried doing the code for quite some time now and i have not been successful. I think I havenu2019t followed the definition required for this routine.
    I have 2 ODS, ODS1 has 3 key fields and ODS2 has 1 key field
    I have to map the ODS based on a 1:3 relation.
    I am writing this start routine for the update rules from ODS2 to ODS1.
    The logic is if the key field of ODS2 is equal to either Key field 1 or Key field 2 or Key field 3 of ODS1 then that record from ODS2 has to be updated to the corresponding matching record of ODS1, else no update. The 3 key fields of ODS1 have different character length and character types and the key field of ODS2 has a different character length and type when compared to the any of the key fields of ODS2 can match any of those.
    Like key field 1 of ODS1 has length 10. Key field 2 of ODS1 has length 10 and key field 3 of ODS1 has length 20 and all these fields are not alpha converted, but the key field of ODS2 has length 60 and it is alpha converted.
    Can anyone please help me in this code.
    My Code is as below.
    ITAB1-T_BOL = DATA_PACKAGE-/BIC/ZLBOL.
    ***********NISTEVO SELECT******************************
      SELECT /BIC/ZLBOL FROM /BIC/AWLONST0100 INTO ITAB1-T_BOL
                  WHERE /BIC/ZLBOL = ITAB1-T_BOL .
    **************R/3 SELECT*******************************
        SELECT /BIC/ZLRDELNU /BIC/ZLRSHIPNU /BIC/ZLREXTID
                  FROM /BIC/AWLOR3O0400
                  INTO CORRESPONDING FIELDS OF ITAB1
                  WHERE
                  /BIC/ZLRDELNU = ITAB1-T_BOL OR
                   /BIC/ZLRSHIPNU = ITAB1-T_BOL OR
                   /BIC/ZLREXTID = ITAB1-T_BOL .
          SORT ITAB1 BY T_DELNU T_SHIPNU T_EXTID .
          LOOP AT DATA_PACKAGE.
            READ TABLE ITAB1 WITH KEY T_DELNU = DATA_PACKAGE-/BIC/ZLBOL.
            IF SY-SUBRC = 0.
              EXIT.
            ENDIF.
            READ TABLE ITAB1 WITH KEY T_SHIPNU = DATA_PACKAGE-/BIC/ZLBOL.
            IF SY-SUBRC = 0.
              EXIT.
            ENDIF.
            READ TABLE ITAB1 WITH KEY T_EXTID = DATA_PACKAGE-/BIC/ZLBOL.
            IF SY-SUBRC = 0.
              EXIT.
            ENDIF.
            DELETE DATA_PACKAGE .
          ENDLOOP.
        ENDSELECT.
      ENDSELECT.
    Points will be awarded.
    Edited by: satish rajaram on Nov 6, 2008 4:51 PM
    Edited by: satish rajaram on Nov 7, 2008 11:40 AM
    Edited by: satish rajaram on Nov 7, 2008 11:43 AM

    The logic is if the key field of ODS2 is equal to either Key field 1 or Key field 2 or Key field 3 of ODS1 then that record from ODS2 has to be updated to the corresponding matching record of ODS1, else no update. The 3 key fields of ODS1 have different character length and character types and the key field of ODS2 has a different character length and type when compared to the any of the key fields of ODS2 can match any of those.
    Can you try below logic :
    Below is not code it needs to be manipulated as per requirement.
    ODS2 ---> ODS1
    SELECT <key fields of ODS1>
    FROM /BIC/A<ODS1>00
    INTO ITAB
    FOR ALL ENTRIES IN DATA_PACKAGE
    WHERE
    keyfield1 = data_package-key1
    or
    keyfield2 = data_package-key2
    or
    keyfield3 = data_package-key3
    **Now itab has all entries which neednot be deleted from data_package.****
    if sy-subrc=0.
    ***Check Itab and delete only those records not present in itab from data_package****
    endif.
    Hope this helps.

Maybe you are looking for

  • No photos in PDF-files synched to iBooks

    A new problem showed up, maybe by moving to the capacity limit? Some synched PDF-files appear in iBooks as "text only"! On the stationary Mac Pro all photos & illustrations are shown. Why not on the iPad 2? After synching all PDFs are automatically l

  • Strange String behaviour wrt ==

    The following code is disturbing my peace of mind (println is short for System.out.println): String s1="a"+"a", s2="aa", s3= new String("aa"); println("aa"=="aa"); println(s1==s2); println(s1==s3); On my JDK 1.2 this gives me: true true false I can -

  • My new iPhone is not showing up in iTunes

    My new iPhone 4 is not showing up as a device in iTunes anyone have any remedies?

  • Catch event in a different program

    Hi I have a modul pool, it's possible that in this modul-pool i catch a event raised in another function? I've created a Z-Class with a static event and a method that raises the event In the modul-pool i've created a local class to receive the events

  • Can I use CS5 Student and Teacher Edition for pc, on a Mac instead?

    I have Adobe Creative Suite CS5 Student and teacher PC version and am looking to possibly upgrade from a pc laptop to a 27" imac. Is it possible for me to still use the software for the imac. If so, what are my options please?