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.

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

  • 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

    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.

  • 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

  • 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

  • Start Routine Help - PLEASE...

    Hello All BW/ABAP gurus, I am not good at ABAP and I need some help in writing  Start routine.
    Basically my (SIMPLIFIED) requirement is, I have the data coming in as series of 3 fields (data always will come) and if there are multiple values in those fields I have to create multiple records in the ODS with a sequence number.
    For example if the data record is like
    ABC01 00     99    88
    Then my data record in ODS should be
    ABC01   0001          99
    ABC01   0002          88
    And if the data record is:
    ABC01 00     00    88
    My record in ODS should be just
    ABC01   0001          88
    So that’s the logic I am expecting in the start routine…
    So I kind of written the key part of code in the section below… Any one who is good in ABAP and has written similar code in Start Routine, please correct if there are any mistakes … thanks a ton in advance…
    CODE starts here:
    DATA COUNT_SEQ N.
    BEGIN ITAB_MAIN.
         KEY_FLD_01     AS /BIC/  ……….
         KEY_SEQ_01    AS /BIC/ ………..
         DATA_FLD_01 AS /BIC/ ………
    END ITAB_MAIN.
    BEGIN ITAB_INNER.
         KEY_SEQ_01    AS /BIC/ ………..
         DATA_FLD_01 AS /BIC/ ………
    END ITAB_INNER.
    LOOP AT DATA_PACKAGE.
    REFRESH ITAB_MAIN.
    ITAB_MAIN-KEY_FLD_01 = DATA_PACKAGE-KEY_FLD_01.
    COUNT_SEQ = 1.
    IF DATA_PACKAGE- DATA_FLD_01  > 0.
         ITAB_INNER-KEY_SEQ_01 = COUNT_SEQ.
         ITAB_INNER-DATA_FLD_01 = DATA_PACKAGE- DATA_FLD_01.
         COUNT_SEQ = COUNT_SEQ + 1.
          IF COUNT_SEQ = 1.
              MODIFY ITAB_INNER.
          ELSE
              APPEND ITAB_INNER.
          END IF.
    END IF.
    IF DATA_PACKAGE- DATA_FLD_01  > 0.
         ITAB_INNER-KEY_SEQ_01 = COUNT_SEQ.
         ITAB_INNER-DATA_FLD_01 = DATA_PACKAGE- DATA_FLD_01.
         COUNT_SEQ = COUNT_SEQ + 1.
          IF COUNT_SEQ = 1.
              MODIFY ITAB_INNER.
          ELSE
              APPEND ITAB_INNER.
          END IF.
    END IF.
    IF DATA_PACKAGE- DATA_FLD_02  > 0.
         ITAB_INNER-KEY_SEQ_01 = COUNT_SEQ.
         ITAB_INNER-DATA_FLD_02 = DATA_PACKAGE- DATA_FLD_02.
         COUNT_SEQ = COUNT_SEQ + 1.
          IF COUNT_SEQ = 1.
              MODIFY ITAB_INNER.
          ELSE
              APPEND ITAB_INNER.
          END IF.
    END IF.
    IF DATA_PACKAGE- DATA_FLD_03  > 0.
         ITAB_INNER-KEY_SEQ_01 = COUNT_SEQ.
         ITAB_INNER-DATA_FLD_03 = DATA_PACKAGE- DATA_FLD_03.
         COUNT_SEQ = COUNT_SEQ + 1.
          IF COUNT_SEQ = 1.
              MODIFY ITAB_INNER.
          ELSE
              APPEND ITAB_INNER.
          END IF.
    END IF.
    ITAB_INNER [] ITAB_MAIN.
    CLEAR ITAB_MAIN.
    CLEAR ITAB_INNER.
    END LOOP.

    I think could be as that:
    DATA COUNT_SEQ N.
    DATA_PACKAGE_NEW like DATA_PACKAGE occurs 0 with header line.
    REFRESH DATA_PACKAGE_NEW .
    LOOP AT DATA_PACKAGE.
    ITAB_MAIN-KEY_FLD_01 = DATA_PACKAGE-KEY_FLD_01.
    COUNT_SEQ = 1.
    IF DATA_PACKAGE- DATA_FLD_01 > 0.
    DATA_PACKAGE_NEW-KEY_SEQ_01 = COUNT_SEQ.
    DATA_PACKAGE_NEW-DATA_FLD_01 = DATA_PACKAGE- DATA_FLD_01.
    ADD 1 TO COUNT_SEQ.
    APPEND DATA_PACKAGE_NEW.
    END IF.
    < same for 2, 3, 4>
    END LOOP.
    REFRESH DATA_PACKAGE.
    DATA_PACKAGE[] = DATA_PACKAGE_NEW[].
    I hope this help

  • Need some help on Start routines,

    Hi Gurus,
    I am new to SAP ABAP, I am a BI consultant with 0 ABAP knowledge, Please help me writing a code for the following scenario.(START ROUTINE)
    I have a DSO(S_DSO) as source and cube(T_CUBE) as target, and before extracting the data into T_CUBE i need to validate the data. for this I got one more DSO(LU_DSO) for look up.
    structures of the dso's and cube :
    S_DSO  ............                                                T_CUBE .........   .....                        LU_DSO
    ZDOC_NO  .........                           ZDOC_NO ...........                       ZDOC_NO
    ZPROD_FAM  ........                                       ZPROD_FAM .........       ZPROD_FAM
    QTY   .........    .....................                                                             QTY........
    UNIT_PRICE  ..........                                        UNIT_PRICE.......
    LOGIC
    if S_DSO-ZDOC_NO = LU_DSO-ZDOC_NO AND S_DSO-ZPROD_FAM = LU_DSO-ZPROD_FAM
    THEN
    S_DSO-ZDOC_NO = T_CUBE-ZDOC_NO AND S_DSO-ZPROD_FAM = T_CUBE-ZPROD_FAM AND
    S_DSO-QTY = T_CUBE-QTY AND S_DSO-UNIT_PRICE = T_CUBE-UNIT_PRICE
    please help me to achieve this....please provide code from the initializations of internal tables not just the looping conditions.
    You help will be most appreciated
    Surabhi
    Edited by: surabhi5579 on Mar 28, 2009 8:14 PM
    Edited by: surabhi5579 on Mar 28, 2009 8:16 PM
    Edited by: surabhi5579 on Mar 28, 2009 8:17 PM
    Edited by: surabhi5579 on Mar 28, 2009 8:17 PM

    Hi Viren,
    I did applied the code in Start routine but the out put is not as required.
    My Data model is as follows:
    zmd_dso(source dso)                                        
    zdocno..  zprod_fam.. qty.. price                               
    a001...      A    ...         10   ... 100                                      
    a002 ...    B     ...          20  ...  200                                      
    a003...     C     ...          30  ...  300
    zmd_dsc(lookup dso)
    zdocno ...  zprod_fam
    a001  ....      A 
    a003    ....    C
    desired output
    zdata_ic(target)
    zdoc_no ...  zprod_fam ..  qty   ..  price
    aoo1  ...     A    ...          10   ...    100
      a003   ...    C   ...            30 ...      300
    As per the above table   zmd_dso is the source DSO and Zdata_ic is Target Cube, but in between there is DSO called zmd_dsc which contains zdoc_no and zprod_fam   and after the transfermation u can see the cube filterd by the values in zmd_dsc which is a look up dso. the doc_no "  a002" and the Zprod_fam "B" are not present in the lookup dso and that is the reason why the entries are not visible in the cube after extraction.
    I tried ur code, but the result is same as source dso  i can see all the records which are available in the source dso and it is not cross checking the lookup dso that is Zmd_dsc.
    I hope ur understanding what i meant to say. sorry if i am confusing you.
    Edited by: surabhi5579 on Mar 29, 2009 7:08 PM
    Edited by: surabhi5579 on Mar 29, 2009 7:19 PM

  • Converting key figures from rows to column using DSO and start routine

    Hi SDNer:
    I need some help to convert key figures from rows to column.
    The source is DSO 1 and I am thinking about writing ABAP in the start routine to do the conversion. The target is DSO2.
    Below is the  more detail information with example. Basically, for each record in DSO 1 I need to create 3 records (because there are 3 KF's) and output to DSO2.
    I would really appreciate some help on this.Thank you.
    Tony
    DSO 1 data format (SOURCE)
    Period   ID   KF1  KF2  KF3
    200702 100  300  200   750
    Output to DSO 2 (TARGET)
    Period   ID    KF  LABEL
    200702 100  300  KF1
    200702 100  200  KF2
    200702 100  750  KF3

    This is the code in BI 7.0.
    u need to put a field "Label" in DSO1. u dont need to populate this in DSO1 but it helps the code to populate the field in DSO2.
    DATA: wa_result TYPE _ty_s_sc_1,
    t_result TYPE STANDARD TABLE OF _ty_s_sc_1.
    DATA:counter(2) TYPE n.
    LOOP AT SOURCE_PACKAGE INTO wa_result.
    counter =0.
    while counter < 3 .
    wa_result- Period = wa_result-Period.
    wa_result- ID = wa_result-ID.
    if counter  = 0.
    wa_result- KF1 = wa_result-KF1.
    wa_result- Label = 'KF1'.
    elseif counter = 1.
    wa_result- KF1 = wa_result-KF2.
    wa_result- Label = 'KF2'.
    else.
    wa_result- KF1 = wa_result-KF3.
    wa_result- Label = 'KF3'.
    endif.
    APPEND wa_result TO t_result.
    counter = counter+1.
    endwhile.
    endloop.
    CLEAR: SOURCE_PACKAGE,wa_result.
    LOOP AT t_result INTO wa_result.
    APPEND wa_result TO SOURCE_PACKAGE.
    ENDLOOP.

  • Start routine internal table data  is inaccessible.

    Hi Guru,
    I have written a small code in start routine  using internal tables. The internal table has 4 fields. Intially first 3 fields are populated from ods for only the records in the data package. Then the 4th field is modified using loop on internal table. Then a sort is done on internal table  and deleting the adjacent records. Now the data is read from internal table in updates rules. But data is not populating for the fields in listcube. I guess the loop on internal table is not modifying the internal table, below is the code.
    Types: BEGIN OF ITAB1,
    doc_no LIKE /BIC/AZFGLO10100-AC_DOC_NO,
    item_no LIKE /BIC/AZFGLO10100-ITEM_NUM,
    taxjur LIKE /BIC/AZFGLO10100-TAXJURCODE,
    z_len TYPE I,
    END OF ITAB1.
    DATA ITAB_01 TYPE TABLE OF ITAB1 WITH HEADER LINE.
    DATA LEN TYPE I.
    DATA: str1 TYPE string,
    str2 TYPE string,
    doc like /BIC/AZFGLO10100-AC_DOC_NO,
    item like /BIC/AZFGLO10100-ITEM_NUM,
    jur like /BIC/AZFGLO10100-TAXJURCODE.
    ***filling the internal table with the contents of
    select AC_DOC_NO ITEM_NUM TAXJURCODE into
    corresponding fields of itab_01
    from /BIC/AZFGLO10100
    FOR ALL ENTRIES IN DATA_PACKAGE
    WHERE AC_DOC_NO = DATA_PACKAGE-AC_DOC_NO
    AND ITEM_NUM = DATA_PACKAGE-ITEM_NUM.
    endselect.
    SORT ITAB_01 ASCENDING BY doc_no ITEM_NO ASCENDING.
    loop at itab_01.
    doc = itab_01-doc_no.
    item = itab_01-item_no.
    TAX = itab_01-taxjur.
    len = STRLEN(tax).
    itab_01-z_len = len.
    modify itab_01 transporting z_len where
    doc_no = doc and item_no = item.
    ENDLOOP.
    ***what I am doing here I am keep only the records in itab which has minimum
    tax jurisdiction length for a line item in a document*****
    SORT ITAB_01 DESCENDING BY doc_no z_len ASCENDING.
    DELETE ADJACENT DUPLICATES FROM itab_01 comparing doc_no.
    and for zlenght object I am writing the followoing code in update rules.
    read table itab_01 with key doc_no = COMM_STRUCTURE-AC_DOC_NO
    BINARY SEARCH.
    if sy-subrc = 0.
    RESULT = itab_01-z_len.
    endif.
    But the field z_len field is blank for all fields.
    Any help is really appreciated.
    Thanks,
    Raj

    hi Ravi,
    try to give same field name in internal table and /BIC/AZFGLO10100, change the code accordingly
    Types: BEGIN OF ITAB1,
    <b>AC_DOC_NO</b> LIKE /BIC/AZFGLO10100-AC_DOC_NO,
    <b>ITEM_NUM</b> LIKE /BIC/AZFGLO10100-ITEM_NUM,
    <b>TAXJURCODE</b> LIKE /BIC/AZFGLO10100-TAXJURCODE,
    z_len TYPE I,
    END OF ITAB1.
    DATA ITAB_01 TYPE TABLE OF ITAB1 WITH HEADER LINE.
    ***filling the internal table with the contents of
    select AC_DOC_NO ITEM_NUM TAXJURCODE into
    <b>corresponding fields</b> of itab_01
    from /BIC/AZFGLO10100
    FOR ALL ENTRIES IN DATA_PACKAGE
    WHERE AC_DOC_NO = DATA_PACKAGE-AC_DOC_NO
    AND ITEM_NUM = DATA_PACKAGE-ITEM_NUM.
    endselect.
    <b></b><b></b>

  • Start routine in DSO Self transformations

    Hi SCN,
    I need to write start routine to fill one of my target feild.
    Here my info object is ZCust and attribute zpur_grp
    My DSO have 0customer and zpur_grp.
    Am creating self transformations for my dso and need to fill zpur_grp from zcust if dso-zpur_grp is blank.
    condition is dso-0customer = info object-customer.
    Am new to abap code part and confused about specifying fields and tables(/bic/).
    Need suggestions to write sample format code.
    Thanks in advance.
    Chandra

    Hi Chandra,
    U need to write look-up code.
    Below s sample code. it might be help you.
    Declare Internal Table Like follow:
    TYPES: BEGIN OF TY_CUST,
                      ZCust TYPE /BIC/ ZCust ,
                      zpur_grp TYPE /BIC/ zpur_grp
                   END OF TY_CUST.
    select value for internal table.
    SELECT /BIC/ ZCust /BIC/zpur_grp
           FROM /BIC/PZCust
           INTO TABLE IT_CUST
           FOR ALL ENTRIES IN SOURCE_PACKAGE
           WHERE /BIC/ZCust = SOURCE_PACKAGE-/BIC/0customer
           AND OBJVERS = 'A'.
    Then write Lookup code in start routine.
    LOOP AT SOURCE_PACKAGE ASSIGNING <SOURCE_FIELDS>.
           clear : WA_CUST_DBDIV.
    * Read internal table for customer
           READ TABLE IT_CUST
           WITH KEY ZCust = <SOURCE_FIELDS>-/BIC/0custome
           INTO WA_CUST_DBDIV
           BINARY SEARCH.
    *Populate the corresponding Customer and DB Division in RESULT_PACKAGE
           IF SY-SUBRC = 0.
             <SOURCE_FIELDS>-/BIC/0custome = WA_CUST_DBDIV-ZCust.
             <SOURCE_FIELDS>-/BIC/zpur_grp = WA_CUST_DBDIV-zpur_grp.
    ENDLOOP.
    Hope it 'll help you.
    Regards,
    Mukesh

  • Start Routine to Populate Account Group Field from Master data of 0Customer

    Hello Friends. Please help me edit this ABAP code to make it work. I am putting this code in start routine in between two DSO. where I am using the
    Start Routine to Populate Account Group Field from Master data of 0Customer. I do not want to use read from master data functionality since that field 0customer is not there in dso but similar field 0debitor is there. so i want to put this code
    during the load from source DSO to Target DSO.
    Error Explicit length specifications are necessary with types C, P, X, N und
    DATA: L_S_DP_LINE TYPE DATA_PACKAGE_sTRUCTURE.
        types: begin of comp,
         CUSTOMER       type  /BI0/OICUSTOMER,
         ACCNT_GRP          type /BI0/OIACCNT_GRP,
       end of comp.
        DATA: l_S_comp type comp.
        DATA: L_th_COMP TYPE HASHED TABLE OF COMP WITH UNIQUE KEY customer INITIAL SIZE 0.
    IF  L_th_COMP[] IS INITIAL.
    SELECT CUSTOMER ACCNT_GRP FROM /BI0/PCUSTOMER APPENDING CORRESPONDING FIELDS OF TABLE L_th_COMP.
    ENDIF.
    LOOP AT SOURCE_PACKAGE INTO L_S_DP_LINE.
    READ TABLE L_TH_COMP INTO L_S_COMP WITH TABLE KEY CUSTOMER = L_s_DP_LINE-CUSTOMER
    IF SY-SUBRC = 0.
    L_S_DP_LINE-/BIC/ACCNT_GRP = L_S_COMP-/BIC/ACCNT_GRP.
    MODIFY SOURCE_PACKAGE FROM L_S_DP_LINE.
    ENDIF.
    ENDLOOP.
    soniya kapoor
    Message was edited by:
            soniya kapoor

    Hello Wond Thanks for Good Answer and good option, But Client does not like this option and does not like Nav Attribute so he does not want to turn on any Nav Attribute, In general also We hav requirement to read a third table while uploading 1 dso table to 2 dso table,
    so  Please help me edit this ABAP code to make it work. I am putting this code in start routine in between two DSO. where I am using the
    Start Routine to Populate Account Group Field from Master data of 0Customer.
    No syntax Error But during the load it is updating the source table and not the target table. how to define now target table.
    ***SOURCE DSO Table
    types: begin of typ_tgl1.
        include type /BIC/AZDAFIAR000.
        types: end of typ_tgl1.
        types: begin of comp,
         CUSTOMER       type  /BI0/OICUSTOMER,
         ACCNT_GRP          type /BI0/OIACCNT_GRP,
       end of comp.
    DATA: L_th_COMP TYPE HASHED TABLE OF COMP WITH UNIQUE KEY customer
    INITIAL SIZE 0.
      data: wa_itab type COMP.
        data: wa_zdtg type typ_tgl1.
    IF  L_th_COMP[] IS INITIAL.
    ***Master Data Table
    SELECT CUSTOMER ACCNT_GRP FROM /BI0/PCUSTOMER APPENDING CORRESPONDING
    FIELDS OF TABLE L_th_COMP.
    sort L_th_COMP by CUSTOMER.
    ENDIF.
    LOOP AT L_th_COMP into wa_itab.
    select * from /BIC/AZDAFIAR000 into wa_zdtg
                        where DEBITOR  eq wa_itab-CUSTOMER.  *** SOURCE DSO Table
    IF SY-SUBRC = 0.
    wa_zdtg-ACCNT_GRP = wa_itab-ACCNT_GRP.
    MODIFY /BIC/AZDAFIAR000 from wa_zdtg. *** modify SOURCE DSO Table
    ENDIF.
      endselect.
        endloop.
    soniya kapoor

  • Need Start routine logic

    Hi,
    Can anyone please let me know the code in start routine for the below.
    I want to delete the unwanted datapackage in start routine for the below condition.
    For  system PCR
    For purch.org Z300, only those purchase orders shall be loaded to further layers which have the text "FCM" in the field Incoterms2 (ZPURINC2), the other purchase orders of this purch org and this system can be deleted.
    thankyou........
    Regards...
    Balaji

    Hi,
    Delete Source_package where SYSTEM = 'PCR' and PURCH.ORG = 'Z300' and ZPURINC2 NE 'FCM'.
    Check the definition of source_package in the start routine screen and use the exact infoobjects while defining the Delete statement
    Regards
    Githen

Maybe you are looking for

  • How can I execute Stored Procedures in PARALLEL and DYNAMICALLY ?

    Hi  I have a stored procedure. It can be executed like this exec test @p = 1; exec test @p = 2 exec test @p = n; n can be hundred. I want the sp being executed in parallel, not sequence. It means the 3 examples above can be run at the same time. If I

  • EPUB file won't open in Apple iBooks

    Hi all! I'm creating ebooks for a client using InDesign CC and she reports that the most recent EPUB I've created for her won't open in iBooks. As I don't own a smartphone or tablet I can't error-test on my end, but if you can think of anything that

  • Branching and lesson completion

    Hi Advanced Users, My clients want very much to know that the students are going through each slide when the complete a lesson.  However, in the lesson, some content is presented as both "demo" -- watch how it is done or "try it yourself" where the i

  • Useful Web ADI custom integrators docs

    I have recently started to look at creating Custom Integrators and thought it might help others if I listed the Oracle Docs I have found since they don't go out of their way to explain how to create custom integrators WebADI Implementation and Admini

  • DBACockpit not working after SP upgrade

    Hi everyone, I recently applied support pack 12,13 and 14 for SAP_BASIS component. A note about failing jobs in DB13 was specified in the known errors of support packages. When I started DB13 to configure the jobs, I got an empty DBA Cockpit and the