ABAP in update rule

I have one code in the start routine of the update rule which i have copied below .Just to fetch 96000 record , the system is getting hanged.
select
      /bic/zemployee
      /bic/zevent
      /bic/zmatlsamp
      material
      /bic/zcustomer
      postal_cd
      time
      into table t_seq_ind
      from /bic/azfw_o0200
        for all entries in t_cardnum
        where /bic/zemployee = t_cardnum-/bic/zemployee.
t_cardnum is an internal table  & /bic/azfw_o0200 is an oDS table which have only 96000 records.How to increase the performance for this query
Reagdrs,
Anita

Hi,
No need to use that FM. You can create it from the EDIT screen only.
Refer the link:
Re: How to create Secondary Index?
Re: ODS secondary index creation
With rgds,
Anil Kumar Sharma .P

Similar Messages

  • ABAP code (Update rule)

    Hi Gurus,
    I need to load data from R/3 to infocube A. In update rule  I need to do a small calculation that is A.KF1  x  B.KF1  =  A.ZKF1. B.KF1 is a key figure in Infocube B. In update rule I need to read Infocube B and get B.KF1 and multiply with A.KF1(Infocube A) to fill the value in A.ZKF1. Please help me how to write ABAP code to do this calculation.
    Thanks
    Liza

    Liza,
    Check whether the function module RSDPL_CUBE_DATA_READ which will help  to read data from cube B.
    I guess, APD will be useful for your scenario.
    Thanks
    Viswa

  • ABAP in Update rules

    I have an item level ODS object which contains records like this:
    Header
       Item 1
       Item 2
    The header record contains the header status and the items contain the item status.
    I want to add an infoobject to the ODS to hold the header status at item level too.
    I am thinking that the best thing to do would be to modify the update rules to get the header status from the header record rather than modifying the datasource as I already have the data.
    Problem is I am not an ABAPer, can anybody help me with how I can retrieve the header record in the update rules?

    hi Stuart,
    my suggestion is do this in crm side, in user exit zxrsau01
    data : l_s_comp like [0crm_complaints_i extract structure],
           l_tabix like sy-tabix.
    case i_datasource.
    when '0crm_complaints_i'
          l_tabix = sy-tabix.
    if item, item guid not blank
          if not l_s_comp-item_guid is initial.
    look from header data, from crmd_orderadm_h ?
          select [headerstatus] into l_headerstatus
          from crmd_orderadm_h.      
            if sy-subrc = 0.
              l_s_comp-[header status] = l_headerstatus
            endif.
          endif. 
          modify c_t_data from l_s_comp index l_tabix.
    endcase.

  • ABAP Runtime error while activating Update rules.

    Hi Gurus,
    Actually we are in NW 2004's SP9.
    While activating the update rules of cube "0PY_PPC01" it is going to ABAP runtime error. It is giving the key words like "MESSAGE_TYPE_X"
    "%_T005K2" or "INSTANTIATE". And i apply NOTEs also i am unable to fix it.
    Can any one give  correct NOTE number that can fix it or any suggestions.
    Thanks in advance.
    Thanks
    Raju.k

    Hi Sven,
    Now we are also in SP11, But the thing is all the other UR are working fine Except
    this UR. Even there is no perticular NOTE number for this.
    Thanks
    Raju.k

  • ABAP assistance - start routine logic in update rule

    I have used an existing update rule and have based my logic around the same.  The purpose of the rule is to look up customer master data and get a subset of customer numbers from the transaction records so that the values for customer number from the transactional data will not be updated if it does not match with existing master data customer numbers.
    The loads are full and we drop the data before we load.
    I have listed the logic below (the number at the front is to be considered as the line number) and a list of open questions that I have thereafter:
    Start routine logic:
    1  DATA: l_index LIKE sy-tabix.
    2  DATA: BEGIN OF ls_customer,
    3        customer TYPE /BI0/OICUSTOMER,
    4        objver TYPE RSOBJVERS,
    5     END OF ls_customer,
    6      lt_customer LIKE TABLE OF ls_customer.
    7  REFRESH: lt_customer.
    8  LOOP AT DATA_PACKAGE.
    all customers from data package
    9    ls_customer-custno = DATA_PACKAGE-custid.
    10  ls_customer-objver = 'A'
    11    APPEND ls_customer TO lt_customer.
    12   ENDLOOP.
    12  SORT lt_customer.
    13  DELETE ADJACENT DUPLICATES FROM lt_customer.
    14   IF NOT lt_customer[] IS INITIAL.
    15    SELECT /BI0/OICUSTOMER RSOBJVERS
    16      FROM /BI0/PCUSTOMER
    17      INTO CORRESPONDING FIELDS OF TABLE lt_customer
    18      FOR ALL ENTRIES IN lt_customer
    19      WHERE ls_customer-custno = DATA_PACKAGE-custid
    20      AND ls_customer-objver = 'A'
    21    SORT lt_customer BY customer ASCENDING                    
    22  ENDIF.
    Questions
    Line
    1 - what is the purpose of this line? What is it that is being declared
    2 - in some code I have seen this line with OCCURS 0 at the end what does this mean with and without the term?
    4 - I am using the Data Element name is this correct or should I use the field name?
    3 - 5 here I declare an internal structure/table is that correct?
    6 - here I declare a work area based on the internal table is that correct?
    7 - What would happen if I avoided using the REFRESH statement?
    8 - 12 - Is this syntactically correct, I am trying to get a set of data which is the customer numbers which match the master data customers and the master data record is án active version and than appendíng to the work area?
    13 - My understanding is this will reduce the number of records in the work area is this correct and needed?
    14 - 22 I am trying to identify my required set of data but feel I am repeating myself, could someone advise?
    Finally what logic would I actually need to write in the key figure object, could I use something like:
    Result = lt_customer.
    Thanks
    Edited by: Niten Shah on Jun 30, 2008 8:06 PM

    1. This line is not required
    2. OCCURS 0 is the OLD way of defining an internal table with that structure.  As it is, it just defines a flat structure.
    3. Data element is usually best
    3-5 Yes
    6. No.  Here you are declaring a table of the type of the flat structure.  Just as the ABAP says!
    7. Nothing.  But by putting this in, you ensure that you know the state of the table (empty) before you start looping through the data package
    8-12. You can tell if it is syntactically correct by pressing Ctrl-F2 when in the editor.  Looks ok.
    13. Ensures your list of customers contains no duplicated.  The code up to this point is building a list of all the unique customers in the data package.
    14-22. Goes to the database and brings back ONLY those customers which are found in the master data.  Looks ok.
    This is a start routine (that's why you've got a data package).  You don't use result.  You should update the datapackage.  But this you haven't done.  Double click on the table name /BIC/PCUSTOMER to get the correct field names.
    So you have to loop through the data package again, and check if the customer in the datapackage is lt_customer.  If it is, fine, otherwise you blank it and report an error, or set an error message or whatever.
    I wouldn't do it like this.  I'd do something like this:
    STATICS: st_customer TYPE HASHED TABLE OF TYPE /bi0/oicustomer
                                  WITH UNIQUE KEY TABLE_LINE.
    * st_customer retains its value between calls, so only populate if empty
    * In one run of the infopackage, this will mean you do only one read of
    * the master data, so very efficient.
    IF st_customer IS INITIAL.
      SELECT customer FROM /BI0/PCUSTOMER
                              INTO TABLE st_customer
                              WHERE objvers EQ 'A'. " Only active values
    ENDIF.
    * Go through data package
    LOOP AT DATA_PACKAGE.
    * Check whether the customer exists.
      READ TABLE st_customer TRANSPORTING NO FIELDS
                  WITH TABLE KEY table_line = DATA_PACKAGE-custid.
      CHECK sy-subrc IS NOT INITIAL.
    * If you get here, the customer isn't valid.  So I'm just setting it blank
      CLEAR DATA_PACKAGE-custid.
      MODIFY DATA_PACKAGE. " Updates the datapackage record
    ENDLOOP.
    Even this is not fully optimised, but it's not bad.
    I strongly suggest that you get yourself sent on the basic ABAP programming course if you're going to do a lot of this.  Otherwise, read the ABAP documentation in the help.sap.com, and, from the editor, get the cursor on each ABAP keyword and press F1 to read the ABAP help.
    matt

  • ABAP code in update rules to convert the date

    Hi,
    Could any one send me the ABAP code that is written in the update rules to convert the date (DD/MM/YYYY  -- lenght 10) to YYYYMMDD ---  length 8  format.
    Also please let me know where I should write this code; while creating update rules or while creating infosource.
    Thanks,

    Hi Bharath,
    Hi Bharath,
    I suggest you do the conversion of dates in the transfer rules. Here is the correct code you need:
    * Assuming the source data field is called MYDATE
    * Place the ff. in the routine in the transfer rules:
    concatenate tran_structure-mydate+6(4) tran_structure-mydate+3(2) tran_structure-mydate(2) into result.
    replace MYDATE with the name of the source field (10 chars) in the transfer structure. Hope this helps.

  • ABAP objects for transfer/update rules - does this apply to include stateme

    I have a question about the new requirement for the code in the update/transfer rules to be written in ABAP Objects standards.  Does this still apply if in your update rules you using include programs?  Does this mean that when we upgrade we will have to follow the ABAP Objects standards (ie no header lines)?

    Routines will method based.
    In addition to what Chetan has sent, check this how to also.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/6090a621-c170-2910-c1ab-d9203321ee19
    Ravi Thothadri

  • 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

  • URGENT !!! - ABAP code in update rule

    Friends,
    With my limited knowledge in ABAP, I need some help from the forum.
    I need to create a routine in update rule to capture 'date of last GR against a PO delivery schedule'. Let's say
    PO # 1234
    IT # 10
    SCL # 1
    There are multiple partial deliveries against SCL # 1 above and I have to capture the last delivery date and subsequently the last invoice date. If I try to set the rule to capture the 'posting date' based of 'transfer type'  - the GR date field gets overwritten by the last invoice date (the date of last activity). My requirement is to separate the two i.e.
    1) Date of last GR against PO - Item - SCL line
    2) Date of lasr INV against PO - Item - SCL line
    Can any one help me with the code ???
    Thanks,
    AK

    Hi,
    check the following link, gives an example of an update routine.
    http://help.sap.com/saphelp_nw70/helpdata/en/80/1a64fae07211d2acb80000e829fbfe/frameset.htm

  • Update Rules in ABAP to consolidate two InfoSources into one ODS?

    Hello experts,
    I want to solve the following problem with ABAP update rules (I am a novice in ABAP):
    In an Oracle DB I have two tables TRANSACTIONS and PARTICIPANTS with an 1:n relationship:
    One or many PARTICIPANTS can be assigned to one TRANSACTIONS and
    one TRANSACTION can be assigned to one PARTICIPANT.
    I want an ODS that contains TRANSACTIONS with the number of male and female PARTICIPANTS of each transaction.
    So I created two InfoSources each representing one of the above tables:
    IO_TRANSACTION with COMM_STRUCTURE:
    TRANS_ID
    TRANS_DATE
    TRANS_STATE
    IO_PARTICIPANT with COMM_STRUCTURE:
    PARTIC_ID
    PARTIC_TYPE (1=male and 2=female)
    TRANS_ID
    Now I want to consolidate all male participants into the data field PARTIC_M
    and all female participants into the data field PARTIC_F of the following ODS:
    Key fields:
    TRANS_ID
    TRANS_DATE
    TRANS_STATE
    Data fields:
    PARTIC_M (number of male participants)
    PARTIC_F (number of female participants)
    I tried it with the following lines of ABAB Code in the ABAP routine
    for the datafield PARTIC_M:
    IF COMM_STRUCTURE-/BIC/PARTIC_TYPE = 1.   " 1 is the value for  "male"
       RESULT = 1.
    ELSE.
       RESULT = 0.
    ENDIF.
    But after loading both InfoSources into the ODS the fields PARTIC_M and PARTIC_F are empty!!
    Do I have to do some kind of joint in a start routine in order to connect Participant Information with a specific transaction?? How?
    Thanks a lot
    Of course, solutions will be rewarded
    Axel

    Hi Venkat,
    Thanks for the hint with the common key fields.
    My problem is, that both tables have only the field TRANS_ID in common.
    So when I update TRANSACTIONS with the three Key fields TRANS_ID, TRANS_DATE and TRANS_STATE
    and PARTICIPANTS with the Key field TRANS_ID into the ODS I get data like this:
    TRANS_ID, TRANS_DATE, TRANS_STATE, PARTIC_M, PARTIC_F
    TR01                                                                        1              1
    TR02                                                                        0              3
    But I also need the fields TRANS_DATE, TRANS_STATE to be filld with data!
    any suggestions?
    Axel

  • ABAP needed: New Value/Old Value in Update Rules

    Hi all
    I'm updating some attributes in IObj by ABAP routine. Is it possible to get not only new value of attribute but the old one to compare them?
    Is it possible to get others attribute old and new values?
    I'll illustrate it with example.
    Say, IObj has 3 attributes:
    0ACC_GRP
    0DT_FROM
    0DT_TO
    if NEW value of 0ACC_GRP <> OLD value of 0ACC_GRP then
    new 0DT_FROM = SYSDAT
    new 0DT_TO = old 0DT_FROM
    else
    new 0DT_FROM = old 0DT_FROM
    new 0DT_TO = old 0DT_TO

    My case quite simple I guess.
    I got 0CUSTOMER infoobject and appended it with several time-dep attributes. After it my Update rules were deactvated.  I got error message with prompt to fill out FROM_DATE, TO_DATE as key fields in every attribute (time-dependable and none time-dependable) while was trying re-activate Update Rules.
    So, what's wrong with that? What I supposed to do with all those to/from date key fields  in my Update Rules??
    Edited by: Gediminas Berzanskis on Jul 2, 2008 3:44 PM

  • Update Rule ABAP

    Hello Gurus
    I am writing a routine in update rules DSO1->DSO1
    The idea is to populate price KFs in DSO1 that are blank with most recent populated values.
    Are there any clever functions or ABAP I can use here?

    SELECT * FROM DSO1 INTO table delete.
      sort delete by PRODUCT.
      loop at DATA_PACKAGE.
        idx = sy-tabix.
        read table delete with key PRODUCT =
        DATA_PACKAGE-PRODUCT binary search.
        if sy-subrc <> 0.
          DELETE DATA_PACKAGE index idx.
        endif.
      ENDLOOP.

  • Abap Code help in update rule

    Hi Gurus,
    I have  a requiement, that is if there are 5 line items with in a document and each one has diffeerent tax jurisdiction code, then we should be showing only one tax jurisdiction code for a document. Line items are not displayed in report. The condition to pick up tax jurisdiction code is the one which has least ending zeros among all the lime items with in a document.
    Supppose
    Doc1 Item Tax Jurisdiction code
    1800000002 1 CNQC00000000000
    1800000002 2 CNQC00000000000
    1800000002 3 CN0000000000000
    1800000002 4 CNQC00000000000
    1800000002 5 TXJOHNCLEBUR000
    So here the value of Tax Jurisdiction code is TXJOHNCLEBUR000 as it has least ending zeros compared to other values with in a document.
    Any help how to use the string function and acheive the desired result.
    Thanks,
    Raj.

    Hi Anand,
    Thanks for the reply. we don't expect any non-zeros after seeing first zero. Now i have added another z object which will contain only least zeros for a doc. What I am doing is now after loading the data into the cube from ods  i am doing loop back and updating the new z object. Below is the code I am trying to do
    TABLES: /BIC/AZFGLO10100.
    Defining an internal table as ods table****
    Types: BEGIN OF ITAB_01,
    doc_no LIKE /BIC/AZFGLO10100-AC_DOC_NO,
    item_no LIKE /BIC/AZFGLO10100-ITEM_NUM,
    taxjur LIKE /BIC/AZFGLO10100-TAXJURCODE,
    length like num,  ***** this will hold the length of the zeros
    END OF ITAB_01.
    loading the data from active ods table into defined internal table*****
    select AC_DOC_NO ITEM_NUM TAXJURCODE  from /BIC/AZFGLO10100 into table
      Itab_01 where AC_DOC_NO = /BIC/AZFGLO10100-AC_DOC_NO and
      item_num = /BIC/AZFGLO10100-ITEM_NUM.
    sort itab_01 doc_no item_no
    now I want to use code too populate the vlaue of length field in internal table (which shows how many zeros a tax jurisdiction code has for every corresponding line item)
    then in the update rule of z tax jurisdiction i will wirte a routine such that
    select taxjur into result from itab_01 where doc_no = COMM_STRUCTURE-doc_no and length = min(length).
    now I have one more doubt , the number of items in a document will be varying so how to takecare of this...
    If possible can you please provide me with the abap code that you have mentioned in earlier post.
    Any more help on this is really appreciated.
    Thanks,
    Raj

  • Need hints to bring BC400(ABAP) knowledge to BW update rules/routines.

    Hi,
    I have just completed the BC400 (ABAP) course at SAP but the instructor had no clue about BW.
    From se80, he thought how to create packages, programs, functions modules, classes/Interfaces, etc. but whenever, I asked how these fit into the BW update rules and transfer rules, he said he knew nothing about BW.
    For example, how do I bring in a program written in se80 into my update rule or transfer routine which updates and ODS or cube?
    i.e. The main reasoning for learning this BC400(ABAP) is to be comfortable in writing update rule or transfer routine to update ODS/Cubes in BW but the instructor failed me in making the link between the ABAP class and BW.
    Can you give me some guide on this?
    Can I work in se80 as I was taught and bring codes from there to update a cube?
    i.e. if I need to write an update routine to update a cube from an ODS, can this be done in se80 (on BW)
    I will appreciate any guidelines to bring in my new found knowledge to the BW environment.
    Thanks

    Most Bw transformations are already includes inside programs or cmods or BTEs
    By double cliking on start routines and end routines it already takes you into the ABAP enviroment
    Have a look at the sappress book - user exits and BADIs in BW (it's not a brillaitn book by any means - it's just about passable and is short on detail - but it will get you a head start)

  • ABAP porgram in update rule-Job stats

    Hi All,
    I have an ABAP program that is in one of the update rules from source ODS to destination ODS. Source ODS has 20million records. When we are loading the records to destination ODS , Is there any way I can find howmuch time will take to process 1 record and  also when it is running how do I know howmany records it has processed or  howmany  yet to process ? I have tried with SM50 but not able to find much useful information?
    Please help me and if you have any documents please send it to [email protected]
    Regards
    Vennela

    hi Shravani,
    try using this code.. ths is done as a report, you will have to change the fields.
    **get the first 4 chars of the date. date is stored as YYYYMMDD format internally. check with the system year. sy-datum has the system date
    if comm_structure-stat_date+0(4) = sy-datum+0(4).
    **get the month i.e the 5 and 6th characters from the date and compare them
    if comm_structure-stat_date+4(2) > sy-datum+4(2).
      result = 0.
    **ELSE. .... you havent mentioned what u want to do if the month is lesser or equal to the system month
    endif.
    else.
    **Get the first 6 chars of the statistical date.. i.e the year and month.
      result = comm_structure-stat_date+0(6).
    endif.
    Regards
    Sujai

Maybe you are looking for

  • Excise Invoice Error

    Hi Guru's While creating excise invoice using tcode J1IIN wrt commercial invoice (created with vf01),                                                           I am getting an error Field Assign. is a required field for G/L account SELC 215210 Messag

  • Inappropriate mouse event coordinates in the WebKit of HTMLLoader/StageWebView

    Hi, We have a desktp application which incorporates an HTMLRichTextEditor (implemented in HTML/JS and loaded into AIR). We have run into a big problem with text selection though. It seems that the both the HTMLLoader and the StageWebView are passing

  • Uploading Ipod on a new itunes

    My computer crashed and I got everything wiped off of it so I had to reload iTunes. Can I not keep all my music already on my iPod plus add more? It says that my iPod can only be synced with one library at a time, but that's really what I;m doing. Am

  • Application Engine and Markets

    Does anyone know how Application Engine chooses which market to execute? On each section in an Application Engine program, the developer can choose to limit a section to a specific database platform or a specific market. PeopleBooks documents how it

  • How can we remove a specific hyperlink using Acrobat X Pro ?

    How can we remove a specific hyperlink using Acrobat X Pro ?