ABAP help for start routine.

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

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

Similar Messages

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

  • 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

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

  • 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

  • Needs sample ABAP code for field routine

    Dear Expert,
    There is a field "Pay Scale Group" in my DSO which stores the data in the format
    AA1/B1/CCC2/DD2/EEE1, A1/BB2/CC2/DDD3/EE2 etc. These data has to be transferred to
    InfoCube where "pay Scale Group" in the InfoCube will store the data like EEE1,EE2 etc.
    I need to write a field routine on the transformation between DSO and Cube.
    Can any one please help me with the sample ABAP code for this scenario.
    Some more examples for better understanding of the requirement:-
    Data in DSO(Source)            Data in Cube(Target)
    ===================            ===================
    AA1/B1/CCC2/DD2/EEE1            EEE1
    AAA1/BB2/CC1/DDD3/EE2           EE2
    A2/BBB2/CC2/DDD3/EEE5           EEE5
    AA2/BB1/C1/DDD3/EE3             EE3
    A3/B1/CC2/DDD1/EE4              EE4
    Many thanks in advance.
    Regards,
    Prakash
    Please do not dump your code requirements in SDN
    Edited by: Pravender on May 18, 2011 11:37 AM

    Hi,
    You can use the following code :
    Suppose the technical name of the field coming from DSO is ZPAY_SGRP.
    And also for example let me take one record, that is ZPAY_SGRP = AA1/B1/CCC2/DD2/EEE1 .
    My assumption is that there will always be 4 '/'.
    In the field routine write the below code
    data: V1(5) type c,
              V2(5) type c,
             V3(5) type c,
              V4(5) type c,
             V5(5) type c.
    data : VAR1 TYPE /BIC/OIZPAY_SGRP.
    split VAR 1  at '/' into V1 V2 V3 V4 V5.
    result = V5.
    V5 will be having the characters after the last '/' .That is V5 = EEE1.
    Hope the above reply was helpful.
    Kind Regards,
    Ashutosh Singh
    Edited by: Ashutosh Singh on May 17, 2011 3:53 PM
    Edited by: Ashutosh Singh on May 17, 2011 4:17 PM

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

  • Help on Start Routine

    Hello All,
    I cannot determine how to bring only records based on customer master data field =status in the data target ,
    and the rest to delete it in the *start routine*.  Please help.  I am adding my code below. Any help is appreciated.
    DATA: L_field1 LIKE /BI0/customer-field1,
            L_customer LIKE structure-customer.
      LOOP AT DATA_PACKAGE.
        SELECT SINGLE field1 INTO L_field1
         FROM /BI0/customer
          WHERE customer = DATA_PACKAGE-customer
            AND field1= 'status'.
        IF SY-SUBRC NE 0.
            DELETE DATA_PACKAGE.
          ENDIF.
      ENDLOOP.
    Thanks,
    Su

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

  • Help on Start Routine at Transfer Rule.

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

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

  • Help with start routine

    Hi,
    <b>I am new to ABAP.Can anyone help me wih this code</b>
    <b>The following code is in start routine</b>
    LOOP AT DATA_PACKAGE.
    SELECT /BIC/ZPACTGY /BIC/ZMPIINIR FROM /BIC/PZCONDTYP
               INTO IT_ZCONDTYP
               WHERE /BIC/ZCONDTYP = DATA_PACKAGE-/BIC/ZCONDTYP.
    IF ( IT_ZCONDTYP-/BIC/ZPACTGY Eq 'VVR12' OR
              IT_ZCONDTYP-/BIC/ZPACTGY Eq 'VVR13' or
              IT_ZCONDTYP-/BIC/ZPACTGY Eq 'VVR14' or
              IT_ZCONDTYP-/BIC/ZPACTGY Eq 'VVV10' or
              IT_ZCONDTYP-/BIC/ZMPIINIR Eq 'Y' or
              ( IT_ZCONDTYP-/Bic/zcondtyp ge 'Y100'
              and IT_ZCONDTYP-/Bic/zcondtyp le 'Y199' ) ).
         APPEND DATA_PACKAGE.
         ENDIF.
    endselect.
      ENDLOOP.
    <b>what I am trying to accomplish is I want my data which is in the internal table to satisfy the following conditions. and place it in internal table .(or whatever is correct)</b>
    IT_ZCONDTYP-/BIC/ZPACTGY Eq 'VVR12' OR
              IT_ZCONDTYP-/BIC/ZPACTGY Eq 'VVR13' or
              IT_ZCONDTYP-/BIC/ZPACTGY Eq 'VVR14' or
              IT_ZCONDTYP-/BIC/ZPACTGY Eq 'VVV10' or
              IT_ZCONDTYP-/BIC/ZMPIINIR Eq 'Y' or
              ( IT_ZCONDTYP-/Bic/zcondtyp ge 'Y100'
              and IT_ZCONDTYP-/Bic/zcondtyp le 'Y199' ) ).
    <b>and read this from another transfer routine</b>
    CLEAR RESULT.
    READ TABLE IT_ZCONDTYP WITH KEY
    /BIC/ZCONDTYP = COMM_STRUCTURE-/BIC/ZCONDTYP
          BINARY SEARCH.
    IF SY-SUBRC EQ 0.
      RESULT = IT_ZCONDTYP-/BIC/ZCONDTYP.
    ENDIF.
    <b>This is mostly related to BW.So if someone can give their opinion on how to achieve this I will be very grateful.</b>
    thanks,
    Kal

    hi Kal,
    you have to specify what are you going to add to the datapackage internal table (before the append data_package statement).
    hope this helps.
    LOOP AT DATA_PACKAGE.
    SELECT /BIC/ZPACTGY /BIC/ZMPIINIR FROM /BIC/PZCONDTYP
    INTO IT_ZCONDTYP
    WHERE /BIC/ZCONDTYP = DATA_PACKAGE-/BIC/ZCONDTYP.
    IF ( IT_ZCONDTYP-/BIC/ZPACTGY Eq 'VVR12' OR
    IT_ZCONDTYP-/BIC/ZPACTGY Eq 'VVR13' or
    IT_ZCONDTYP-/BIC/ZPACTGY Eq 'VVR14' or
    IT_ZCONDTYP-/BIC/ZPACTGY Eq 'VVV10' or
    IT_ZCONDTYP-/BIC/ZMPIINIR Eq 'Y' or
    ( IT_ZCONDTYP-/Bic/zcondtyp ge 'Y100'
    and IT_ZCONDTYP-/Bic/zcondtyp le 'Y199' ) ).
    <i>DATA_PACKAGE-... = ....
    DATA_PACKAGE-... = ....
    DATA_PACKAGE-... = ....</i>
    APPEND DATA_PACKAGE.
    ENDIF.
    endselect.
    ENDLOOP.

  • 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

    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.

Maybe you are looking for

  • Text Box Entry Validation

    We have a program that once a user enters a character the cursor jumps to the next entry box, they do not have to press Enter.  For example, we want the learner to type in the character 'H' for Home or 'B' for Business (or 'h' or 'b') for the type of

  • My vibrate isn't working on my iPhone 5s after ios7 install

    Is anyone from apple going to address this issue with multiple 4s users not having vibrate working after the iOS7 update?

  • LR won't load catalog

    Hello, After moving my LR catalog to a new internal hard drive, I am no longer able to load my catalog. When I run it, I get the following warning: "The Lightroom catalog folder D:\Location cannot be used because the folder does not allow files to be

  • TestStand cannot distinguish between capital and small letters

    I've made an update from some Step Types that I've created in a computer into the TestStation. The name of all the files inside those Step Types are written in capital letters, but when I try to edit the Step Type under TestStand, this one tells me t

  • JMF vs JavaTV

    Hi, I was hoping somebody out there could help me with a little problem I'm having. I want to be able to simultaneously display multiple images from a TV card (Basically I want to be able to display 4 channels simultaneously), would anybody have any