Cross entity BRF rules to update table UI elements

Hello , I am trying to write a derivation using a cross entity rule that will update table UI element value. I have about 50 different rules to be created. Rule Example : Based on material type, derive the value of Sales organization and Plant.
I have the cross entity BADI implemented. I am able to achieve the cross entity derivation for single elements, but anything in table, I am not able to get those updated.
Please advice.

Great that it works. However, you talk about cross-entity and BRF+. These are two different things and I'm afraid you are confusing them. Using the standard BRF+ derivation rules, you can't derive keys of entities. So, you can't default a plant for a given material type using the BRF+ derivation function.

Similar Messages

  • GRC10- HR Trigger BRF+ rule error

    Hi,
    We are facing an error in HR trigger. The BRF+ is configured as per the note Note 1591291 - GRC 10.0 - HR Trigger configuration.
    The BRF+ rule has decision table which satisfies the condition for new hire. The infotype: 0105 and subtype: 0001
    After the new hire event the trigger is activated in GRC system but the log gives a following error Message:
    Error occurred during the processing of Rule 'Rule_1'
    Error occurred during the processing of Loop 'Loop_1'
    Error occurred during the processing of Rule 'Rule_2'
    Error occurred during the processing of Decision Table 'Decision_Table_HR'
    No match found for the given context (DECISION_TABLE_HR)
    Rules are not satisfied for Employee ID 00000019
    The rules configured are as per the SAP guide.
    1.     How do you analyze the error in the BRF+ rules
    2.     Have anyone come across similar situation
    Regards,
    Prasad Chaudhari

    Hi Prasad
    I am also getting the same error. I have configured the decision table exactly as per the SAP note, and even simplified my rules to only include the CREATE function.
    My SLG1 log picks up the same error.
    Did you find a fix for this on your side ?
    Please help.
    Rgrds
    Sameel

  • MDG Cross entity validation using enrichment spot is not executed.

    I have configured the enrichment sport for cross entity validations and used BRF to validate the data, but looks like validations are
    not executed. I have the check activated for the step in the configuration and I can see my custom class is being picked in method GET_ENRICHMENTS of class CL_USMD_DQ_ACCESS_ENRICHMENT for that request type and step. I have flag relevant  selected and option “Execute Always” (will change this to “Execute when data changed).
    I am trying to figure out if SAP MDG standard code will execute my custom class code or not. I had put break point in my custom class constructor and this is called when an instance for enrichment is created in method GET_ENRICHMENTS of class CL_USMD_DQ_ACCESS_ENRICHMENT. However my code in below method is not executed (and hence BRF is not called)
      IF_USMD_ENRICHMENT_FEEDER~GET_ADAPTER_DATA
      IF_USMD_ENRICHMENT_FEEDER~IS_RELEVANT
    Now I am trying to figure out a place from where these enrichment class methods will be executed. I feel this will be from EXECUTE_ENRICHMENT
    of class CL_USMD_DQ_ACCESS_ENRICHMENT. But this method is also not executed when I hit on Check button. Am I looking wrong standard class?
    Is there anything I am missing in configuration? Or we need to implement any SAP note? I tried to find one, but no luck.

    Hello, I am not using cress entity BADI for Validation. I am using this BADI for cross entity derivations and they are working fine.
    I had a requirement to do cross entity validations, and I have rules written using the BRF+.
    I had used enrichment sport functionality to have a custom class used to call BRF functions and prepare the context with required entity data.
    Validations are supposed to happen based on the enrichment spot defined and the configuration for that enrichment sport on the process step level. This is not happening. let me know if you need more information on it,

  • Unique Key Violation error while updating table

    Hi All,
    I am having problem with UNIQUE CONSTRAINT. I am trying to update a table and getting the violation error. Here is the over view. We have a table called ActivityAttendee. ActivityAttendee has the following columns. The problem to debug is this table has
    over 23 million records. How can I catch where my query is going wrong?
    ActivityAttendeeID INT PRIMARY KEY IDENTITY(1,1)
    ,ActivityID INT NOT NULL (Foreign key to parent table Activity)
    ,AtendeeTypeCodeID INT NOT NULL
    ,ObjectID INT NOT NULL
    ,EmailAddress VARCHAR(255) NULL
    UNIQUE KEY is on ActivityID,AtendeeTypeCodeID,ObjectID,EmailAddress
    We have a requirement where we need to update the ObjectID. There is a new mapping where I dump that into a temp table #tempActivityMapping (intObjectID INT NOT NULL, intNewObjectID INT NULL)
    The problem is ActivityAttendee table might already have the new ObjectID and the unique combination.
    For example: ActivityAttendee Table have the following rows
    1,1,1,1,NULL
    2,1,1,2,NULL
    3,1,1,4,'abc'
    AND the temp table has 2,1
    So essentially when I update in this scenario, It should ignore the second row because, if I try updating that there will be a violation of key as the first record has the exact value. When I ran my query on test data it worked fine. But for 23 million records,
    its going wrong some where and I am unable to debug that. Here is my query
    UPDATE AA
    SET AA.ObjectID = TMP.NewObjectID
    FROM dbo.ActivityAttendee AA
    INNER JOIN #tmpActivityMapping TMP ON AA.ObjectID = TMP.ObjectID
    WHERE TMP.NewObjectID IS NOT NULL
    AND NOT EXISTS(SELECT 1
    FROM dbo.ActivityAttendee AA1
    WHERE AA1.ActivityID = AA.ActivityID
    AND AA1.AttendeeTypeCodeID = AA.AttendeeTypeCodeID
    AND AA1.ObjectID = TMP.NewObjectID
    AND ISNULL(AA1.EmailAddress,'') = ISNULL(AA.EmailAddress,'')

    >> I am having problem with UNIQUE CONSTRAINT. I am trying to update a table and getting the violation error. Here is the over view. We have a table called Activity_Attendee. <<
    Your problem is schema design. Singular table names tell us there is only one of them the set. Activities are one kind of entity; Attendees are a totally different kind of entity; Attendees are a totally different kind of entity. Where are those tables? Then
    they can have a relationship which will be a third table with REFERENCES to the other two. 
    Your table is total garbage. Think about how absurd “attendee_type_code_id” is. You have never read a single thing about data modeling. An attribute can be “attendee_type”, “attendee_code” or “attendee_id”but not that horrible mess. I have used something like
    this in one of my busk to demonstrate the wrong way to do RDBMS as a joke, but you did it for real. The postfix is called an attribute property in ISO-11179 standards. 
    You also do not know that RDBMS is not OO. We have keys and not OIDs; but bad programmers use the IDENTITY table property (NOT a column!), By definition, it cannot be a key; let me say that again, by definition. 
    >> ActivityAttendee has the following columns. The problem to debug is this table has over 23 million records [sic: rows are not records]<<
    Where did you get “UNIQUE KEY” as syntax in SQL?? What math are you doing the attendee_id? That is the only reason to make it INTEGER. I will guess that you meant attendee_type and have not taken the time to create an abbreviation encoding it.
    The term “patent/child” table is wrong! That was network databases, not RDBMS. We have referenced and referencing table. Totally different concept! 
    CREATE TABLE Attendees
    (attendee_id CHAR(10) NOT NULL PRIMARY KEY, 
     attendee_type INTEGER NOT NULL  --- bad design. 
        CHECK (attendee_type BETWEEN ?? AND ??), 
     email_address VARCHAR(255), 
    CREATE TABLE Activities
    (activity_id CHAR(10) NOT NULL PRIMARY KEY, 
    Now the relationship table. I have to make a guess about the cardinally be 1:1, 1:m or n:m. 
    CREATE TABLE Attendance_Roster
    (attendee_id CHAR(10) NOT NULL --- UNIQUE??
       REFERENCES Attendees (attendee_id), 
     activity_id Activities CHAR(10) NOT NULL ---UNIQUE?? 
      REFERENCES Activities (activity_id)
     PRIMARY KEY (attendee_id, activity_id), --- wild guess! 
    >> UNIQUE KEY is on activity_id, attendee_type_code_id_value_category, object_id, email_address <<
    Aside from the incorrect “UNIQUE KEY” syntax, think about having things like an email_address in a key. This is what we SQL people call a non-key attribute. 
    >> We have a requirement where we need to update the ObjectID. There is a new mapping where I dump that into a temp table #tempActivityMapping (intObjectID INTEGER NOT NULL, intNewObjectID INTEGER NULL) <<
    Mapping?? We do not have that concept in RDBMS. Also putting meta data prefixes like “int_” is called a “tibble” and we SQL people laugh (or cry) when we see it. 
    Then you have old proprietary Sybase UODATE .. FROM .. syntax. Google it; it is flawed and will fail. 
    Please stop programming until you have a basic understanding of RDBMS versus OO and traditional file systems. Look at my credits; when I tell you, I think I have some authority. 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • How to update a table of contents when the feature "update table of contents" is unavailable?

    Hello folks,
    I've been struggling all morning with this issue and am completely desperate.
    First, some info:
    - I am making a spanish versions of an english documents: everything in the original doc was then edited, including TOCs. What I got at first, was a first spanish document already filled with spanish content.
    - I was not the primary creative of the document I'm workin on and am unable to get in touch with whoever that can be.
    - My document is a 200 pages text only document, with 12 chapters and, at the beginning of each chapter, a specific TOC for that very chapter.
    - Inside each chapter, there are only Sections and Subsections, no other style. Those are the two levels in the TOCs.
    - There is also a General TOC at the beginning of the document: that one only shows the Chapter names and the page number where to locate them.
    My problem:
    - Somewhere along the way, from one doc to another, the TOCs stopped to update the page numbers automatically.
    - Now I have sections and subsections that are shown in one page (for instance 204) but they actually are on page 135.
    - When I try to update the TOCs, I stand on the TOC itself as I was told in many tutorials, but the "update table of contents" feature is unavailable, even in the main TOC at the very beginning of the doc.
    It is like if I wasn't standing in the actual TOC, but there is no actual TOC anywhere that I could refer to.
    What can I do? I am changing the wrong page numbers manually but, of course, that is not ideal... and it may become more and more tricky while I keep producing new documents each based on the previous one.
    Any help will be much appreciated.
    Warm regard from sunny Paris, France!
    Sasha

    You've just confused me.
    My understanding of how this is set up is that either:
    This is a book, and there is a master TOC that includes all book documents and a document-specific TOC in each component file, or
    This is a single file and there is one master TOC that includes all sections and a section-specific TOC that includes only the individual section.
    In the first case, I think you would want two TOC styles set up, one that includes the chapter heads (if I understood how you said this worked) for the for the master, and you would include all docs in the book when you generate it, and a second style for the individual chapters, with the subheadings you want to include.
    In the second case, it would be similar, but instead of only one style to cover the section TOCS, I think you would need to create a unique set of pargraph styles for the headings in each section (they can all be the same format, based one section, just with unique names), and then make a TOC style for each section that includes only the styles from that section.
    OK,  wait a sec. I just reread what you said: "Another thing: when the numbers are "linked" and updating well, they  display indide a little box. Not a text box, but a kind of little frame  around the numbers. That frame makes it imposible to delete just one  number: when the TOC says that Section 6.1 is in page 135, for example,  you cannot delete just the 5, it deletes, not just the 3 numbers, but  also the doted tab."
    I think these are NOT normal TOCs created by using Layout > TOC (but you could replace them with ones that are, if you set up your styles properly and the text you want to include is appearing on the pages). Those little boxes you mention sound like cross-references, which should update automatically without any intervention at all. Unfortunately, cross-refs can be flakey, especially if they point to another document. I'd open the cross-refs panel and see if you need to recreate a bunch of links.

  • Cross company stock transfer, in which table "stock in transfer CC"

    Dear Gurus,
    When I do cross company stock transfer, in which table quantity for "stock in transfer CC" will get updated?
    Rgds
    Sar

    Hi there
    Just with th report transaction MB5T
    I think your purpose will be solved using that report
    just check the flag cross company code in the initial screen
    *the qty gets updated in the table MSEG feild MENGE.*
    Reward if usefull
    Sujoy
    Edited by: SUJOY KUMAR PAL on Feb 15, 2008 6:07 AM

  • Is it possible to have business rules as a table

    Hello Friends,
    I have an application where in which I had altogether some x procedures, y fucntions and z triggers .
    Right now I have implemented all the business rules in the procedures, triggers , and fucntons. Is it possible to have
    the implementatkon of business rules as a table so that i can use the table as a rules engine .
    I have done with java technologory usaing the business rules as a seperate external file and reading the file for business rules. How about oracle is it possible. If yes can any one give a scenario how i can implement.
    thanks/kumar

    As posted, your whole procedure could be replaced with:
    procedure update_paycheck_deductions is
       cursor c1 is select * from MINC ;
       cursor c2 is select * from FINC ;
       v_flag_boolean boolean := false;
       v_famid number ;
    BEGIN
       for i in c2 loop
          for j in c1 loop
             if ( i.famid = j.famid ) then
                v_flag_boolean := true;
                v_famid := j.famid;
             end if ;
          end loop ;
          if ( v_flag_boolean = true ) then
             update FINC set famtfedx = 0 WHERE famid = v_famid ;
             update FINC set fgovretx = 0 WHERE famid = v_famid ;
             update FINC set fpripenx = 0 WHERE famid = v_famid ;
             update FINC set frrdedx = 0 WHERE famid = v_famid ;
             update FINC set fsltaxx = 0 WHERE famid = v_famid ;
          end if;
          v_temp_sum_anfedtx := 0;
          v_temp_sum_angovrtx := 0;
          v_temp_sum_anprvpnx := 0;
          v_temp_sum_anrrdedx := 0;
          v_temp_sum_ansltx := 0;
       end loop;
    end;Since none of the j.column != null and predicates will ever be true. This is roughly equivalent to your code:
    SQL> WITH t AS (
      2     SELECT 10 amount, 'Y' col2 FROM dual UNION ALL
      3     SELECT null, 'Y' FROM dual UNION ALL
      4     SELECT 25, 'N' FROM dual)
      5  SELECT amount, col2, CASE WHEN amount != NULL and
      6                               col2 != 'N' THEN amount
      7                          ELSE 0 END eval_amount
      8  FROM t;
        AMOUNT C EVAL_AMOUNT
            10 Y           0
               Y           0
            25 N           0This would simplify Toon's merge statement to:
    merge
    into FINC f
    using (select distinct j.famid, 0 amount
           from MINC j) m
    on (f.famid = m.famid)
    when matched then
    update set f.famtfedx = m.amount
              ,f.fgovretx = m.amount
              ,f....      = m.amount
              ,f....      = m.amount
              ,f....      = m.amountWhich could be further simplified to:
    update finc
    set famtfedx = 0,
        fgovretx = 0,
    where famid in (select famid from minc)Whiich strikes me as an odd business rule, specially for one dealing with (apparently) payroll.
    I won't go into the fact that you will scan every record in once for every record in minc. I hope these are not large tables.
    I have seen a number, and even worked on a a couple of payroll systems based on "business" rules in tables to avoid putting the rules in code. None of them were very good and perfomance tended to lag when there were more than a few people to pay.
    You need to explain a lot more about what sort of business rules you want to put into tables.
    John

  • Load rule to update alternate hierarchy with shared members more than once

    I have a aso cube with an alternate hierarchy that is not stored because the shared members appear more than once. Below is how my alternate hierarchy looks.
    Dept
    Class
    VolumeLevel
    StoreNum
    where StoreNum is the shared member.
    I build the cube using eis every weekend. The VolumeGroup changes everyday, so I was thinking of using a sql load rule to update the outline everyday. Assuming that the data and the aggregation does not get cleared. Is it possible to do it using sql load rule?
    Thanks,

    You can check here if you are satisfying the conditions for creating shared members under the Hierarchy (refer to Alternate Hierarchies). Plz note that rules for shared members are different in ASO world.
    http://docs.oracle.com/cd/E17236_01/epm.1112/esb_dbag/frameset.htm?acrtapdb.html
    Otherwise there is no reason why you should not be able to create a shared member.
    I am able to create a hierarchy using a sample file like this ->
    EN_MAIN, EN_500000
    EN_500000, EN_49999
    EN_ALT, C_500000
    C_500000, EN_49999
    ENTITY (Multiple Hierarchies Enabled)
    |-EN_MAIN (Stored)
    |--EN_500000
    |---EN_49999
    |-EN_ALT (Stored)
    |--C_500000
    |---EN_49999 (Shared)
    The rule file has only "Allow Property Changes" on.
    Thanks,
    Sunil

  • Bad update table?

    Hi
    I have in FORM code:
    UPDATE Z_TABLE SET COL1 = 'value' WHERE COL2 = var
    And in this program is also many inserts and BDC codes.
    After execute all PERFORM is command  COMMIT WORK AND WAIT.
    Problem is only in update table Z_TABLE. Some rows in database don't have updated
    values.
    It is possible that this error exists because FORM is executed many times ?
    If I change this code to the one command: UPDATE Z_TABLE from itab, this repaire
    my all updates or maybe this is work the same like single record UPDATE?

    UPDATE dbtab - source
    Syntax
    ... { {SET set_expression [WHERE sql_cond]}
        | {FROM wa|{TABLE itab}} }.
    Alternatives:
    1. ... SET set_expression [WHERE sql_cond]
    2. ... FROM wa
    3. ... FROM TABLE itab
    Effect
    The specifications in source define which rows and columns are changed. Either individual columns are changed using the addition SET or entire rows are overwritten using the addition FROM.
    After FROM, either a non-table-type data object wa or an internal table itab can be specified. The content of these objects determines - on the one hand - which row(s) is/are changed, and
    - on the other hand - which values are used to overwrite the row(s).
    Alternative 1
    ... SET set_expression [WHERE sql_cond]
    Effect
    After the addition SET, the changes are specified in a list of change expressions in set_expression.
    The addition WHERE uses a logical expression sql_cond to define in which rows of the database table the changes are executed. For the logical expression sql_cond, the same applies as for the WHEREcondition of the statement SELECT, with the exception that no subqueries are to be evaluated in the database table to be changed. If no WHERE condition is specified, all the rows in the database table are changed. If a column of the type STRING or RAWSTRING is changed, the primary key must be fully specified in the WHERE condition.
    The content of primary key fields can only be changed if the respective database table is not linked with a search help and if pool and cluster tables are not accessed. If a link was to be created through the changes and this row would cause double entries in the primary key or a unique secondary index of the database table, no row is changed and sy-subrc is set to 4.
    Notes
    Before release 6.10, SET could only be specified for static specification of the database table.
    Before release 6.10, no dynamic logical expressions could be used in the WHERE condition of the statement UPDATE.
    Example
    Dynamic conversion of the content of an arbitrary column in an arbitrary database table of a previous currency in Euro.
    PARAMETERS: table    TYPE c LENGTH 30,
                column   TYPE c LENGTH 30,
                old_curr TYPE sycurr.
    DATA: set_expr  TYPE string,
          condition TYPE string.
    CONCATENATE column ` = 'EUR'`
                INTO set_expr.
    CONCATENATE column ` = old_curr`
                INTO condition.
    TRY.
        UPDATE (table)
        SET    (set_expr)
        WHERE  (condition).
      CATCH cx_sy_dynamic_osql_error.
        MESSAGE `Error in update!` TYPE 'I'.
    ENDTRY.
    Alternative 2
    ... FROM wa
    Effect
    If you specify a non-table-type work area wa, the system will search for a row in the database table which, in its primary key, has the same content as the respective beginning part of the work area. The content of the work area is interpreted in its non-converted form and in accordance with the structure of the database table or the view. The content of the work area is assigned to this row. The assignment takes place without conversion from the left to the right in accordance with the structure of the database table or the view. The work area must fulfill the prerequisites for use in Open SQL statements.
    If there is no row with the same content for the primary key in the database or if the change would lead to a double entry in a unique secondary index, the line is not changed and sy-subrc is set to 4.
    Notes
    The work area wa should always be declared in relation to the database table or the view in the ABAP Dictionary.
    If you have a static specification of the database table or the view, the specification of the work area using FROM wa can be omitted outside of classes - provided a table work area dbtab for the respective database table or the view is declared using the statement TABLES. The system expands the UPDATE statement implicitly to include the addition FROM dbtab.
    Alternative 3
    ... FROM TABLE itab
    Effect
    When an internal table itab is specified, the system processes all the rows of the internal table in accordance with the rules for the work area wa. The row type of the internal table must meet the requirements for use in Open-SQL statements.
    If, in the database, there is no row with the same content of the primary key for a row in the internal table, or if the change would lead to a double entry in a unique secondary key, the respective row is not changed and sy-subrc is set to 4. If the internal table is empty, sy-subrc is set to 0. The system field sy-dbcnt is always set to the number of rows actually inserted.
    Example
    Reduction of the flight cost for all of today's flights of an airline carrier in the database table SFLIGHT by the percentage percent. The calculation of the new price is always done in an internal table sflight_tab and the database table is changed accordingly.
    PARAMETERS: p_carrid TYPE sflight-carrid,
                percent  TYPE p LENGTH 1 DECIMALS 0.
    DATA sflight_tab TYPE TABLE OF sflight.
    FIELD-SYMBOLS <sflight> TYPE sflight.
    SELECT *
           FROM sflight
           INTO TABLE sflight_tab
           WHERE carrid = p_carrid AND
                 fldate = sy-datum.
    IF sy-subrc = 0.
      LOOP AT sflight_tab ASSIGNING <sflight>.
        <sflight>-price =
          <sflight>-price * ( 1 - percent / 100 ).
      ENDLOOP.
    ENDIF.
    UPDATE sflight FROM TABLE sflight_tab.

  • "Error in updating Table J_1iexchdr"

    Hi ,
    When I am creating the excise invoice, It's terminated the program and gives the following error
    "Error in updating Table J_1iexchdr"
    What can be the reason?
    Regards
    Prem

    Hi prem
    Look if these threads can help
    RG23C Update Problem
    Problem in SAP Script
    billing document not creating
    return delivery
    ************Reward points if usefull**************

  • Error in updating table J_1PART2

    Hi,
       I am getting an error while saving the excise invoice as 'error in updating table J_1PART2'.
    What would have gone wrong?????? please help!!!
    Thanks ,
    Ramya

    Discussion moved from SAP ERP Sales and Distribution (SAP SD) to Internationalization and Unicode
    Please use Internationalization and Unicode for you CIN related queries

  • Error in updating table J_1IEXCHDR,J_1IEXCDTL in tcode J1IJ

    Hi,
    while cancelling excise invoice in Tcode J1IJ ,
    we are getting 'error in updating table J_1IEXCHDR,J_1IEXCDTL'.
    what is missing or tell the procedure to resolve the issue.
    Regards,

    Discussion moved from SAP ERP Sales and Distribution (SAP SD) to Internationalization and Unicode
    Please use Internationalization and Unicode for you CIN related queries

  • Refreshing Entity Objects after Altering the table

    Hi,
    My Entity Object is based on a table... and View Objects on the Entity Objects. Now if I alter the table (just changing the width of the column), that change is not visible on the Entity Object. Is there any way I can automatically refresh the Entity Objects after altering the table(only column width is changed).
    (Changes made to Entity Objects manually are reflected in the View Object correctly.)
    Regards
    Faiyaz

    'changing the width of the column' means changing the size of the column in the table description in the database. For e.g.. In the original table I had a column OIL_KEY NUMBER(6). Now I change the column to be of size 12 i.e. OIL_KEY NUMBER(12). This does not get refreshed in the Entity Object.

  • Bapi : BAPI_ALM_ORDER_MAINTAIN not updating table AFVU-USR08

    Hi,
    I have a requirement to update table AFVU-USR08.I am actualy dealing with tcode IW32/IW33 where in we need to update operation-->enhancement tab.I am using BAPI : BAPI_ALM_ORDER_MAINTAIN to do this.I am testing the BAPI directly( Not called in any program ),I can see a message like so and so order saved under notification,But there is no entry in table AFVU-USR08.
    If any one have come across this prob. and got the sol. Pl. share it with me.
    Your solution will be more helpful.
    Thanks,
    Bharani.

    Hi Ferry,
    1. I have also tried ur given code before BAPI_TRANSACTION_COMMIT.
        l_fname = 'SOBKZ'.
        l_fvalue = 'U'.
        CALL FUNCTION 'CO_BH_MOD_SINGLE_FIELDS'
          EXPORTING
            aufnr_imp = wa_meth-objectkey(12)
            field1    = l_fname
            value1    = l_fvalue.
    but this program is giving dump for only this particular Value saying that This is PROTECTED field.
    Can anyone help me out on How to Update Special Stock Indicator on Components Tab of Maintenance Order (IW32).
    If anyone has faced such type of problem & solved it then please let me also.
    2. Which BADI to use for Updating Special Stock Indicator when we press enter on Components tab in Transaction IW32 ?..
    Thanks in advance,
    Hope to get the solution soon from all SAP gurus.
    and help will be appriciated .
    Gaurav.

  • Creating a better update table statement

    Hello,
    I have the following update table statement that I would like to make more effecient. This thing is taking forever. A little background. The source table/views are not indexed and the larger of the two only has 150k records. Any ideas on making more effecient would be appreciate.
    Thanks.
    Ryan
    Script:
    DECLARE
    V_EID_CIV_ID SBI_EID_W_VALID_ANUM_V.SUBJECT_KEY%TYPE;
    V_EID_DOE     DATE;
    V_EID_POE     SBI_EID_W_VALID_ANUM_V.POINT_OF_ENTRY%TYPE;
    V_EID_APPR_DATE DATE;
    V_CASE_CIV_ID     SBI_DACS_CASE_RECORDS.CASE_EID_CIV_ID%TYPE;
    V_CASE_DOE     DATE;          
    V_CASE_POE SBI_DACS_CASE_RECORDS.CASE_CODE_ENTRY_PLACE%TYPE;
    V_CASE_APPR_DATE           DATE;
    V_CASE_DEPART_DATE           DATE;
    V_SBI_UPDATE_STEP SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP%TYPE;
    V_SBI_CIV_ID SBI_DACS_CASE_RECORDS.SBI_CIV_ID%TYPE;
    CURSOR VALID_CIV_ID_FROM_EID IS
         SELECT EID.SUBJECT_KEY,
              TO_DATE(EID.PROCESS_ENTRY_DATE),
              EID.POINT_OF_ENTRY,
              TO_DATE(EID.APPREHENSION_DATE),
              DACS.CASE_EID_CIV_ID,
              TO_DATE(DACS.CASE_DATE_OF_ENTRY,'YYYYMMDD'),
              DACS.CASE_CODE_ENTRY_PLACE,
              TO_DATE(DACS.CASE_DATE_APPR,'YYYYMMDD'),
              TO_DATE(DACS.CASE_DATE_DEPARTED,'YYYYMMDD'),
              DACS.SBI_UPDATE_STEP,
              DACS.SBI_CIV_ID
         FROM SBI_EID_W_VALID_ANUM_V EID,
    SBI_DACS_CASE_RECORDS DACS
    WHERE DACS.CASE_NBR_A = EID.ALIEN_FILE_NUMBER;
         BEGIN          
              OPEN VALID_CIV_ID_FROM_EID;
    SAVEPOINT A;
              LOOP
                   FETCH VALID_CIV_ID_FROM_EID INTO V_EID_CIV_ID, V_EID_DOE, V_EID_POE,V_EID_APPR_DATE,V_CASE_CIV_ID, V_CASE_DOE,V_CASE_POE,V_CASE_APPR_DATE,V_CASE_DEPART_DATE,V_SBI_UPDATE_STEP,V_SBI_CIV_ID;     
    DBMS_OUTPUT.PUT_LINE('BEFORE');
                   EXIT WHEN VALID_CIV_ID_FROM_EID%FOUND;
    DBMS_OUTPUT.PUT_LINE('AFTER');
              UPDATE SBI_DACS_CASE_RECORDS
    SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_CASE_CIV_ID,
                   SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 1
    WHERE V_CASE_CIV_ID IS NOT NULL
    AND V_CASE_CIV_ID <> 0;
    UPDATE SBI_DACS_CASE_RECORDS
              SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
                   SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 2
    WHERE V_SBI_CIV_ID IS NULL AND V_SBI_UPDATE_STEP = 0
                   AND V_EID_DOE = V_CASE_DOE
                   AND V_EID_POE = V_CASE_POE
                   AND V_EID_APPR_DATE = V_CASE_APPR_DATE
                   AND V_EID_APPR_DATE = V_CASE_DEPART_DATE;
                   UPDATE SBI_DACS_CASE_RECORDS
              SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
                   SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 3
    WHERE V_SBI_UPDATE_STEP = 0
                   AND V_EID_DOE = V_CASE_DOE
                   AND V_EID_POE = V_CASE_POE
                   AND V_EID_APPR_DATE = V_CASE_APPR_DATE;
    UPDATE SBI_DACS_CASE_RECORDS
              SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
                   SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 4
    WHERE V_SBI_UPDATE_STEP = 0
                   AND V_EID_DOE = V_CASE_DOE
                   AND V_EID_POE = V_CASE_POE
                   AND (V_EID_APPR_DATE - V_CASE_APPR_DATE) > -4
                   AND (V_EID_APPR_DATE - V_CASE_APPR_DATE) < 4 ;
         UPDATE SBI_DACS_CASE_RECORDS
              SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
                   SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 5
    WHERE V_SBI_UPDATE_STEP = 0
                   AND V_EID_DOE = V_CASE_DOE
                   AND V_EID_POE <> V_CASE_POE
                   AND V_EID_APPR_DATE = V_CASE_APPR_DATE;
    UPDATE SBI_DACS_CASE_RECORDS
              SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
                   SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 6
    WHERE V_SBI_UPDATE_STEP = 0
                   AND V_EID_POE = V_CASE_POE
                   AND V_EID_APPR_DATE = V_CASE_APPR_DATE;
    UPDATE SBI_DACS_CASE_RECORDS
              SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
                   SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 7
    WHERE V_SBI_UPDATE_STEP = 0
         AND V_EID_APPR_DATE = V_CASE_APPR_DATE;
              UPDATE SBI_DACS_CASE_RECORDS
              SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
                   SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 8
    WHERE V_SBI_UPDATE_STEP = 0
    AND V_EID_DOE = V_CASE_DOE
                   AND (V_EID_APPR_DATE - V_CASE_APPR_DATE) > -4
                   AND (V_EID_APPR_DATE - V_CASE_APPR_DATE) < 4;          
                   UPDATE SBI_DACS_CASE_RECORDS
              SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
                   SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 9
    WHERE V_SBI_UPDATE_STEP = 0
    AND V_EID_DOE = V_CASE_DOE
                   AND V_EID_POE = V_CASE_POE;
              UPDATE SBI_DACS_CASE_RECORDS
              SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
                   SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 10
    WHERE V_SBI_UPDATE_STEP = 0
    AND (V_EID_APPR_DATE - V_CASE_APPR_DATE) > -4
                   AND (V_EID_APPR_DATE - V_CASE_APPR_DATE) < 4;     
              END LOOP;
              CLOSE VALID_CIV_ID_FROM_EID;
         COMMIT;
         END;     
    -----Thats it. Thanks for your help.
    Ryan

    Please use [ code] or [ pre] tags to format code before posing:
    DECLARE
         V_EID_CIV_ID SBI_EID_W_VALID_ANUM_V.SUBJECT_KEY%TYPE;
         V_EID_DOE DATE;
         V_EID_POE SBI_EID_W_VALID_ANUM_V.POINT_OF_ENTRY%TYPE;
         V_EID_APPR_DATE DATE;
         V_CASE_CIV_ID SBI_DACS_CASE_RECORDS.CASE_EID_CIV_ID%TYPE;
         V_CASE_DOE DATE;
         V_CASE_POE SBI_DACS_CASE_RECORDS.CASE_CODE_ENTRY_PLACE%TYPE;
         V_CASE_APPR_DATE DATE;
         V_CASE_DEPART_DATE DATE;
         V_SBI_UPDATE_STEP SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP%TYPE;
         V_SBI_CIV_ID SBI_DACS_CASE_RECORDS.SBI_CIV_ID%TYPE;
         CURSOR VALID_CIV_ID_FROM_EID IS
              SELECT EID.SUBJECT_KEY,
               TO_DATE(EID.PROCESS_ENTRY_DATE),
               EID.POINT_OF_ENTRY,
               TO_DATE(EID.APPREHENSION_DATE),
               DACS.CASE_EID_CIV_ID,
               TO_DATE(DACS.CASE_DATE_OF_ENTRY,'YYYYMMDD'),
               DACS.CASE_CODE_ENTRY_PLACE,
               TO_DATE(DACS.CASE_DATE_APPR,'YYYYMMDD'),
               TO_DATE(DACS.CASE_DATE_DEPARTED,'YYYYMMDD'),
               DACS.SBI_UPDATE_STEP,
               DACS.SBI_CIV_ID
              FROM SBI_EID_W_VALID_ANUM_V EID,
               SBI_DACS_CASE_RECORDS DACS
              WHERE DACS.CASE_NBR_A = EID.ALIEN_FILE_NUMBER;
    BEGIN
         OPEN VALID_CIV_ID_FROM_EID;
         SAVEPOINT A;
    LOOP
         FETCH VALID_CIV_ID_FROM_EID INTO V_EID_CIV_ID, V_EID_DOE,
              V_EID_POE,V_EID_APPR_DATE,V_CASE_CIV_ID, V_CASE_DOE,
                   V_CASE_POE,V_CASE_APPR_DATE,V_CASE_DEPART_DATE,V_SBI_UPDATE_STEP,V_SBI_CIV_ID;
         DBMS_OUTPUT.PUT_LINE('BEFORE');
         EXIT WHEN VALID_CIV_ID_FROM_EID%FOUND;
         DBMS_OUTPUT.PUT_LINE('AFTER');
         UPDATE SBI_DACS_CASE_RECORDS
          SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_CASE_CIV_ID,
           SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 1
         WHERE V_CASE_CIV_ID IS NOT NULL
          AND V_CASE_CIV_ID <> 0;
         UPDATE SBI_DACS_CASE_RECORDS
          SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
           SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 2
         WHERE V_SBI_CIV_ID IS NULL AND V_SBI_UPDATE_STEP = 0
          AND V_EID_DOE = V_CASE_DOE
           AND V_EID_POE = V_CASE_POE
            AND V_EID_APPR_DATE = V_CASE_APPR_DATE
             AND V_EID_APPR_DATE = V_CASE_DEPART_DATE;
         UPDATE SBI_DACS_CASE_RECORDS
          SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
           SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 3
         WHERE V_SBI_UPDATE_STEP = 0
          AND V_EID_DOE = V_CASE_DOE
           AND V_EID_POE = V_CASE_POE
            AND V_EID_APPR_DATE = V_CASE_APPR_DATE;
         UPDATE SBI_DACS_CASE_RECORDS
          SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
           SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 4
         WHERE V_SBI_UPDATE_STEP = 0
          AND V_EID_DOE = V_CASE_DOE
           AND V_EID_POE = V_CASE_POE
            AND (V_EID_APPR_DATE - V_CASE_APPR_DATE) > -4
             AND (V_EID_APPR_DATE - V_CASE_APPR_DATE) < 4 ;
         UPDATE SBI_DACS_CASE_RECORDS
          SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
           SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 5
         WHERE V_SBI_UPDATE_STEP = 0
          AND V_EID_DOE = V_CASE_DOE
           AND V_EID_POE <> V_CASE_POE
            AND V_EID_APPR_DATE = V_CASE_APPR_DATE;
         UPDATE SBI_DACS_CASE_RECORDS
          SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
           SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 6
         WHERE V_SBI_UPDATE_STEP = 0
          AND V_EID_POE = V_CASE_POE
           AND V_EID_APPR_DATE = V_CASE_APPR_DATE;
         UPDATE SBI_DACS_CASE_RECORDS
          SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
           SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 7
         WHERE V_SBI_UPDATE_STEP = 0
          AND V_EID_APPR_DATE = V_CASE_APPR_DATE;
         UPDATE SBI_DACS_CASE_RECORDS
          SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
           SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 8
         WHERE V_SBI_UPDATE_STEP = 0
          AND V_EID_DOE = V_CASE_DOE
           AND (V_EID_APPR_DATE - V_CASE_APPR_DATE) > -4
            AND (V_EID_APPR_DATE - V_CASE_APPR_DATE) < 4;
         UPDATE SBI_DACS_CASE_RECORDS
          SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
           SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 9
         WHERE V_SBI_UPDATE_STEP = 0
          AND V_EID_DOE = V_CASE_DOE
           AND V_EID_POE = V_CASE_POE;
         UPDATE SBI_DACS_CASE_RECORDS
          SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
           SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 10
         WHERE V_SBI_UPDATE_STEP = 0
          AND (V_EID_APPR_DATE - V_CASE_APPR_DATE) > -4
           AND (V_EID_APPR_DATE - V_CASE_APPR_DATE) < 4;
    END LOOP;
    CLOSE VALID_CIV_ID_FROM_EID;
    COMMIT;
    END;Peter D.

Maybe you are looking for