Agent Group in Rule Based workflow decesion table

Hi
Have one question.
Can it possible to split and merge parallel workflow items using Agent Group but without any BADI (Only customizing)?

Unfortunately, the answer is NO. You need to implement the BAdI to at least determine the output of the split.

Similar Messages

  • BADI for MDGF rule based workflow

    Hi Experts,
    I am really struggling to get a badi that can route on field assigned in my single and agent decision tables. I have used the standard BADI that was provided in RDS documentation for BP and Materials and just tried to change the entity name and field names without success.
    Can anyone please provide me with an example where someone has used this to route on field in finance.
    I am trying to route on Segment for Profit center
    Your help will be highly appreciated
    Thanks and best regards
    Riaan

    Hi Abdullah,
    I am using an existing attribute in the data model OG in the entity PCTR. The field name is PCTRSEG and element is fb_segment. In my rule based workflow in the Single decision table I have added fb_segment and I have populated the values against step 00. I have also updated my agent decision table with the fb_segment value.
    I am attaching the BADI that I am struggeling with.
    The service name for the change request is in the BADI filter. Thus when the requestor submit the Badi will be called and it will route to the person assigned in my agent decision table against the relevant segment..
    My problem is the following:
    The issue is that I don't know where I should maintain PCTRSEG and where I should maintain fb_segment in the BADI. Thus, where do I use the attribute name from the data model and where do I use the data element from the model.
    When the requestor submit the request it does not go to the next approver and I get the error" Agent could not be determined"
    I found ,when I change any of the values for the segment in the single and agent decision tables to not equal, example <> 1001 that the workflow works but all change requests will go to the same person.
    Thus my assumption is that something might be wrong with the BADI
    Your help will be highly appreciated
    Thanks
    Riaan
    Please find Badi below
    method IF_USMD_SSW_RULE_CNTX_PREPARE~PREPARE_RULE_CONTEXT.
        DATA:
          lo_crequest      TYPE
    REF TO if_usmd_crequest_api,
          lt_entities      TYPEusmd_t_crequest_entity,
          ls_entity        TYPE usmd_s_crequest_entity,
          lr_table         TYPE REF TO data,
          lt_sel           TYPE usmd_ts_sel,
          ls_sel           TYPE usmd_s_sel,
          lv_brf_expr_id   TYPEif_fdt_types=>id,
          ls_context       TYPEusmd_s_fdt_context_value,
          lv_exit          TYPE c.
      FIELD-SYMBOLS: <lt_fin_int>
    TYPE ANY TABLE,
                     <ld_fin_int>  TYPE
    any,
                     <pctrseg>      TYPEfb_segment,
                     <value>      TYPE
    any.
    * Prepare export parameters
      CLEAR et_message.
      CLEAR et_rule_context_value.
    * Get the CR API for the current
    CR
      CALL METHOD cl_usmd_crequest_api=>get_instance
        EXPORTING
          iv_crequest          = iv_cr_number
        IMPORTING
          re_inst_crequest_api = lo_crequest.
    * Create data instance of the
    entity PCTR for read access
      CALL METHOD lo_crequest->create_data_reference
        EXPORTING
          iv_entity    ='PCTR'
          i_struct     =if_usmd_model=>gc_struct_key_attr
        IMPORTING
          er_table     =lr_table
          et_message   =et_message.
      CHECK et_message IS
    INITIAL.
      ASSIGN lr_table->*
    TO <lt_fin_int>.
    * Get the instance keys for entity
    type PCTR
      CALL METHOD lo_crequest->read_objectlist
        EXPORTING
          iv_entity_type = 'PCTR'
        IMPORTING
          et_entity      = lt_entities
          et_message     =et_message.
      CHECK et_message IS INITIAL.
    * Read the PCTR entity of the one
    and only PCTR of the CR
      READ TABLE lt_entities INTOls_entity INDEX 1.
      CHECK sy-subrc = 0.
      ls_sel-fieldname ='PCTRSEG'.
      ls_sel-sign = 'I'.
      ls_sel-option = 'EQ'.
      ls_sel-low    = ls_entity-usmd_value.
      APPEND ls_sel TO lt_sel.
      CALL METHOD lo_crequest->read_value
        EXPORTING
          i_fieldname      = 'PCTRSEG'
          it_sel           = lt_sel
          if_edition_logic = abap_false
        IMPORTING
          et_data          = <lt_fin_int>
          et_message       = et_message.
    * Get the one and only FB_SEGMENT
    of the one PCTR in the CR
      LOOP AT <lt_fin_int> ASSIGNING <ld_fin_int>.
        ASSIGN COMPONENT 'PCTRSEG'OF STRUCTURE <ld_fin_int>
    TO <pctrseg>.
        EXIT.
      ENDLOOP.
      CHECK sy-subrc = 0.
    * fill out the return table
      get_element_id(
        EXPORTING
          iv_cr_type = lo_crequest->ds_crequest-usmd_creq_type
          iv_name    ='PCTR'
        IMPORTING
          ev_brf_expr_id = lv_brf_expr_id ).
      ls_context-id = lv_brf_expr_id.
      CREATE DATA ls_context-value TYPE fb_segment.
      ASSIGN  ls_context-value->* TO <value>.
      <value> = <pctrseg>.
      APPEND ls_context TO et_rule_context_value.
      endmethod.

  • Not getting agent for standard rule in leave approval

    hi everyone,
       I have copied standard workflow(WS00**77) for leave request and used standard rules for agents. The second rule 00400135 is for personnel administrator. I have assigned user name for this Pers.admin in both SPRO and in HR ORG management. I tried to assign SAP organisational objects to one of the Organisation Management objects in t-code PFOM, But it gives dump error.
    do i need to do any other step previously to this?

    hi,
      In PFAC, I am not getting search help values. So, I entered the values Administrator group and administrator in the fields. But, It gives no agent found.Actually I have set up administrator in SPRO and after that i checked in PFAC. I have also done assignments between Organisational Object type and Organisational Management Objects.But no use.
    Then i have created custom rule based on T256 table. In PFAC it is working fine. But, in workflow for a personnel i have assigned a administrator and created leave request. The corresponding workitem getting triggered. But, when i change the admin in PA30 and creating Leave request it gives error as:
    Workflow 1712 set to status ERROR 
    Please repair the suspended workflow
    Context Information:
    ID: 1712
    Work Item Text: hd
    User: WF-BATCH
    Language: E
    SAP System: SCD
    Client: 200
    Press 'Execute' to display the workflow that has errors.

  • Connect SharePoint to SQL Server Database Then Build Rules Based Returns System

    Hello Guys,
    I work for an ecommerce business. We sell a wide range of products to customers all around the world which are ordered from our websites and then dispatched to our customers from our warehouses.
    I have been tasked with developing a computerised return system from the company because at the moment everything is done using paper forms.
    We have all our customer, order and product data within SQL Server databases.
    What I would like to know is...
    1. Can we connect sharepoint online to a local sql server database
    2. Could we then build searches within sharepoint to display data contained within these databases e.g. customer information etc
    3. How is the data presented in sharepoint - is there a way to design how the data is displayed within sharepoint etc?
    4. Can we then build a rules based return system within sharepoint? The on screen workflow would need to vary according to data contained within the database e.g. the weight if the product being returned and also on fields input by the service agent such
    as the reason for the return, what solution the customer would like etc.
    5. is it possible to build these workflows in such a way that they can be saved part way through then gone back to later
    6. Can reports be build based on the returns that are being generated e.g. list of products most commonly returned
    Sorry for all the questions, I am a bit of sharepoint novice. I think it may possible be able to do what we need but I just wondered if the answer to any of the above questions is definately a no because if it is that could mean it is not suitable
    Thanks

    You could use a BCS connection
    http://community.office365.com/en-us/b/office_365_community_blog/archive/2012/10/11/business-data-connectivity-services-in-office-365-sharepoint-online.aspx, this will allow you to edit data in your non SharePoint SQL DB, on premises, from Office 365 SharePoint.
    Search will index the web applications you point it at, and the lists from the BCS will be part of those web apps, site collections, sites at some place and will get indexed. 
    You can create views on the data, that can sort of work like a search, but when you search on the site where the lists are the query will return results based on the BCS data.
    These views can be based on criteria such as the weight of the product being returned and other fields.
    The data is presented as a list.
    You can make it read only or read-write based on SharePoint permissions on the list.  The account used to create the connection can edit.
    BCS is possible in on-premises SharePoint too
    here is a good read on it,
    http://www.dotnetcurry.com/showarticle.aspx?ID=632
    Stacy Simpkins | MCSE SharePoint | www.sharepointpapa.com

  • Current Agent Value in Program Exit Workflow

    Hi Gurus,
    we are using program exit to send mail to outlook on user decsion step and it is working fine for Sequential approval but when we have to send mail for parallel approval(have used block for parallel approval) we are not able to fetch current agent.
    - Have store agent in workflow container 'Agent' and used it in Block in workflow for implementing parallel appoaval.
    - Created class implementing inetrface IF_SWF_IFS_WORKITEM_EXIT and put it under program exit of user decsion in workflow
    - Now in this class I have created method at work item created to trigger email for which i require runtime work item id and agent for it.
    - We are getting workitem id at runtime and based on it picking up approval agent from workflow container and send mail to it.
    - this workfs fine for sequential one as there is only one approver at a time but in parallel where all approver are maintained in one multiline container, it is sending mail to first person maintained in multiline container.
    Please find steps below what i have tried:-
    - i tried with  FM RH_USERS_OF_WI_READ to get current agent for particular work item id  but it is throwing dump no value found at   runtime but stangely gives value if we run standalone for same work item id.
    - Then,  I tried putting wait upto to see if it helps, but then also above fm is unable to fetch agent.
    - Tried by putting select on   SWWUSERWI table but that also is not giving current agent
    Question is:
    Why we are not able to get value of current agent through above FM or select from userwi table? How do we get current agent value at the time of work item creation event is triggered which further hits our custom method.
    Please help...
    Regards
    Ajit C

    Hi Ajit,
    Here you go.
    You must be having a multiline container (probably of type WFSYST-AGENT) in your workflow which holds all the user ids to whom work item must be going parellely. e.g if the multiline container name is AGENT.
    The current agent from that multiline container is referred by &AGENT[_AGENT_line_]&. This you must hast have put in your user decision step/activity as an agent also.
    Now in your user decision step/activity, create one single line container element of type WFSYST-AGENT e.g. current_agent. in workflow to task binding, bind &AGENT[_AGENT_line_]& to CURRENT_AGENT. This way you will have current agent in that task container.
    Finally use function module SAP_WAPI_READ_CONTAINER using WORKITEM id to read the value of CURRENT_AGENT in your program exit.
    Regards,
    Ibrahim

  • Implementing roles and rules based authorisation with Azure AD

    Hi all,
    I would greatly appreciate some input on feasibility and patterns I should look at for a complex technical requirement that I am currently tasked with designing.
    We have a system that comprises a web and mobile app. In the past we have implemented session based authentication through ADAM and authorisation through custom business rules contained within the applications. The authentication mechanism is in the process
    of being migrated to Azure AD and authorisation is planned to be moved to Azure AD for our next release.
    Existing authorisation within our web application is already complex. We have users that belong to different groups with a range of permissions such as read, write or admin. Additionally each user is granted access to N customers and also N locations within
    each customer. We have a requirement that any number of combinations of customers and locations be supported. Users also need to have different permissions for each entity, i.e. read access to customer 1 location 2, write access to customer 4 and administer
    customer 7. Currently these privileges are maintained within a relational database and enforced as part of each PageLoad(). Essentially this is a combination of roles and rules based authorisation.
    We are struggling to represent this complex matrix structure within Azure AD and efficiently implement the authorisation decision in Azure AD. The driver for this technical requirement is to provide re-usability of the authorisation component to other (as
    yet unidentified) applications.
    Currently the best option we have come up with is implementing custom attributes for each class of permissions and storing within this 2048 bit field a bitmask that represents whether this permission is granted for a given location (which has a many to one
    relationship with customer).
    Any help or comment would be gratefully received,
    Phil

    Hi
    When "Advance routing" is used for Task assignment; the task service asserts the folllowing fact types : Task, PreviousOutcome and TaskAction to the rules engine. These facts gives all the reqd info about the task (like outcome of the participant, task stage .. etc)
    Now in the defined ruleset; we can have rules as per our requirement that can extract info from the asserted fact types and assign task to the required/next participant.
    Also note that we write the advance rules for exception cases only.
    For example; let's say all participants have 2 possible Outcomes [COMPLETE, RECHECK]. We have defined the ideal task routing flow as :
    Participant A -> Participant B -> Participant C. This is the flow when all participant selects "COMPLETE"
    Now suppose B selects outcome as "RECHECK" then the task shld move back to A. So for this case only we need to write a advance rule.
    Pls refer to the code sample at : http://download.oracle.com/technology/sample_code/hwf/workflow-106-IterativeDesign.zip
    Also dev guide : refer to section 28.3.7.2 http://download.oracle.com/docs/cd/E14571_01/integration.1111/e10224/bp_hwfmodel.htm#BABBFEJJ
    Thanks
    Edited by: Kania on May 19, 2010 2:41 AM

  • Rule based Role membership in OIA is not pushing to OIM

    Hi All,
    Rule based Role membership in OIA is not pushing to OIM due to error as
    00:01:38,055 DEBUG [DBIAMSolution] Group Role container for JDE.JDE_BHRUSRTT found...
    00:01:38,144 ERROR [DBIAMSolution] Error Occured while adding users to role
    Thor.API.Exceptions.tcAPIException: Error occurred while find User information: USER_NOT_FOUND
    at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:234)
    at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:348)
    at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:259)
    at Thor.API.Operations.tcGroupOperationsIntf_13pobh_tcGroupOperationsIntfRemoteImpl_1035_WLStub.getAllMemberUsersx(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(RemoteBusinessIntfProxy.java:85)
    at $Proxy396.getAllMemberUsersx(Unknown Source)
    at Thor.API.Operations.tcGroupOperationsIntfDelegate.getAllMemberUsers(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Meth
    Any one can help will be appreciate...
    Thanks
    Bikas
    Edited by: Bikas Mandal on Mar 27, 2013 6:15 AM

    Try these steps and let me know what you see:
    Login to OIA > Administration > Configuration > Workflows
    Select Role membership create workflow
    And check if you have added OIM provisioning server in the Step5 of the workflow.
    Cheers,
    Vamsi.

  • Rule Based Optimization

    Hi,
    Rule Based Optimization is a deprecated feature in Oracle 10g.We are in the process of migrating from Oracle 9i to 10g.I have never heard of this Rule based Optimization earlier.I have googled for the same.But, got confused with the results.
    Can anybody shed some light on the below things...
    Is this Optimization done by Oracle or as a developer do we need to take care of the rules while writing SQL statements?
    There is another thing called Cost Based Optimization...
    Who will instruct the Oracle whether to use Rule Based Optimization or cost Based Optimization?
    Thanks & Regards,
    user569598

    Hope the following explanation would be helpful.
    Whenever a statement is fired, Oracle should goes through the following stages:
    Parse -> Execute -> Fetch (fetch only for select statement).
    During Parse, Oracle first evaluates, Syntatic checking (SELECT, FROM, WHERE, ORDER BY ,GROUP and etc) and then Semantic Checking (columns names, table name, user permission on the objects and etc). Once these two stages passes, then, it has to decided whether to do soft parse or hard parse. If similar cursor(statement) doesn't exits in the shared pool, Oracle goes for Hard parse where Optimizer comes in picture for generating query plan.
    Oracle has to decide either RBO or CBO. It also depends on the OPTIMIZER_MODE parameter value. If RULE hint is used, RBO will be used, if there are no statistics for those tables involved in the query, Oracle decides RBO, (condition applies). If statistics are available, or dynamic samplying is defined then Oracle use CBO to prepare the Optimal execution plan.
    RBO is simply relies on set of rules where CBO relies on statistical information.
    Jaffar

  • How to do binding of rule with workflow

    hi all
    i have a problem regarding the binding of rule ,which i have maintained ,with the workflow on which i am working.
    can any one please guide me how to do the binding of rule with workflow,the way am doing is like:
    i have vreated a container element in workflow compatible with container element used in rule where agents are kept.
    problem is arising when am trying to import that container in rule to my workflow ,at this step please suggest what should i bind in the binding of the workflow container.
    the exact parameters detail will really appreciated.
    am not new to the rule or workflow but somehow thing am doing is not working exactly the way i want it to be so.
    full marks will be rewarded
    best regards
    ashish

    Hi Ashish,
    Please refer the following link. It may be helpful.
    http://help.sap.com/saphelp_crm60/helpdata/en/c5/e4b0ae453d11d189430000e829fbbd/content.htm
    Regards,
    Johnny.

  • Dynamic Rule based implementation in PL/SQL

    Hi,
    We are trying to implement a dynamic rule based application in Oracle 9i. Its simple logic where we store expressions as case statments and actions seperated by commas as follows.
    Rule: 'Age > 18 and Age <65'
    True Action: 'Status = ''Valid'' , description = ''age in range'''
    False Action: 'Status =''Invalid'', Description=''Age not in range'''
    Where Age,Status, description are all part of one table.
    One way of implementing this is fire rule for each record in the table and then based on true or false call action as update.
    i.e
    select (case when 'Age > 18 and Age <65' then 1 else 0 end) age_rule from tableX
    (above query will in in a cursor xcur)
    Then we search for
    if age_rule = 1 then
    update tablex set Status = ''Valid'' , description = ''age in range'' where id=xcur.id;
    else
    update tablex set Status =''Invalid'', Description=''Age not in range'' where id=xcur.id;
    end if;
    This method will result in very slow performance due to high i/o. We want to implement this in collection based method.
    Any ideas on how to dynamically check rules and apply actions to collection without impact on performance. (we have nearly 3million rows and 80 rules to be applied)
    Thanks in advance

    Returning to your original question, first of all, there is a small flaw in the requirements, because if you apply all the rules to the same table/cols, than the table will have results of only last rule that was processed.
    Suppose rule#1:
    Rule: 'Age > 18 and Age <65'
    True Action: 'Status = ''Valid'' , description = ''age in range'''
    False Action: 'Status =''Invalid'', Description=''Age not in range'''
    and Rule#2:
    Rule: 'Name like ''A%'''
    True Action: 'Status = 'Invalid'' , description = ''name begins with A'''
    False Action: 'Status =''Invalid'', Description=''name not begins with A'''
    Then after applying of rule#1 and rule#2, results of the rule#1 will be lost, because second rule will modify the results of the first rule.
    Regarding to using collections instead of row by row processing, I think that a better approach would be to move that evaluating cursor inside an update statement, in my tests this considerably reduced processed block count and response time.
    Regarding to the expression filter, even so, that you are not going to move to 10g, you still can test this feature and see how it is implemented, to get some ideas of how to better implement your solution. There is a nice paper http://www-db.cs.wisc.edu/cidr2003/program/p27.pdf that describes expression filter implementation.
    Here is my example of two different methods for expression evaluation that I've benchmarked, first is similar to your original example and second is with expression evaluation moved inside an update clause.
    -- fist create two tables rules and data.
    drop table rules;
    drop table data;
    create table rules( id number not null primary key, rule varchar(255), true_action varchar(255), false_action varchar(255) );
    create table data( id integer not null primary key, name varchar(255), age number, status varchar(255), description varchar(255) );
    -- populate this tables with information.
    insert into rules
    select rownum id
    , 'Age > '||least(a,b)||' and Age < '||greatest(a,b) rule
    , 'Status = ''Valid'', description = ''Age in Range''' true_action
    , 'Status = ''Invalid'', description = ''Age not in Range''' false_action
    from (
    select mod(abs(dbms_random.random),60)+10 a, mod(abs(dbms_random.random),60)+10 b
    from all_objects
    where rownum <= 2
    insert into data
    select rownum, object_name, mod(abs(dbms_random.random),60)+10 age, null, null
    from all_objects
    commit;
    -- this is method #1, evaluate rule against every record in the data and do the action
    declare
    eval number;
    id number;
    data_cursor sys_refcursor;
    begin
    execute immediate 'alter session set cursor_sharing=force';
    for rules in ( select * from rules ) loop
    open data_cursor for 'select case when '||rules.rule||' then 1 else 0 end eval, id from data';
    loop
    fetch data_cursor into eval, id;
    exit when data_cursor%notfound;
    if eval = 1 then
    execute immediate 'update data set '||rules.true_action|| ' where id = :id' using id;
    else
    execute immediate 'update data set '||rules.false_action|| ' where id = :id' using id;
    end if;
    end loop;
    end loop;
    end;
    -- this is method #2, evaluate rule against every record in the data and do the action in update, not in select
    begin
    execute immediate 'alter session set cursor_sharing=force';
    for rules in ( select * from rules ) loop
    execute immediate 'update data set '||rules.true_action|| ' where id in (
    select id
    from (
    select case when '||rules.rule||' then 1 else 0 end eval, id
    from data
    where eval = 1 )';
    execute immediate 'update data set '||rules.false_action|| ' where id in (
    select id
    from (
    select case when '||rules.rule||' then 1 else 0 end eval, id
    from data
    where eval = 0 )';
    end loop;
    end;
    Here are SQL_TRACE results for method#1:
    call count cpu elapsed disk query current rows
    Parse 37 0.01 0.04 0 0 0 0
    Execute 78862 16.60 17.50 0 187512 230896 78810
    Fetch 78884 3.84 3.94 2 82887 1 78913
    total 157783 20.46 21.49 2 270399 230897 157723
    and this is results for method#2:
    call count cpu elapsed disk query current rows
    Parse 6 0.00 0.00 0 0 0 0
    Execute 6 1.93 12.77 0 3488 170204 78806
    Fetch 1 0.00 0.00 0 7 0 2
    total 13 1.93 12.77 0 3495 170204 78808
    You can compare this two methods using SQL_TRACE.

  • Document rule based classification

    from the example in oracle text developers guide i tried to build a rule based document classification, using the code given below:
    create or replace package classifier as
    procedure this;
    end;
    show errors
    create or replace package body classifier as
    procedure this
    is
    v_document     blob;
    v_item          number;
    v_doc           number;
    begin
    for doc in (select document_id, content from documents)
         loop
              v_document :=doc.content;
              v_item:=0;
              v_doc:=doc.document_id;
              for c in (select category_id, category_name from docs_cats_rule_based_class
                   where matches(query,v_document)>0)
              loop
                   v_item:=v_item +1;
                   insert into doc_cat_rule_based_class values (doc.document_id, category_id);
              end loop;
         end loop;
    end this;
    end;
    show errors
    exec classifier.this
    this gives the following errors:
    package classifier Compiled.
    line 5: SQLPLUS Command Skipped: show errors
    package body Compiled.
    line 32: SQLPLUS Command Skipped: show errors
    Error starting at line 33 in command:
    exec classifier.this
    Error report:
    ORA-04063: package body "STARDOC.CLASSIFIER" has errors
    ORA-06508: PL/SQL: could not find program unit being called: "STARDOC.CLASSIFIER"
    ORA-06512: at line 1
    i think i am missing some grant to package. please help!

    What version of Oracle are you using? Did you create the required tables and index in the earlier steps? What did you run it from? It appears that you did not run it from SQL*Plus. Please see the following demonstration that shows that it works fine on Oracle 10g when run from SQL*Plus with minimal privileges. I did not use any data.
    SCOTT@10gXE> CREATE USER stardoc IDENTIFIED BY stardoc
      2  /
    User created.
    SCOTT@10gXE> GRANT CONNECT, RESOURCE TO stardoc
      2  /
    Grant succeeded.
    SCOTT@10gXE> CONNECT stardoc/stardoc
    Connected.
    STARDOC@10gXE>
    STARDOC@10gXE> create table news_table
      2    (tk    number primary key not null,
      3       title varchar2(1000),
      4       text  clob)
      5  /
    Table created.
    STARDOC@10gXE> create table news_categories
      2    (queryid  number primary key not null,
      3       category varchar2(100),
      4       query      varchar2(2000))
      5  /
    Table created.
    STARDOC@10gXE> create table news_id_cat
      2    (tk         number,
      3       category_id number)
      4  /
    Table created.
    STARDOC@10gXE> create index news_cat_idx on news_categories (query)
      2  indextype is ctxsys.ctxrule
      3  /
    Index created.
    STARDOC@10gXE> create or replace package classifier
      2  as
      3    procedure this;
      4  end classifier;
      5  /
    Package created.
    STARDOC@10gXE> show errors
    No errors.
    STARDOC@10gXE> create or replace package body classifier
      2  as
      3    procedure this
      4    is
      5        v_document    clob;
      6        v_item        number;
      7        v_doc            number;
      8    begin
      9        for doc in (select tk, text from news_table)
    10        loop
    11          v_document := doc.text;
    12          v_item := 0;
    13          v_doc  := doc.tk;
    14          for c in
    15            (select queryid, category from news_categories
    16             where matches (query, v_document) > 0)
    17          loop
    18             v_item := v_item + 1;
    19             insert into news_id_cat values (doc.tk,c.queryid);
    20          end loop;
    21        end loop;
    22    end this;
    23  end classifier;
    24  /
    Package body created.
    STARDOC@10gXE> show errors
    No errors.
    STARDOC@10gXE> exec classifier.this
    PL/SQL procedure successfully completed.
    STARDOC@10gXE>

  • Time Based Workflow - how to make it work?

    Hello,
    Has anyone successfully built a Time Based Workflow? Could you share your examples?
    For me it does not work properly.
    I have tried to set up 2 workflows: on Opportunity Close Date and Account Contract Expiration Date.
    - Account Contract Expiration Date: I want an Account Owner to get an email notification exactly 6 months before the contract with his client expires. However - the email is triggered each time the record is modified - so I have seen in the workflow monitor that users on the date of contract expiration - 180 days will receive as many emails as many times they modified the record! Is there a way to avoid this situation?
    - Opportunity Close Date - I want to send an email to Opportunity Owner's Manager - 10 days after the opportunity was closed. However - there will be the same issue as above + the wait action is not working with a PRE function.
    Please let me know what you think and if you have already built a Time Based Workflow that works correctly.
    Edited by: MagdaR on May 18, 2010 1:57 AM

    Let's start with the workflow for Opty Close Date.
    There are a lot of ways to do this, so you'll need to evaluate which way is best for your case, but the basics are to check to ensure that the opty is closed for the first time, then set the flag. In order to accomodate for the opty being closed when it is created, you will have to consider a post default for the flag in addition to the workflow.
    In this case, you could create a workflow on Opty using the before modified record saved trigger event. In the Rule Condition, have the workflow check for a closed opty and if the status changed to closed during this modification. There are a number of options to validate this, including sales stage = Closed/Won or Lost, Closed Date is populated for the first time, Status is closed. In any case, just validate that the opty was closed for the first time using the PRE Function (i.e., PRE(Closed Date) is null and PRE(Closed Date)&lt;&gt;Closed Date). When your condition is met, set a flag that will trigger the event. You could also add a date that the wf conditions were met the first time, to ensure that you track when the rule was originally triggered.
    The next step is to have a workflow that unsets the flag if the conditions are not met. Set the order on this one to follow the rule above.
    The last rule is the wait/email rule and it uses the when modified record saved event. This rule triggers on the flag being checked, then waits to send the email.
    Test this and validate that it will work for your purposes. Based on this workflow, you should be able to create the other one, and I can help if you have any issues.
    Good Luck,
    Thom

  • Improving performace for a Rule Based Optimizer DB

    Hi,
    I am looking for information on improving the current performance of an ancient 35GB Oracle 7.3.4 using RULE based optimizer mode. It is using 160 MB SGA and the physical memory on the system is 512MB RAM.
    As of now, all the major tasks which take time, are run after peak hours so that the 130 user sessions are not affected significantly.
    But recently am told some procedures take too long to execute ( procedure has to do with truncating tables and re-populating data into it ) and I do see 54% of the pie chart for WAITS are for "sequential reads" followed by "scattered reads" of 36%. There are a couple of large tables of around 4GB in this DB.
    Autotrace doesn't help me much in terms of getting an explain plan of slow queries since COST option doesnt show up and am trying to find ways of improving the performance of DB in general.
    Apart from the "redo log space requests" which I run into frequently (which btw is something I am trying to resolve ..thanks to some of you) I dont see much info on exactly how to proceed.
    Is there any info that I can look towards in terms of improving performance on this rule based optimizer DB ? Or is identifying the top sql's in terms of buffer gets the only way to tune ?
    Thank you for any suggestions provided.

    Thanks Hemant.
    This is for a 15 minute internal under moderate load early this morning.
    Statistic                   Total        Per Transact Per Logon    Per Second 
    CR blocks created                    275          .95         5.19          .29
    Current blocks converted fo           10          .03          .19          .01
    DBWR buffers scanned               74600       258.13      1407.55        78.44
    DBWR free buffers found            74251       256.92      1400.96        78.08
    DBWR lru scans                       607          2.1        11.45          .64
    DBWR make free requests              607          2.1        11.45          .64
    DBWR summed scan depth             74600       258.13      1407.55        78.44
    DBWR timeouts                        273          .94         5.15          .29
    OS Integral shared text siz   1362952204   4716097.59  25716079.32   1433177.92
    OS Integral unshared data s    308759380   1068371.56   5825648.68    324668.12
    OS Involuntary context swit       310493      1074.37      5858.36       326.49
    OS Maximum resident set siz       339968      1176.36      6414.49       357.48
    OS Page faults                      3434        11.88        64.79         3.61
    OS Page reclaims                    6272         21.7       118.34          6.6
    OS System time used                19157        66.29       361.45        20.14
    OS User time used                 195036       674.87      3679.92       205.09
    OS Voluntary context switch        21586        74.69       407.28         22.7
    SQL*Net roundtrips to/from         16250        56.23        306.6        17.09
    SQL*Net roundtrips to/from           424         1.47            8          .45
    background timeouts                  646         2.24        12.19          .68
    bytes received via SQL*Net        814224      2817.38     15362.72       856.18
    bytes received via SQL*Net         24470        84.67        461.7        25.73
    bytes sent via SQL*Net to c       832836      2881.79     15713.89       875.75
    bytes sent via SQL*Net to d        42713        147.8       805.91        44.91
    calls to get snapshot scn:         17103        59.18        322.7        17.98
    calls to kcmgas                      381         1.32         7.19           .4
    calls to kcmgcs                      228          .79          4.3          .24
    calls to kcmgrs                    20845        72.13        393.3        21.92
    cleanouts and rollbacks - c           86           .3         1.62          .09
    cleanouts only - consistent           40          .14          .75          .04
    cluster key scan block gets         1051         3.64        19.83         1.11
    cluster key scans                    376          1.3         7.09           .4
    commit cleanout failures: c           18          .06          .34          .02
    commit cleanout number succ         2406         8.33         45.4         2.53
    consistent changes                   588         2.03        11.09          .62
    consistent gets                   929408      3215.94        17536        977.3
    cursor authentications              1746         6.04        32.94         1.84
    data blocks consistent read          588         2.03        11.09          .62
    db block changes                   20613        71.33       388.92        21.68
    db block gets                      40646       140.64       766.91        42.74
    deferred (CURRENT) block cl          668         2.31         12.6           .7
    dirty buffers inspected                3          .01          .06            0
    enqueue conversions                  424         1.47            8          .45
    enqueue releases                    1981         6.85        37.38         2.08
    enqueue requests                    1977         6.84         37.3         2.08
    execute count                      20691         71.6        390.4        21.76
    free buffer inspected               2264         7.83        42.72         2.38
    free buffer requested             490899      1698.61      9262.25       516.19
    immediate (CR) block cleano          126          .44         2.38          .13
    immediate (CURRENT) block c          658         2.28        12.42          .69
    logons cumulative                     53          .18            1          .06
    logons current                         1            0          .02            0
    messages received                    963         3.33        18.17         1.01
    messages sent                        963         3.33        18.17         1.01
    no work - consistent read g       905734      3134.03     17089.32        952.4
    opened cursors cumulative           2701         9.35        50.96         2.84
    opened cursors current               147          .51         2.77          .15
    parse count                         2733         9.46        51.57         2.87
    physical reads                    490258      1696.39      9250.15       515.52
    physical writes                     2265         7.84        42.74         2.38
    recursive calls                    37296       129.05        703.7        39.22
    redo blocks written                 5222        18.07        98.53         5.49
    redo entries                       10575        36.59       199.53        11.12
    redo size                        2498156      8644.14     47135.02      2626.87
    redo small copies                  10575        36.59       199.53        11.12
    redo synch writes                    238          .82         4.49          .25
    redo wastage                      104974       363.23      1980.64       110.38
    redo writes                          422         1.46         7.96          .44
    rollback changes - undo rec            1            0          .02            0
    rollbacks only - consistent          200          .69         3.77          .21
    session logical reads             969453      3354.51     18291.57       1019.4
    session pga memory              35597936    123176.25    671659.17     37432.11
    session pga memory max          35579576    123112.72    671312.75      37412.8
    session uga memory               2729196      9443.58     51494.26      2869.82
    session uga memory max          20580712     71213.54    388315.32     21641.13
    sorts (memory)                      1091         3.78        20.58         1.15
    sorts (rows)                       12249        42.38       231.11        12.88
    table fetch by rowid               57246       198.08      1080.11         60.2
    table fetch continued row            111          .38         2.09          .12
    table scan blocks gotten          763421       2641.6     14404.17       802.76
    table scan rows gotten          13740187      47543.9    259248.81     14448.15
    table scans (long tables)            902         3.12        17.02          .95
    table scans (short tables)          4614        15.97        87.06         4.85
    total number commit cleanou         2489         8.61        46.96         2.62
    transaction rollbacks                  1            0          .02            0
    user calls                         15266        52.82       288.04        16.05
    user commits                         289            1         5.45           .3
    user rollbacks                        23          .08          .43          .02
    write requests                       331         1.15         6.25          .35Wait Events :
    Event Name                       Count         Total Time    Avg Time    
    SQL*Net break/reset to client                7             0             0
    SQL*Net message from client              16383             0             0
    SQL*Net message from dblink                424             0             0
    SQL*Net message to client                16380             0             0
    SQL*Net message to dblink                  424             0             0
    SQL*Net more data from client                1             0             0
    SQL*Net more data to client                 24             0             0
    buffer busy waits                          169             0             0
    control file sequential read                55             0             0
    db file scattered read                   74788             0             0
    db file sequential read                 176241             0             0
    latch free                                6134             0             0
    log file sync                              225             0             0
    rdbms ipc message                           10             0             0
    write complete waits                         4             0             0I did enable the timed_stats for the session but dont know why the times are 0's. Since I cant bounce the instance until weekend, cant enable the parameter in init.ora as well.

  • Partitioning on Oracle 8i (Rule Based vs. Cost Based)

    At my current engagement, we are using Oracle Financials 11.0.3 on Oracle 8.0.6. The application uses rule-based optimizer. The client wants to implement Oracle partitioning. With this in mind, we are concerned about possible performance issues that the implementation of partitioning may cause since RBO does not recognize it.
    We agree that the RBO will see a non-partitioned table the same as a partitioned. In this scenario where you gain the most is with backup/recoverability and general maintenance of the partitioned table.
    Nevertheless, we have a few questions:
    When implementing partitions, will the optimizer choose to go with Cost base vs. Rule base for these partitioned tables?
    Is it possible that the optimizer might get confused with this?
    Could it degrade performance at the SQL level?
    If this change from RBO to CBO does occur, the application could potential perform poorly because of the way it has been written.
    Please provide any feedback.
    Thanks in advance.

    If the CBO is invoked when accessing these tables, you may run into problems.
    - You'll have to analyze your tables & ensure that the statistics are kept up to date.
    - It's possible that any SQL statements which invoke the CBO rather than the RBO will have different performance characteristics. The SYSTEM data dictionary tables, for example, must use the RBO or their performance suffers dramatically. Most of the time, the CBO beats the RBO, but applications which have been heavily tuned with the RBO may have problems with the CBO.
    - Check your init.ora to see what optimizer mode you're in. If you're set to CHOOSE, the CBO will be invoked whenever statistics are available on the table(s) involved. If you choose RULE, you'll only invoke the CBO when the RBO encounters situations it doesn't have rules for.
    Justin

  • Rule based system in SQL

    we have an airline pricing system whose rules change often, and rather than re-designing tables and the client application code everytime that happens, we would like to develop a rule-based system to dynamically store the rules in a rule-based system that doesn't require re-design and code modification.
    any ideas ?
    here is an example of the data that we would like to store
    if seasonality is LOW
    and passenger is CHILD
    and carrier is TRW
    and origination is COS
    and destination is PIT
    and ticket code is Y
    then price is 908
    seasonality for carrier TRW is LOWfor travel between 01/15/06 to 04/15/06
    seasonality for carrier JAR is LOW for travel between 02/01/06 to 05/01/06
    age for carrier TRW is CHILD for passenger age betwen 2 and 12
    age for carrier JAR is CHILD for passenger age between 6 and 14
    .. and another price can be given with an entirely different set of rules
    reason is ask in this forum is I read a blog of someone who praises the set-based nature of the SQL language for developing exactly this kind of system, rather than trying to implement it on the client (for example using JRules)

    What version of Oracle are you on? 10g introduced a rules engine into the database (Oracle Rules Manager and/or Oracle Expression Filter) which would seem to be right up your alley.
    Justin

Maybe you are looking for