Commas in conditions

Hi,
I have a End User Layer and am trying to create worksheets against this.
I'm trying to create a worksheet with the following condition
'%'||TO_CHAR(TRUNC(SYSDATE-1),'DD-MM-YYYY')||'%'
I want to check a varchar2 field if it contains yesterdays date. The condition works fine when I test in SQLplus, but when I try to use the condition in discoverer it fails. What I've found out so far is that the comma(,) is replaced with an OR and that causes that no rows are returned.
Is there a workaround for this?
Regards Ragnar

Hi,
Thanks for your reply!
I've tried that and it seems the issue now is the quotes.
When I enter the condition as you described it adds a single quote after the '%' and one after the '$' . When I choose to show the sql the where condition looks like this:
AND ( O100174.DAY_LDESC LIKE '%''||yesterday||''$' )
I've tried adding and removing double and single quotes here and there, but haven't had any luck yet.
Ragnar

Similar Messages

  • Second transaction in the background in an EJB3 application?

    Hi!
    Is there any way (preferrably with container-managed persistence, but even manually) to implement 2 transactions in EJB3 that fullfil the following criteria:
    a)
    pseudo-code:
    T1 {
    doSomething1
    start T2 in background
    doSomething2
    commit
    T2 {
    doSomething
    commit
    b)
    conditions: T2 "depends" on T1 in the sense that
    1. T2 starts during T1
    2. if T1 is rolled back ==> T2 must be rolled back, too
    (==> this implies: T2 ends after T1 OR T2 waits for T1 to finish before committing)
    3. if T2 is rolled back ==> doesn't cause T1 to rollback
    c)
    graphically: (intended for viewing with a fixed-width font)
    ("_" = "commit", "." = waiting)
    T1
    [ ]---> T2
    OR
    T1
    [ ]---> T2
    [_]      _The hardest part seems to me to make T2 wait until T1 finishes (in the otherwise unlikely but possible case that T1 finishes first). You can safely presume that the two transactions run on the same JVM, but of course a solution that doesn't rely on this presumption would be even better.
    I have tried to find ways for T2 to somehow monitor T1, but on my first half-hearted try I couldn't find anything.
    Any ideas?
    Thanks,
    Agoston
    Edited by: 994954 on Mar 19, 2013 11:36 PM

    2. if T1 is rolled back ==> T2 must be rolled back, tooI don't think that's possible, the nested transaction is going to be isolated. Otherwise what would be the point of creating it!
    The hardest part seems to me to make T2 wait until T1 finishesImplying that T2 is created in a different thread, otherwise T1 would be suspended until T2 finishes in a normal container managed transaction environment. Why thread them when it matters in which order they finish?
    I have tried to find ways for T2 to somehow monitor T1, but on my first half-hearted try I couldn't find anythingPerhaps because you've been looking in the context of EJB technology, while you should have been researching 'java concurrency'.

  • Custome Process for update the date

    Hello Every one,
    I have a page with the check-box where the user can select a record and update the record by pressing on the button.
    I have three processes, and each of these process update one field ( which is a date field) of the page by pressing on the specific button. here are the three processes:
    declare
    begin
    for i in 1..apex_application.g_f01.count loop
    UPDATE  REC_RET_ADD_RECORD
    SET DATE_ADMIN_APPROVED=:P8_DATE_ADMIN_APPROVED
    WHERE REC_RET_ID = APEX_APPLICATION.G_F01(I);
    end loop;
    commit;
    end;
    Condition: When Admin button pressed (submit)
    The second process:
    declare
    begin
    for i in 1..apex_application.g_f01.count loop
    UPDATE REC_RET_ADD_RECORD
    SET DATE_COMMITTEE_APPROVED=:P8_DATE_COMMITTEE_APPROVED
    WHERE  REC_RET_ID = APEX_APPLICATION.G_F01(I);
    end loop;
    commit;
    end;
    Condition: When Committee button pressed (submit)
    The third process:
    declare
    begin
    for i in 1..apex_application.g_f01.count loop
    UPDATE REC_RET_ADD_RECORD
    SET DATE_OHS_APPROVED=:P8_DATE_OHS_APPROVED
    WHERE  REC_RET_ID = APEX_APPLICATION.G_F01(I);
    end loop;
    commit;
    end;
    Condition: When OHS button pressed (submit)
    Now the problem is, when the user selects the row and selects the date for Admin field and presses the Admin button, the system inserts the date but after that if the user wants to selects the same row and update the OHS date, the system will remove the date for Admin field and inserts the OHS date in OHS field and visa verse.
    I don't know why this is happening. Could you please help me. I appreciate it.

    Here is the report query:
    SELECT  apex_item.checkbox (1,
                               REC_RET_ID,
                               'onchange="spCheckChange(this);"',
                               :f_REC_RET_ID_list,
                              ) checkbox,
    "REC_RET_ID",
    "RET_SCHEDULE_NUM",
    "RET_COST_CENTER",
    "RET_TITLE",
    "RET_TITLE_DESC",
    "RET_PERIOD",
    "DATE_USER_INSERTED",
    "DATE_ADMIN_APPROVED",
    "DATE_COMMITTEE_APPROVED",
    "RC3_FORM_REQUIRE",
    "DATE_OHS_APPROVED",
    "DESTRUCTION_SUSPENDED",
    "DESTRUCTION_SUSPENDED_NOTE",
    "INACTIVE_DATE",
    "INACTIVE_DATE_APPROVED",
    "CREATION_DATE",
    "CREATED_BY",
    "LAST_UPDATE_DATE",
    "LAST_UPDATE_BY"
    from REC_RET_ADD_RECORD

  • Smart mailbox with multiple addresses

    It seams that creating a Smart Mailbox with "From" multiple addresses (comma separated) conditions works with INBOX emails... but the same idea does not work if it applies to SENT emails... any help?

    Hi Sanjay,
    Outlook would resolve the SMTP to Displayname if object is found in the GAL, hence no option for you to get that directly visible to the user, if he is accessing the email there.
    Quick way to find out would be checking the header info on the email
    To:  Field should essentially contain the email ID to which email was directed to.
    As an admin you can check this on the message tracking logs for the user.
    Sample Message Header below:
    Message-ID: <[email protected]>
    Received: from [158.143.113.49] by web60003.mail.yahoo.com via HTTP; Tue, 15 Jul 2003 12:14:24 BST
    Date: Tue, 15 Jul 2003 12:14:24 +0100 (BST)
    From: "Daniel Simpson" <[email protected]>
    Reply-To: <[email protected]>
    Subject: Test Email
    To: <[email protected]>
    MIME-Version: 1.0
    Content-Type: multipart/alternative;
    boundary="0-710479544-1058267664=:1719"
    Content-Transfer-Encoding: 8bit
    Return-Path: <[email protected]>
    Regards,
    Satyajit
    Please “Vote As Helpful”
    if you find my contribution useful or “Mark As Answer” if it does answer your question. That will encourage me - and others - to take time out to help you.

  • Condition Type for commissions across sales orders

    Hi,
    I have a requirement for which I need inputs:
    We have sales employee who will get commissions based on the total sales they make. The relevant sales employee will be brought into SAP as a business partner (specific account group and hence partner function).
    A tiered commission would be set up for each of the sales employee, for e.g. 1 to 10,000 , commission is 2 %, 10,000 to 30,000 commission is 3 % and above that is 5 %. The commission applicable should be determined at the time of sales order creation. The commission applied to an order should be determined based on all the sales orders for the sales employee and not that specific sales order. For e.g. if the sales employee has already got one sales order of worth 6000 and he gets another order of worth 9000, then as per the example, he is entitled to 2 % for 4000 of the order (his total sales now reacheds 10,000 and he moves now into the next bracket) and is entitled to 3% for 5000 of the order value. Also in case any order gets cancelled then the cumulative sales value for the sales employee should take care of the cancelled order.
    I have a condition type where by I maintain the scale and the corresponding commision rates for the sales employee. I have ticked the condition update setting so as to cumulate the order value. I have the following questions:-
    1. How do I ensure that the rate applicable for the specific order takes into consideration the past sales orders for the sales employee and not only that sales order.
    2. How do I determine the condition record based on parter function (partner funtion for the sales employee)? I did bring in the partner role in the pricing communication structure but that does not work.
    3. How should I take care that the cancellation or sales order takes out that value from the cumulative value for the condition record. As of now it does not.
    A quick response would be highly appreciated.

    Hi Kastubha,
    Thanks for your reply. I am trying now to use rebates for this functionality. However I have few questions and I am unable to progress beyond a point:
    Let's say that for a sales employee i set the rebate agreement. The sales employee's commission is as follows:
    1 - 10,000  (1 %)
    10, 000 - 30,000 (3%)
    30,000 and above (5%)
    The calculation type for condition type is percentage, scale type is graduated to interval scale.
    I am trying to use scale in rebate agreement to set up the commission structure for the sales employee. However, there is only accrual rate that I can enter. There is no place to enter the accrual rates as per the scale.
    Because of this, what is happening that the rebate record determined is the accrual rate and not what is as per the scale. Also I need the condition record to keep track of total sales for the employee so that it knows what commission rate to apply based on how much the sales employee has achieved.
    Am waiting for you inputs.
    Best Regards,
    Sunil

  • Forms Personalization issue condition error in post-forms-commit.

    I am trying to personalize PERWSEAC form (i.e. Assignment costing form in HRMS).
    In the post-forms-commit, I added condition like this
    :SYSTEM.CURRENT_BLOCK = 'COST' AND 1=1, when validated it is working fine.
    And at runtime it throws error like this "The condition :SYSTEM.CURRENT_BLOCK = 'COST' AND 1=1 could not be evaluated because of error"
    If condition is changed to :SYSTEM.CURRENT_BLOCK = 'COST' it works fine.
    Please suggest what is going wrong, before it was working fine.

    Hello,
    This is the "standalone" Forms forum. Ask personnalization questions in the dedicated E-Busines Suite forum.
    Francois

  • Standard Condition type for Commissions to customers

    Hey,
    Can you tell me which standard condition type i can use for the purpose of giving commisions to customers on the bases of Materials they have sold. (Customer/Material)
    Regards,
    Shahzad

    Hi,
    I dont think any std condition type is available for Commission.
    You can copy the std discount condition  type K007 if ur commssion is % basis,
    Or use K005 if commission is based on Qty and create Z condition type .
    Cond. class:Discount or surcharge
    Calculat.type:Percentage Or Qty
    Cond.category: Delivery costs
    Regards
    JJ

  • SQL Developer can't commit edited data in Table Data pane

    When I try to commit changes in "Data" pane for selected table SQL Developer gives me a strange error:
    One error saving changes to table "TABLENAME".:
    Row XXX: Data got commited in another/same session, cannot update row.
    I can see in the log that SQL Developer tries to do something like:
    UPDATE "TABLENAME" set "COLUMN"="value1" where ROWNUM="xxxx1" and ROW_SCN=nnn1;
    UPDATE "TABLENAME" set "COLUMN"="value2" where ROWNUM="xxxx2" and ROW_SCN=nnn1;
    UPDATE "TABLENAME" set "COLUMN"="value3" where ROWNUM="xxxx3" and ROW_SCN=nnn2;
    If I update the same rows in SQL window by other condition and do commit - all is OK. Why so strange behaivour?
    My table has not a primary key and no other users try to change it. SQL Developer version 3.0.04 and Oracle 10.2.0.4 Linux.
    Best regards,
    Sergey Logichev

    That's because the inaccuracy of ROW_SCN.
    I suggest you turn off Preferences - Database - ObjectViewer - Use ORA_ROWSCN (as I did the very moment we got the option).
    Have fun,
    K.

  • Problem with Conditional Page Process

    Application Express 3.1.0.00.32
    I have a conditional page process that whenever a user clicks on the create or save button, certain values are stored in one table and certain are stored in another dependent on the value of a page item.
    If a user opens a record and makes a change to the entry but doesn't change the current status, the information saved differs from when the current status is altered. Since the code, syntaxically, is correct, I'm more incliendeid to think this is an APEX issue however here is the code:
    declare
      v_current_status  pls_integer;
    begin
      select fk_lov_status_id
        into v_current_status
        from com_status
       where fk_proj_master_id = :P23_CS_FK_PROJ_MASTER_ID
         and pk_com_status_id = (select max(pk_com_status_id) from com_status);
    if v_current_status = :P23_FK_STATUS_ID then
      null;
      elsif (:P23_STATUS_COMMENT is null) then
        INSERT into com_status
          (fk_lov_status_id,
          fk_proj_master_id,
          status_comment)
        VALUES
          (:P23_FK_STATUS_ID,
          :P23_CS_FK_PROJ_MASTER_ID,
          'An update was not made to the status description.');
        commit;
      elsif (:P23_STATUS_COMMENT is not null) then
          INSERT into com_status
            (fk_lov_status_id,
            fk_proj_master_id,
            status_comment)
          VALUES
            (:P23_FK_STATUS_ID,
            :P23_CS_FK_PROJ_MASTER_ID,
            :P23_STATUS_COMMENT);
          commit;
      else
        null;
      end if;
    end;Condition Type is: Request is Contained within Expression 1 for the values of the push buttons (SAVE,CREATE)
    When Button Pressed is not conditional.
    When running the page, the error ORA-01403: no data found is given.
    In debug, the last couple of lines are:
    0.06: Processing point: AFTER_SUBMIT
    0.06: ...Process "Process Row of PROTRAC_MASTER": DML_PROCESS_ROW (AFTER_SUBMIT) #OWNER#:PROTRAC_MASTER:P23_PK_PROJ_MASTER_ID:PK_PROJ_MASTER_ID|IUD
    0.08: ...Process "com_status null_desc (apply)": PLSQL (AFTER_SUBMIT) declare v_current_status pls_integer; begin select fk_lov_status_id into v_current_status from com_status where fk_proj_master_id = :P23_CS_FK_PROJ_MASTER_ID and pk_com_status_id = (select max(pk_com_status_id) from com_sta
    0.08: Encountered unhandled exception in process type PLSQL
    0.08: Show ERROR page...
    0.08: Performing rollback...
    Any ideas would be appreciated.

    Here is the debug log after changing the status and not inputting any information in the description:
    The description isn't reporting as %null% even though the page item is empty, it is reporting as "".
    0.01: A C C E P T: Request="SAVE_bottom"
    0.01: Metadata: Fetch application definition and shortcuts
    0.01: NLS: wwv_flow.g_flow_language_derived_from=FLOW_PRIMARY_LANGUAGE: wwv_flow.g_browser_language=en-us
    0.01: alter session set nls_language="AMERICAN"
    0.01: alter session set nls_territory="AMERICA"
    0.01: NLS: CSV charset=WE8MSWIN1252
    0.01: ...NLS: Set Decimal separator="."
    0.01: ...NLS: Set NLS Group separator=","
    0.01: ...NLS: Set date format="DD-MON-RR"
    0.01: ...Setting session time_zone to -06:00
    0.02: Fetch session state from database
    0.02: ...Check session 1623472074064569 owner
    0.02: ...Metadata: Fetch Page, Computation, Process, and Branch
    0.02: Session: Fetch session header information
    0.02: ...Metadata: Fetch page attributes for application 527, page 23
    0.02: ...Validate item page affinity.
    0.02: ...Validate hidden_protected items.
    0.02: ...Check authorization security schemes
    0.02: Authorization Check: "2378670777792367583" User: "LREDMOND" Component: ""
    0.03: Session State: Save form items and p_arg_values
    0.03: ...Session State: Save "P23_NAME" - saving same value: "MAY TEST PROTRAC 60"
    0.03: ...Session State: Save "P23_DESCRIPTION" - saving same value: "may is testing protrac atleast 60 times."
    0.03: ...Session State: Save "P23_PROJ_MAN_ID" - saving same value: "%null%"
    0.03: ...Session State: Save "P23_TRACKIT_WORK_ORDER" - saving same value: ""
    0.03: ...Session State: Saved Item "P23_FK_STATUS_ID" New Value="17"
    0.03: ...Session State: Save "P23_STATUS_COMMENT" - saving same value: ""
    0.03: ...Session State: Save "P23_PK_PROJ_MASTER_ID_COUNT" - saving same value: "15 of 15"
    0.03: ...Session State: Save "P23_PK_PROJ_MASTER_ID_PREV" - saving same value: "16"
    0.03: ...Session State: Save "P23_PK_PROJ_MASTER_ID_NEXT" - saving same value: ""
    0.04: ...Session State: Save "P23_CS_FK_PROJ_MASTER_ID" - saving same value: "17"
    0.04: ...Session State: Save "P23_DATE_BEGIN" - saving same value: ""
    0.04: ...Session State: Save "P23_ESTIMATED_DATE" - saving same value: ""
    0.04: ...Session State: Save "P23_DATE_COMPLETED" - saving same value: ""
    0.04: ...Session State: Save "P23_APP_MANAGER_ID" - saving same value: "%null%"
    0.04: ...Session State: Save "P23_APP_MANAGER_PHONE" - saving same value: ""
    0.04: ...Session State: Save "P23_APP_MANAGER_EXT" - saving same value: ""
    0.04: ...Session State: Save "P23_REQUESTER_ID" - saving same value: "%null%"
    0.04: ...Session State: Save "P23_REQUESTER_PHONE" - saving same value: ""
    0.04: ...Session State: Save "P23_REQUESTER_EXT" - saving same value: ""
    0.04: ...Session State: Save "P23_FK_AGENCY_ID" - saving same value: "%null%"
    0.04: ...Session State: Save "P23_AGENCY_FNAME" - saving same value: ""
    0.04: ...Session State: Save "P23_AGENCY_LNAME" - saving same value: ""
    0.04: ...Session State: Save "P23_AGENCY_NUM" - saving same value: ""
    0.04: ...Session State: Save "P23_AGENCY_EXT" - saving same value: ""
    0.04: ...Session State: Save "P23_CREATEBY_USER" - saving same value: "MAY"
    0.04: ...Session State: Save "P23_CREATEBY_DATE" - saving same value: "01/21/2009"
    0.04: ...Session State: Save "P23_LASTMOD_USER" - saving same value: "LREDMOND"
    0.04: ...Session State: Save "P23_LASTMOD_DATE" - saving same value: "02/03/2009"
    0.05: ...Session State: Save "P0_LAST_CHANGE_DATE" - saving same value: "03-FEB-2009 14:15:46 by LREDMOND"
    0.05: Processing point: ON_SUBMIT_BEFORE_COMPUTATION
    0.05: Branch point: BEFORE_COMPUTATION
    0.05: Computation point: AFTER_SUBMIT
    0.05: ...Perform computation of item: P23_NAME, type=SQL_EXPRESSION
    0.05: ...Session State: Save "P23_NAME" - saving same value: "MAY TEST PROTRAC 60"
    0.05: ...Perform computation of item: P23_AGENCY_FNAME, type=SQL_EXPRESSION
    0.05: ...Session State: Save "P23_AGENCY_FNAME" - saving same value: ""
    0.05: ...Perform computation of item: P23_AGENCY_LNAME, type=SQL_EXPRESSION
    0.05: ...Session State: Save "P23_AGENCY_LNAME" - saving same value: ""
    0.05: Tabs: Perform Branching for Tab Requests
    0.05: Branch point: BEFORE_VALIDATION
    0.05: Perform validations:
    0.05: ...Item Not Null Validation: P23_NAME
    0.05: ...Item Not Null Validation: P23_DESCRIPTION
    0.05: ...Item Not Null Validation: P23_FK_STATUS_ID
    0.05: ...Regular expression validation: P23_AGENCY_NUM
    0.05: ...Regular expression validation: P23_REQUESTER_PHONE
    0.05: ...Regular expression validation: P23_APP_MANAGER_PHONE
    0.05: ...Item is numeric validation: P23_TRACKIT_WORK_ORDER
    0.06: ...Regular expression validation: P23_DATE_BEGIN
    0.06: ...Regular expression validation: P23_ESTIMATED_DATE
    0.06: ...Regular expression validation: P23_DATE_COMPLETED
    0.06: ...PL/SQL "function body returning boolean" Validation: if to_date(:P23_DATE_BEGIN, 'MM/DD/YYYY') > to_date(:P23_DATE_COMPLETED, 'MM/DD/YYYY') then return false; else return true; end if;
    0.06: ...PL/SQL "function body returning boolean" Validation: if to_date(:P23_DATE_COMPLETED, 'MM/DD/YYYY') < to_date(:P23_DATE_BEGIN, 'MM/DD/YYYY') then return false; else return true; end if;
    0.06: ...PL/SQL "function body returning boolean" Validation: if to_date(:P23_ESTIMATED_DATE, 'MM/DD/YYYY') < to_date(:P23_DATE_BEGIN, 'MM/DD/YYYY') then return false; else return true; end if;
    0.06: Branch point: BEFORE_PROCESSING
    0.06: Processing point: AFTER_SUBMIT
    0.06: ...Process "Process Row of PROTRAC_MASTER": DML_PROCESS_ROW (AFTER_SUBMIT) #OWNER#:PROTRAC_MASTER:P23_PK_PROJ_MASTER_ID:PK_PROJ_MASTER_ID|IUD
    0.07: ...Do not run process "com_status (create)", process point=AFTER_SUBMIT, condition type=NEVER, when button pressed=CREATE
    0.07: ...Process "com_status null status description": PLSQL (AFTER_SUBMIT) declare v_current_status pls_integer; begin select fk_lov_status_id into v_current_status from com_status where fk_proj_master_id = :P23_CS_FK_PROJ_MASTER_ID and pk_com_status_id = (select max(pk_com_status_id) from com_st
    0.08: ...Do not run process "ApplyMRD", process point=AFTER_SUBMIT, condition type=NEVER, when button pressed=DELETE
    0.08: ...Do not run process "AddRows", process point=AFTER_SUBMIT, condition type=NEVER, when button pressed=
    0.08: Branch point: AFTER_PROCESSING
    0.08: ...Evaluating Branch: AFTER_PROCESSING type: "REDIRECT_URL" button: (No Button Pressed) branch: SAVE,CREATE,SAVE_bottom,CREATE_bottom
    0.00:
    0.00: S H O W: application="527" page="23" workspace="" request="" session="1623472074064569"
    0.00: Language derived from: FLOW_PRIMARY_LANGUAGE, current browser language: en-us
    0.01: alter session set nls_language="AMERICAN"
    0.01: alter session set nls_territory="AMERICA"
    0.01: NLS: CSV charset=WE8MSWIN1252
    0.01: ...NLS: Set Decimal separator="."
    0.01: ...NLS: Set NLS Group separator=","
    0.01: ...NLS: Set date format="DD-MON-RR"
    0.01: ...Setting session time_zone to -06:00
    0.01: NLS: Language=en-us
    0.01: Application 527, Authentication: CUSTOM2, Page Template: 2731847145165324410
    0.01: ...Session ID 1623472074064569 can be used
    0.01: ...Application session: 1623472074064569, user=LREDMOND
    0.01: ...Determine if user "LREDMOND" workspace "37289604050814421" can develop application "527" in workspace "37289604050814421"
    0.01: Session: Fetch session header information
    0.01: Saving g_arg_names=P23_PK_PROJ_MASTER_ID and g_arg_values=17
    0.02: ...Session State: Save "P23_PK_PROJ_MASTER_ID" - saving same value: "17"
    0.02: ...Metadata: Fetch page attributes for application 527, page 23
    0.02: Fetch session state from database
    0.02: Branch point: BEFORE_HEADER
    0.02: Authorization Check: "2378670777792367583" User: "LREDMOND" Component: "PAGE"
    0.02: Fetch application meta data
    0.03: Computation point: BEFORE_HEADER
    0.03: Processing point: BEFORE_HEADER
    0.03: Show page template header
    0.04: Computation point: AFTER_HEADER
    0.04: Processing point: AFTER_HEADER
    0.04: ...Process "Fetch Row from PROTRAC_MASTER": DML_FETCH_ROW (AFTER_HEADER) F|#OWNER#:PROTRAC_MASTER:P23_PK_PROJ_MASTER_ID:PK_PROJ_MASTER_ID
    0.04: ...Process "Get Next or Previous Primary Key Value": GET_NEXT_OR_PREV_PK (AFTER_HEADER) #OWNER#:PROTRAC_MASTER:PK_PROJ_MASTER_ID::::P23_PK_PROJ_MASTER_ID:P23_PK_PROJ_MASTER_ID_NEXT:P23_PK_PROJ_MASTER_ID_PREV::::P23_PK_PROJ_MASTER_ID_COUNT:
    0.04: ...Session State: Save "P23_PK_PROJ_MASTER_ID_NEXT" - saving same value: ""
    0.04: ...Session State: Save "P23_PK_PROJ_MASTER_ID_PREV" - saving same value: "16"
    0.04: ...Session State: Save "P23_PK_PROJ_MASTER_ID_COUNT" - saving same value: "15 of 15"
    0.35: Computation point: AFTER_FOOTER
    0.35: Processing point: AFTER_FOOTER
    0.35: Log Activity:
    0.35: Execute Count=0
    0.35: End Show:

  • BAPI_PO_CHANGE, changing condition value in the purchase order

    Hi Friends,
    I have a requirement,
    a flat file is present in the application server that contains the information about PO,PO-ITEM,Condition type, movement type , condition value, plant, storage location .
    And i m calling the bapi "BAPI_PO_CHANGE" and passing the po number to it.
    the bapi returns the following tables, i_return, i_header,i_cond, i_item,i_itemx.
    But the purpose of calling the BAPI is, to check, if the condition value in the specified PO is '0', then it has to replace with the value of condition type present in the flat file.
    But when we check the tablei_return, its shows error type.
    And the PO is not updated with the new  condition value.
    Help me out in sorting this problem, by telling me
    what value is to be passed to the respective BAPI and what should i do to solve the issue?
    and after that i m using a BAPI " BAPI_GOODSMOVEMENT_CREATE".
    and it is for the purpose of creating the GR(Goods Receipt),
    when i go through the i_return table of the bapi, it si returning a message that "BAPI_201  Unable to create goods movement".
    Help me in proving the input to those bapi's and how can i get the expected output?
    And let me know, what the bapi's ,"BAPI_COMMIIT" and " BAPI_ROLLBACK" , will be doing?
    Edited by: kumar t on Aug 9, 2008 1:02 PM

    HI
    [Check the Link|http://abap.wikiprog.com/wiki/BAPI_PO_CHANGE]
    [Commit|http://abap.wikiprog.com/wiki/BAPI_TRANSACTION_COMMIT]
    [Roll Back|http://abap.wikiprog.com/wiki/BAPI_TRANSACTION_ROLLBACK]
    Regards
    Pavan

  • Change Pricing Condition for an item with CRM_ORDER_MAINTAIN

    Hi community,
    I try to change an existing condition with the function module crm_order_maintain.
    Everything looks fine, no error no dump, but no success
    The condition stays the same!
    Can anybody find a solution for this?
    Heres my report so far:
    *& Report  ZTEST_PRICING2
    REPORT  ztest_pricing2.
    DATA: lt_guid      TYPE crmt_object_guid_tab,
          lt_item      TYPE crmt_object_guid_tab,
          lt_saved     TYPE crmt_return_objects,
          lt_pridoc    TYPE crmt_pric_cond_t,
          ls_pridoc    TYPE crmt_pric_cond,
          lt_pricom    TYPE crmt_pridoc_comt,
          ls_pricom    TYPE crmt_pridoc_com,
          lt_header    TYPE crmt_orderadm_h_comt,
          lt_input     TYPE crmt_input_field_tab,
          ls_input     TYPE crmt_input_field,
          ls_input_fn  TYPE CRMT_INPUT_FIELD_NAMES,
          ls_cond_chg  TYPE prct_cond_external_change,
          ls_cond      TYPE PRCT_COND_DU,
          lt_pricing_i TYPE CRMT_PRICING_I_WRKT.
    PARAMETERS: lv_head TYPE crmt_object_guid DEFAULT 'C4C61C4E35DDF306E10000000A024089'.
    PARAMETERS: lv_item TYPE crmt_object_guid DEFAULT '09C71C4E35DDF306E10000000A024089'.
    PARAMETERS: lv_kbetr TYPE prct_cond_rate DEFAULT '100'.
    INSERT lv_head INTO TABLE lt_guid.
    INSERT lv_item INTO TABLE lt_item.
    CALL FUNCTION 'CRM_ORDER_READ'
      EXPORTING
        it_header_guid                    = lt_guid
        it_item_guid                      = lt_item
    *   IV_MODE                           =
    *   IV_ONLY_SPEC_ITEMS                =
    *   IT_REQUESTED_OBJECTS              =
    *   IV_NO_AUTH_CHECK                  =
    *   IT_ITEM_USAGE_RANGE               =
    *   IV_SUBITEM_DEPTH                  = -1
    *   IT_OBJECT_FILTER                  =
    *   IV_ONLY_CHANGED_OBJ               = FALSE
    *   IV_STATUS_H_CHECK_RELEVANCE       = FALSE
      IMPORTING
        et_pridoc                         = lt_pridoc
        et_pricing_i                      = lt_pricing_i
    * CHANGING
    *   CV_LOG_HANDLE                     =
    EXCEPTIONS
       document_not_found                = 1
       error_occurred                    = 2
       document_locked                   = 3
       no_change_authority               = 4
       no_display_authority              = 5
       no_change_allowed                 = 6
       OTHERS                            = 7.
    IF sy-subrc <> 0 AND lt_pridoc IS NOT INITIAL.
      WRITE: / 'ERROR'.
      EXIT.
    ENDIF.
    READ TABLE lt_pridoc INDEX 1 INTO ls_pridoc.
    IF sy-subrc <> 0.
      WRITE: / 'ERROR'.
      EXIT.
    ENDIF.
    READ TABLE ls_pridoc-pric_cond INTO ls_cond WITH KEY kschl = 'PB00'.
    IF sy-subrc <> 0.
      WRITE: / 'ERROR'.
      EXIT.
    ENDIF.
    ls_input-ref_guid   = lv_head.
    ls_input-ref_kind   = 'A'.
    ls_input-objectname = 'PRIDOC'.
    ls_input_fn-fieldname = 'WAERS'.
    INSERT ls_input_fn INTO TABLE ls_input-field_names.
    ls_input_fn-fieldname = 'KBETR'.
    INSERT ls_input_fn INTO TABLE ls_input-field_names.
    INSERT ls_input INTO TABLE lt_input.
    ls_pricom-ref_guid   = lv_head.
    ls_pricom-ref_kind   = 'A'.
    *ls_pricom-PRICING_TYPE  = 'B'.
    *ls_pricom-pricing_procedure = 'ZZMTA'.
    ls_pricom-pric_cond[] = ls_pridoc-pric_cond[].
    MOVE-CORRESPONDING ls_cond TO ls_cond_chg.
    ls_cond_chg-waers = 'EUR'.
    ls_cond_chg-kbetr = lv_kbetr.
    INSERT ls_cond_chg INTO TABLE ls_pricom-cond_change.
    APPEND ls_pricom TO lt_pricom.
    CALL FUNCTION 'CRM_ORDER_MAINTAIN'
      EXPORTING
        it_pridoc         = lt_pricom
      CHANGING
    *    ct_orderadm_h     = lt_header
        ct_input_fields   = lt_input
      EXCEPTIONS
        error_occurred    = 1
        document_locked   = 2
        no_change_allowed = 3
        no_authority      = 4
        OTHERS            = 5.
    IF sy-subrc <> 0.
      EXIT.
    ENDIF.
    CALL FUNCTION 'CRM_ORDER_SAVE'
      EXPORTING
        it_objects_to_save         = lt_guid
      IMPORTING
        et_saved_objects           = lt_saved
    *   ET_EXCEPTION               =
    *   ET_OBJECTS_NOT_SAVED       =
    EXCEPTIONS
       document_not_saved         = 1
       OTHERS                     = 2.
    IF sy-subrc EQ 0.
      COMMIT WORK AND WAIT.
    ELSE.
      ROLLBACK WORK.
    ENDIF.
    regards
    Markus

    Hello Jordi,
    The example below is whereby i was trying to copy all the pricing condition on one document to another and deleting what's not present on the source document.
    You can used this piece of code to adapt your requirement.
    CALL FUNCTION 'ZCRC_FM_COPY_PRICE_COND_ALL'
              EXPORTING
    id_object_guid_src    = <fs_el_con_guid>
    id_object_guid_dest = <fs_el_so_guid>
    id_commit                  = abap_false
              EXCEPTIONS
    not_allowed         = 1
    error_occured     = 2
    OTHERS                 = 3.
      PERFORM f_recup_donnees USING     id_object_guid_src
                                                              id_object_guid_dest.
    PERFORM f_modif_condition_prix USING id_object_guid_src
                                                                                      id_object_guid_dest.
    PERFORM f_header_copy_pricing using id_object_guid_src
                                                                            id_object_guid_dest.
    FORM f_recup_donnees   USING      pd_object_guid_src TYPE crmt_object_guid
                                                                           pd_object_guid_dest TYPE crmt_object_guid.
      DATA:
         lt_header_guid        TYPE crmt_object_guid_tab.
      INSERT pd_object_guid_src  INTO TABLE lt_header_guid.
      INSERT pd_object_guid_dest INTO TABLE  lt_header_guid.
      CLEAR: gt_orderadm_i, gt_doc_flow.
      CALL FUNCTION 'CRM_ORDER_READ'
        EXPORTING
          it_header_guid       = lt_header_guid
        IMPORTING
          et_doc_flow          = gt_doc_flow            
          et_orderadm_i        = gt_orderadm_i
        EXCEPTIONS
          document_not_found   = 1
          error_occurred       = 2
          document_locked      = 3
          no_change_authority  = 4
          no_display_authority = 5
          no_change_allowed    = 6
          OTHERS               = 7.
      IF sy-subrc NE 0.
        RAISE error_occured.
      ENDIF.
    " F_RECUP_DONNEES
    FORM f_modif_condition_prix USING pd_guid_src TYPE crmt_object_guid
                                      pd_guid_dest TYPE crmt_object_guid.
      DATA : ld_pd_handle_src     TYPE prct_handle,
              ld_pd_handle_dest    TYPE prct_handle,
              lt_komv_print_src    TYPE prct_cond_print_t,
    lt_komv_print_dest   TYPE prct_cond_print_t,
              ls_komv_print_dest   LIKE LINE OF lt_komv_print_dest,
              ls_komv_print_src    LIKE LINE OF lt_komv_print_src,
              lt_cond_chg          TYPE prct_cond_print_t,
              lt_cond_chg_insert   TYPE prct_cond_print_t,
              ls_cond_chg          TYPE prct_cond_print,
              ls_cond_chg_tmp      TYPE prct_cond_print,
              ls_input_fields      TYPE crmt_input_field,
              lt_input_fields      TYPE crmt_input_field_tab.
      DATA : bal_log         TYPE balloghndl,
             lt_item_ret     TYPE prct_item_ret_t,
             lt_cond_ret     TYPE prct_cond_print_t,
             ld_data_changed TYPE xfeld,
             gv_decimal      TYPE usdefaults-dcpfm,
             ld_lines        TYPE i,
             ld_ajout_cond   TYPE abap_bool.
      FIELD-SYMBOLS : <fs_orderadm_i_dest>  TYPE crmt_orderadm_i_wrk,
    <fs_orderadm_i_src>   TYPE crmt_orderadm_i_wrk,
                      <fs_cond_chg>         TYPE prct_cond_print,
    <fs_cond_chg_insert>  TYPE prct_cond_print.
    * Début Ajout CD1K904313-001.
      DATA: ld_guid_src  TYPE crmt_object_guid.
      FIELD-SYMBOLS: <fs_doc_flow>  TYPE crmt_doc_flow_wrk.
    * Début Ajout CD1K904313-001.
    * Verrouillage des documents source et destinataire
      PERFORM f_lock_document USING pd_guid_src.
      PERFORM f_lock_document USING pd_guid_dest.
    *Récupérer le pricing handle des documents
    * Document source
      CALL FUNCTION 'CRM_PRIDOC_GET_HANDLE_OW'
        EXPORTING
    iv_header_guid             = pd_guid_src
        IMPORTING
    ev_pd_handle               = ld_pd_handle_src
        EXCEPTIONS
    error_occurred             = 1
    handle_determination_error = 2
          orgdata_error              = 3
          OTHERS                     = 4.
      IF sy-subrc <> 0.
        RETURN.
      ENDIF.
    * Document destinataire
      CALL FUNCTION 'CRM_PRIDOC_GET_HANDLE_OW'
        EXPORTING
          iv_header_guid             = pd_guid_dest
        IMPORTING
          ev_pd_handle               = ld_pd_handle_dest
        EXCEPTIONS
          error_occurred             = 1
          handle_determination_error = 2
          orgdata_error              = 3
          OTHERS                     = 4.
      IF sy-subrc <> 0.
        RETURN.
      ENDIF.
    * A ne pas traiter les postes de type ZPDF
      DELETE  gt_orderadm_i WHERE itm_type = 'ZPDF'.
      LOOP AT gt_orderadm_i ASSIGNING <fs_orderadm_i_dest> WHERE header = pd_guid_dest.
        REFRESH : lt_komv_print_src,
                  lt_komv_print_dest,
    lt_cond_chg,
    lt_cond_chg_insert.
    * Début Modif CD1K904313-001.
    * Récupérer le guid de l'item liée au item destinataire.
        READ TABLE gt_doc_flow ASSIGNING <fs_doc_flow> WITH KEY objkey_b = <fs_orderadm_i_dest>-guid.
        CHECK sy-subrc EQ 0.
        ld_guid_src = <fs_doc_flow>-objkey_a.
    *    READ TABLE gt_orderadm_i ASSIGNING <fs_orderadm_i_src> WITH KEY header = pd_guid_src
    * number_int = <fs_orderadm_i_dest>-number_int.
    * Fin Modif CD1K904313-001.
    * Récupérer les pricing document
        IF sy-subrc EQ 0.
    *     Document source
          CALL FUNCTION 'PRC_PD_ITEM_SHOW'
            EXPORTING
              iv_pd_handle        = ld_pd_handle_src
    *         iv_item_no          = <fs_orderadm_i_src>-guid    "Supression CD1K904313-001
              iv_item_no          = ld_guid_src                 "Addition CD1K904313-001
            IMPORTING
              et_komv_print       = lt_komv_print_src
            EXCEPTIONS
              non_existing_handle = 1
              non_existing_item   = 2
              ipc_error           = 3
              OTHERS              = 4.
        ENDIF.
    *   Document destinataire
        CALL FUNCTION 'PRC_PD_ITEM_SHOW'
          EXPORTING
            iv_pd_handle        = ld_pd_handle_dest
            iv_item_no          = <fs_orderadm_i_dest>-guid
          IMPORTING
    et_komv_print       = lt_komv_print_dest
          EXCEPTIONS
            non_existing_handle = 1
            non_existing_item   = 2
            ipc_error           = 3
            OTHERS              = 4.
    * Modification et Suppression des conditions de prix
        LOOP AT lt_komv_print_dest INTO ls_komv_print_dest .
          CLEAR: ls_cond_chg,
                 ls_komv_print_src.
          MOVE-CORRESPONDING ls_komv_print_dest TO ls_cond_chg.
    * Rechercher la condition sur le document source
          READ TABLE lt_komv_print_src INTO ls_komv_print_src WITH KEY kschl = ls_komv_print_dest-kschl
    zaehk = ls_komv_print_dest-zaehk. "CD1K904313
          IF sy-subrc EQ 0.
            ls_cond_chg-kbetr_prt = ls_komv_print_src-kbetr_prt.
            ls_cond_chg-kwert     = ls_komv_print_src-kwert.
            ls_cond_chg-kinak     = ls_komv_print_src-kinak.
          ELSEIF ls_cond_chg-kschl IS NOT INITIAL.
            CLEAR ls_cond_chg.
            CONTINUE.
          ENDIF.
    *     Format décimal
          CASE gv_decimal.
            WHEN space.       "format N.NNN,NN
              REPLACE ALL OCCURRENCES OF '.' IN ls_cond_chg-kbetr_prt WITH ','.
            WHEN 'Y'.         "format N NNN NNN,NN
              REPLACE ALL OCCURRENCES OF '.' IN ls_cond_chg-kbetr_prt WITH ','.
          ENDCASE.
          INSERT ls_cond_chg INTO TABLE lt_cond_chg.
          CLEAR ls_cond_chg.
        ENDLOOP.
    * Ajout des conditions de prix
        LOOP AT lt_komv_print_src INTO ls_komv_print_src WHERE kschl IS NOT INITIAL.
          CLEAR: ls_cond_chg, ld_lines, ls_komv_print_dest, ls_cond_chg_tmp, ld_ajout_cond.
    * Vérifier la présence de la condition sur le document destinataire
          READ TABLE lt_komv_print_dest INTO ls_komv_print_dest WITH KEY kschl = ls_komv_print_src-kschl
    zaehk = ls_komv_print_src-zaehk. "CD1K904313.
          IF sy-subrc EQ 0.
            CLEAR: ls_cond_chg, ls_komv_print_dest.
            CONTINUE.
          ELSE.
            DESCRIBE TABLE lt_cond_chg LINES ld_lines.
            READ TABLE lt_cond_chg INTO ls_cond_chg_tmp INDEX ld_lines.
            IF sy-subrc EQ 0.
              ld_ajout_cond = abap_true.
              MOVE-CORRESPONDING ls_komv_print_src TO ls_cond_chg.
              ls_cond_chg-knumv     = ls_cond_chg_tmp-knumv.
              ls_cond_chg-kposn     = ls_cond_chg_tmp-kposn.
              ls_cond_chg-stunr     = ls_cond_chg_tmp-stunr + 10.
            ELSE.
              CLEAR: ls_cond_chg, ld_lines, ls_komv_print_dest, ls_cond_chg_tmp.
              CONTINUE.
            ENDIF.
          ENDIF.
    *     Format décimal
          CASE gv_decimal.
            WHEN space.             "format N.NNN,NN
              REPLACE ALL OCCURRENCES OF '.' IN ls_cond_chg-kbetr_prt WITH ','.
            WHEN 'Y'.               "format N NNN NNN,NN
              REPLACE ALL OCCURRENCES OF '.' IN ls_cond_chg-kbetr_prt WITH ','.
          ENDCASE.
    * Récupérer les nouvelles conditions qui seront ajouté au document destinataire
          IF ld_ajout_cond EQ abap_true.
            INSERT ls_cond_chg INTO TABLE lt_cond_chg_insert.
          ENDIF.
          INSERT ls_cond_chg INTO TABLE lt_cond_chg.
          CLEAR ls_cond_chg.
        ENDLOOP.
        CALL FUNCTION 'PRC_INT_ITEM_INPUT'
          EXPORTING
            iv_pd_handle        = ld_pd_handle_dest
            iv_item_no          = <fs_orderadm_i_dest>-guid
            it_cond_prt         = lt_cond_chg
            iv_bal_log          = bal_log
            iv_req_ret          = abap_true
            iv_req_cond_prt     = abap_true
          IMPORTING
            et_item_ret         = lt_item_ret
            et_cond_prt         = lt_cond_ret
            ev_data_changed     = ld_data_changed
          EXCEPTIONS
            non_existing_handle = 1
            non_existing_item   = 2
            ipc_error           = 3.
        IF sy-subrc = 0.
    *     En cas d'ajout de nouvelles conditions de prix, appeler le MF PRC_INT_ITEM_INPUT
    *     avec les montants
          IF lt_cond_chg_insert IS NOT INITIAL.
            REFRESH lt_cond_chg[].
            lt_cond_chg[] = lt_cond_ret[].
            LOOP AT lt_cond_chg_insert ASSIGNING <fs_cond_chg_insert>.
              READ TABLE lt_cond_chg ASSIGNING <fs_cond_chg> WITH KEY kschl = <fs_cond_chg_insert>-kschl.
              IF sy-subrc EQ 0.
                <fs_cond_chg>-kwert     = <fs_cond_chg_insert>-kwert.
                <fs_cond_chg>-kbetr_prt = <fs_cond_chg_insert>-kbetr_prt.
              ENDIF.
            ENDLOOP.
            REFRESH lt_cond_ret[].
            CALL FUNCTION 'PRC_INT_ITEM_INPUT'
              EXPORTING
                iv_pd_handle        = ld_pd_handle_dest
                iv_item_no          = <fs_orderadm_i_dest>-guid
                it_cond_prt         = lt_cond_chg
                iv_bal_log          = bal_log
                iv_req_ret          = abap_true
                iv_req_cond_prt     = abap_true
              IMPORTING
                et_item_ret         = lt_item_ret
                et_cond_prt         = lt_cond_ret
                ev_data_changed     = ld_data_changed
              EXCEPTIONS
                non_existing_handle = 1
                non_existing_item   = 2
                ipc_error           = 3.
          ENDIF.
    *   Publish event afin de sauvegarder les conditions de prix
          CALL FUNCTION 'CRM_EVENT_PUBLISH_OW'
            EXPORTING
              iv_obj_name = 'PRIDOC'
              iv_guid_hi  = pd_guid_dest
              iv_kind_hi  = 'A'
              iv_event    = 'SAVE'
            EXCEPTIONS
              OTHERS      = 1.
    *   As no order_maintain will follow implicitly and therefore no
    *   exec times for the events will be set, call CRM_ORDER_MAINTAIN
    *   without any parameters
    *   Then the exec time 'end of document' will be set and with the
    *   group logic also all exec times before
    *   But at least one object is needed in input_fields
    *   --> use PRIDOC
          ls_input_fields-ref_guid   = <fs_orderadm_i_dest>-guid.
          ls_input_fields-ref_kind   = 'B'.
          ls_input_fields-objectname = 'PRIDOC'.
          INSERT ls_input_fields INTO TABLE lt_input_fields.
          CLEAR ls_input_fields.
          CALL FUNCTION 'CRM_ORDER_MAINTAIN'
            CHANGING
              ct_input_fields   = lt_input_fields
            EXCEPTIONS
              error_occurred    = 1
              document_locked   = 2
              no_change_allowed = 3
              no_authority      = 4
              OTHERS            = 5.
        ENDIF.
      ENDLOOP.
    " F_MODIF_CONDITION_PRIX
    *& Form  F_LOCK_DOCUMENT
    * Verrouillage d'un document
    FORM f_lock_document  USING pd_guid TYPE crmt_object_guid.
      CONSTANTS : lc_orderadm_h TYPE  crmt_object_name  VALUE 'ORDERADM_H',
                  lc_orderadm_i TYPE  crmt_object_name  VALUE 'ORDERADM_I'.
      DATA: lv_process_mode      TYPE crmt_mode,
            lv_order_initialized TYPE crmt_boolean,
            lv_process_type      TYPE crmt_process_type,
            lv_already_locked    TYPE abap_bool.
      DATA: ls_admin_ui_status  TYPE crmt_admin_ui_status,
            ls_item_usage_range TYPE crmt_item_usage_range.
      DATA: lt_objects_to_read   TYPE crmt_object_guid_tab,
            lt_requested_objects TYPE crmt_object_name_tab,
            lt_item_usage_range  TYPE crmt_item_usage_range_tab,
            lt_locked_contract   TYPE crmt_object_guid_tab.
      INSERT pd_guid INTO TABLE lt_objects_to_read.
      INSERT lc_orderadm_h INTO TABLE lt_requested_objects.
      INSERT lc_orderadm_i INTO TABLE lt_requested_objects.
      ls_item_usage_range-sign  = 'E'.
      ls_item_usage_range-value = '02'.
      INSERT ls_item_usage_range INTO TABLE lt_item_usage_range.
    * LAM: Financing Options should be viewed in a separate screen:
      ls_item_usage_range-sign  = 'E'.
      ls_item_usage_range-value = '05'.   "Financing options
      INSERT ls_item_usage_range INTO TABLE lt_item_usage_range.
    *-> read document in change mode
      CALL FUNCTION 'CRM_ORDER_READ'
        EXPORTING
          it_header_guid       = lt_objects_to_read
          iv_mode              = 'B'
          it_requested_objects = lt_requested_objects
          it_item_usage_range  = lt_item_usage_range
        EXCEPTIONS
          document_not_found   = 1
          error_occurred       = 2
          document_locked      = 3
          no_change_authority  = 4
          no_display_authority = 5
          OTHERS               = 6.
      PERFORM enqueue_order IN PROGRAM saplcrm_order_ow IF FOUND
        USING pd_guid
              abap_false
              abap_false
              abap_false
    CHANGING sy-subrc
              lv_already_locked
              lt_locked_contract.
    " F_LOCK_DOCUMENT
    * Fin Ajout CD1K904074-001
    FORM f_header_copy_pricing  USING   pd_guid_src
    pd_guid_dest.
      DATA : ld_pd_handle_src     TYPE prct_handle,
              ld_pd_handle_dest    TYPE prct_handle,
              lt_komv_print_src    TYPE prct_cond_print_t,
    lt_komv_print_dest   TYPE prct_cond_print_t,
              ls_komv_print_dest   LIKE LINE OF lt_komv_print_dest,
              ls_komv_print_src    LIKE LINE OF lt_komv_print_src,
              lt_cond_chg          TYPE prct_cond_print_t,
              ls_cond_chg          TYPE prct_cond_print,
              ls_input_fields      TYPE crmt_input_field,
              lt_input_fields      TYPE crmt_input_field_tab.
      DATA : bal_log         TYPE balloghndl,
             lt_cond_ret     TYPE prct_cond_print_t,
             ld_data_changed TYPE xfeld,
             gv_decimal      TYPE usdefaults-dcpfm.
    * Verrouillage des documents source et destinataire
      PERFORM f_lock_document USING pd_guid_src.
      PERFORM f_lock_document USING pd_guid_dest.
    *  Récupérer le pricing handle des documents
    * Document source
      CALL FUNCTION 'CRM_PRIDOC_GET_HANDLE_OW'
        EXPORTING
          iv_header_guid             = pd_guid_src
        IMPORTING
          ev_pd_handle               = ld_pd_handle_src
        EXCEPTIONS
          error_occurred             = 1
          handle_determination_error = 2
          orgdata_error              = 3
          OTHERS                     = 4.
      IF sy-subrc <> 0.
        RETURN.
      ENDIF.
    * Document destinataire
      CALL FUNCTION 'CRM_PRIDOC_GET_HANDLE_OW'
        EXPORTING
          iv_header_guid             = pd_guid_dest
        IMPORTING
          ev_pd_handle               = ld_pd_handle_dest
        EXCEPTIONS
          error_occurred             = 1
          handle_determination_error = 2
          orgdata_error              = 3
          OTHERS                     = 4.
      IF sy-subrc <> 0.
        RETURN.
      ENDIF.
    *  * Récupérer les pricing document
    *  Document Source
      CALL FUNCTION 'PRC_PD_HEAD_SHOW'
        EXPORTING
          iv_pd_handle        = ld_pd_handle_src
        IMPORTING
          et_komv_print       = lt_komv_print_src
        EXCEPTIONS
          non_existing_handle = 1
          ipc_error           = 2
          OTHERS              = 3.
      CHECK sy-subrc EQ 0.
    *  Document Destinataire
      CALL FUNCTION 'PRC_PD_HEAD_SHOW'
        EXPORTING
          iv_pd_handle        = ld_pd_handle_dest
        IMPORTING
    et_komv_print       = lt_komv_print_dest
        EXCEPTIONS
          non_existing_handle = 1
          ipc_error           = 2
          OTHERS              = 3.
      CHECK sy-subrc EQ 0.
    *  * Modification et Suppression des conditions de prix
      LOOP AT lt_komv_print_src INTO ls_komv_print_src .
        CLEAR: ls_cond_chg,
               ls_komv_print_dest.
        MOVE-CORRESPONDING ls_komv_print_src TO ls_cond_chg.
    * Rechercher la condition sur le document source
        READ TABLE lt_komv_print_dest INTO ls_komv_print_dest WITH KEY kschl = ls_komv_print_src-kschl
    zaehk = ls_komv_print_src-zaehk.
        IF sy-subrc EQ 0.
          IF ls_komv_print_src-kbetr NE ls_komv_print_dest-kbetr.
            ls_cond_chg-kbetr_prt = ls_komv_print_src-kbetr_prt.
            ls_cond_chg-kwert     = ls_komv_print_src-kwert.
            ls_cond_chg-kinak     = ls_komv_print_src-kinak.
            CASE gv_decimal.
              WHEN space.       "format N.NNN,NN
                REPLACE ALL OCCURRENCES OF '.' IN ls_cond_chg-kbetr_prt WITH ','.
              WHEN 'Y'.         "format N NNN NNN,NN
                REPLACE ALL OCCURRENCES OF '.' IN ls_cond_chg-kbetr_prt WITH ','.
            ENDCASE.
          ENDIF.
        ENDIF.
        CLEAR ls_cond_chg-krech.
        INSERT ls_cond_chg INTO TABLE lt_cond_chg.
        CLEAR ls_cond_chg.
      ENDLOOP.
      CALL FUNCTION 'PRC_INT_HEAD_INPUT'
        EXPORTING
          iv_pd_handle        = ld_pd_handle_dest
          iv_bal_log          = bal_log
          it_cond_prt         = lt_cond_chg
          iv_req_ret          = abap_true
          iv_req_cond_prt     = abap_true
        IMPORTING
          et_cond_prt         = lt_cond_ret
          ev_data_changed     = ld_data_changed
        EXCEPTIONS
          non_existing_handle = 1
          ipc_error           = 2
          not_allowed         = 3
          OTHERS              = 4.
      CHECK sy-subrc EQ 0.
    *    *   Publish event afin de sauvegarder les conditions de prix
      CALL FUNCTION 'CRM_EVENT_PUBLISH_OW'
        EXPORTING
          iv_obj_name = 'PRIDOC'
          iv_guid_hi  = pd_guid_dest
          iv_kind_hi  = 'A'
          iv_event    = 'SAVE'
        EXCEPTIONS
          OTHERS      = 1.
    *   As no order_maintain will follow implicitly and therefore no
    *   exec times for the events will be set, call CRM_ORDER_MAINTAIN
    *   without any parameters
    *   Then the exec time 'end of document' will be set and with the
    *   group logic also all exec times before
    *   But at least one object is needed in input_fields
    *   --> use PRIDOC
      ls_input_fields-ref_guid   = pd_guid_dest.
      ls_input_fields-ref_kind   = 'A'.
      ls_input_fields-objectname = 'PRIDOC'.
      INSERT ls_input_fields INTO TABLE lt_input_fields.
      CLEAR ls_input_fields.
      CALL FUNCTION 'CRM_ORDER_MAINTAIN'
        CHANGING
          ct_input_fields   = lt_input_fields
        EXCEPTIONS
          error_occurred    = 1
          document_locked   = 2
          no_change_allowed = 3
          no_authority      = 4
          OTHERS            = 5.
    ENDFORM.
    FORM f_header_copy_pricing  USING   pd_guid_src
    pd_guid_dest.
      DATA : ld_pd_handle_src     TYPE prct_handle,
              ld_pd_handle_dest    TYPE prct_handle,
              lt_komv_print_src    TYPE prct_cond_print_t,
    lt_komv_print_dest   TYPE prct_cond_print_t,
              ls_komv_print_dest   LIKE LINE OF lt_komv_print_dest,
              ls_komv_print_src    LIKE LINE OF lt_komv_print_src,
              lt_cond_chg          TYPE prct_cond_print_t,
              ls_cond_chg          TYPE prct_cond_print,
              ls_input_fields      TYPE crmt_input_field,
              lt_input_fields      TYPE crmt_input_field_tab.
      DATA : bal_log         TYPE balloghndl,
             lt_cond_ret     TYPE prct_cond_print_t,
             ld_data_changed TYPE xfeld,
             gv_decimal      TYPE usdefaults-dcpfm.
      PERFORM f_lock_document USING pd_guid_src.
      PERFORM f_lock_document USING pd_guid_dest.
    *  Récupérer le pricing handle des documents
    * Document source
      CALL FUNCTION 'CRM_PRIDOC_GET_HANDLE_OW'
        EXPORTING
          iv_header_guid             = pd_guid_src
        IMPORTING
          ev_pd_handle               = ld_pd_handle_src
        EXCEPTIONS
          error_occurred             = 1
          handle_determination_error = 2
          orgdata_error              = 3
          OTHERS                     = 4.
      IF sy-subrc <> 0.
        RETURN.
      ENDIF.
    * Document destinataire
      CALL FUNCTION 'CRM_PRIDOC_GET_HANDLE_OW'
        EXPORTING
          iv_header_guid             = pd_guid_dest
        IMPORTING
          ev_pd_handle               = ld_pd_handle_dest
        EXCEPTIONS
          error_occurred             = 1
          handle_determination_error = 2
          orgdata_error              = 3
          OTHERS                     = 4.
      IF sy-subrc <> 0.
        RETURN.
      ENDIF.
    *  * Récupérer les pricing document
    *  Document Source
      CALL FUNCTION 'PRC_PD_HEAD_SHOW'
        EXPORTING
          iv_pd_handle        = ld_pd_handle_src
        IMPORTING
          et_komv_print       = lt_komv_print_src
        EXCEPTIONS
          non_existing_handle = 1
          ipc_error           = 2
          OTHERS              = 3.
      CHECK sy-subrc EQ 0.
    *  Document Destinataire
      CALL FUNCTION 'PRC_PD_HEAD_SHOW'
        EXPORTING
          iv_pd_handle        = ld_pd_handle_dest
        IMPORTING
    et_komv_print       = lt_komv_print_dest
        EXCEPTIONS
          non_existing_handle = 1
          ipc_error           = 2
          OTHERS              = 3.
      CHECK sy-subrc EQ 0.
    *  * Modification et Suppression des conditions de prix
      LOOP AT lt_komv_print_src INTO ls_komv_print_src .
        CLEAR: ls_cond_chg,
               ls_komv_print_dest.
        MOVE-CORRESPONDING ls_komv_print_src TO ls_cond_chg.
    * Rechercher la condition sur le document source
        READ TABLE lt_komv_print_dest INTO ls_komv_print_dest WITH KEY kschl = ls_komv_print_src-kschl
    zaehk = ls_komv_print_src-zaehk.
        IF sy-subrc EQ 0.
          IF ls_komv_print_src-kbetr NE ls_komv_print_dest-kbetr.
            ls_cond_chg-kbetr_prt = ls_komv_print_src-kbetr_prt.
            ls_cond_chg-kwert     = ls_komv_print_src-kwert.
            ls_cond_chg-kinak     = ls_komv_print_src-kinak.
            CASE gv_decimal.
              WHEN space.       "format N.NNN,NN
                REPLACE ALL OCCURRENCES OF '.' IN ls_cond_chg-kbetr_prt WITH ','.
              WHEN 'Y'.         "format N NNN NNN,NN
                REPLACE ALL OCCURRENCES OF '.' IN ls_cond_chg-kbetr_prt WITH ','.
            ENDCASE.
          ENDIF.
        ENDIF.
        CLEAR ls_cond_chg-krech.
        INSERT ls_cond_chg INTO TABLE lt_cond_chg.
        CLEAR ls_cond_chg.
      ENDLOOP.
      CALL FUNCTION 'PRC_INT_HEAD_INPUT'
        EXPORTING
          iv_pd_handle        = ld_pd_handle_dest
          iv_bal_log          = bal_log
          it_cond_prt         = lt_cond_chg
          iv_req_ret          = abap_true
          iv_req_cond_prt     = abap_true
        IMPORTING
          et_cond_prt         = lt_cond_ret
          ev_data_changed     = ld_data_changed
        EXCEPTIONS
          non_existing_handle = 1
          ipc_error           = 2
          not_allowed         = 3
          OTHERS              = 4.
      CHECK sy-subrc EQ 0.
      CALL FUNCTION 'CRM_EVENT_PUBLISH_OW'
        EXPORTING
          iv_obj_name = 'PRIDOC'
          iv_guid_hi  = pd_guid_dest
          iv_kind_hi  = 'A'
          iv_event    = 'SAVE'
        EXCEPTIONS
          OTHERS      = 1.
      ls_input_fields-ref_guid   = pd_guid_dest.
      ls_input_fields-ref_kind   = 'A'.
      ls_input_fields-objectname = 'PRIDOC'.
      INSERT ls_input_fields INTO TABLE lt_input_fields.
      CLEAR ls_input_fields.
      CALL FUNCTION 'CRM_ORDER_MAINTAIN'
        CHANGING
          ct_input_fields   = lt_input_fields
        EXCEPTIONS
          error_occurred    = 1
          document_locked   = 2
          no_change_allowed = 3
          no_authority      = 4
          OTHERS            = 5.

  • Data not submitting when I have a conditional display on a date field

    Hello all,
    Could someone please help me with the following issue?
    I have created an updateable report region with four updateable fields. 3 of the fields store a number values and the fourth stores a date value.
    Each updateable report item has a conditional display, and whether they are displayed or not is controlled by the end user using a radio group (with submit). This provides the user with three options.
    If I remove all conditional displays all data will commit to the database without any problems. If I apply the conditional display to the number fields only, again the data will commit as normal. However, as soon as I add a conditional display to the date field it all goes pair shaped. The data will then cease to commit, with no error message at all. Once I remove the conditional display normal service is resumed.
    I'm certainly an APEX novice at the moment, so I wondered if anyone could shed some light on this.
    Thanks in advance for your help
    Steve

    Stew,
    Basically, I have edited each applicable report field column attributes, via the report attributes tab, and selected a conditional display 'Value of item in Expression 1 = Expression 2' for all of them.
    In the same report region I have created a radiogoup with submit called p51_update_type, specifying three static return values; R, F and S
    Condition e.g.
    *"Expression 1"*
    p51_update_type
    *"Expression 2"*
    S
    All columns display as expected, and commits to the database are normal, that is until I apply a conditional display to the date field (which relates to a table column of type DATE in the database).
    Thanks
    Steve

  • How to prevent duplication on a column with condition

    Hello everyone,
    I need some advice here. At work, we have an Oracle APEX app that allow user to add new records with the automatic increment decision number based on year and group name.
    Says if they add the first record , group name AA, for year 2012, they get decision number AA 1 2013 as their displayed record casein the report page.
    The second record of AA in 2013 will be AA 2 2013.
    If they add about 20 records , it will be AA 20 2013.
    The first record for 2014 will be AA 1 2014.
    However, recently , we get a user complaint about two records from the same group name have the same decision number.
    When I looked into the history table, and find that the time gap between 2 record is just about 0.1 seconds.
    Besides, we have lookup table that allows admin user to update the Start Sequence number with the restraint that it has to be larger than the max number of the current group name of the current year.
    This Start sequence number and group name is stored together in a table.
    And in some other special case,user can add a duplicate decision number for related record. (this is a new function)
    The current procedure logic to add new record on the application are
    _Get max(decision_number) from record table with chosen Group Name and current year.
    _insert into the record table the new entered record with decision number + 1
    _ update sequence number to the just added decision number.
    So rather than utitlising APEX built-in automatic table modification process, I write a procedure that combine all the three process.
    I run some for loop to continuously execute this procedure, and it seems it can autotically generate new unique decision number with time gap about 0.1 second.
    However, when I increase the number of entry to 200, and let two users run 100 each.
    If the time gap is about 0.01 second, Duplicate decision numbers appear.
    What can I do to prevent the duplication ?
    I cannot just apply a unique constraint here even for all three columns with condition, as it can have duplicate value in some special condition. I don't know much about using lock and its impact.
    This is the content of my procedure
    create or replace
    PROCEDURE        add_new_case(
      --ID just use the trigger
      p_case_title IN varchar2,
      p_year IN varchar2,
      p_group_name IN VARCHAR2,
      --decisionnumber here
      p_case_file_number IN VARCHAR2,
      --active
      p_user IN VARCHAR2
    AS
      default_value NUMBER;
        caseCount NUMBER;
      seqNumber NUMBER;
      previousDecisionNumber NUMBER;
    BEGIN
      --execute immediate q'[alter session set nls_date_format='dd/mm/yyyy']';
      SELECT count(*)
            INTO caseCount
            FROM CASE_RECORD
            WHERE GROUP_ABBR = p_group_name
            AND to_number(to_char(create_date, 'yyyy')) = to_number(to_char(date_utils.get_current_date, 'yyyy'));
            SELECT max(decision_number)
            INTO previousDecisionNumber
            FROM CASE_RECORD
            WHERE GROUP_ABBR = p_group_name
            AND to_number(to_char(create_date, 'yyyy')) = to_number(to_char(date_utils.get_current_date, 'yyyy'));
            IF p_group_name IS NULL
            THEN seqNumber := 0;
            ELSE   
            SELECT seq_number INTO seqNumber FROM GROUP_LOOKUP WHERE ABBREVATION = p_group_name;
            END IF;
        IF caseCount > 0 THEN
               default_value := greatest(seqNumber, previousdecisionnumber)+1;
        ELSE
               default_value := 1;
        END IF; 
      INSERT INTO CASE_RECORD(case_title, decision_year, GROUP_ABBR, decision_number, case_file_number, active_yn, created_by, create_date)
      VALUES(p_case_title, p_year, p_group_name, default_value, p_case_file_number, 'Y', p_user, sysdate );
      --Need to update sequence here also
      UPDATE GROUP_LOOKUP
      SET SEQ_NUMBER = default_value
      WHERE ABBREVATION = p_group_name;
      COMMIT;
    EXCEPTION
    WHEN OTHERS THEN
        logger.error(p_message_text => SQLERRM
                    ,p_message_code => SQLCODE
                    ,p_stack_trace  => dbms_utility.format_error_backtrace
        RAISE;
    END;
    Many thanks in advance,
    Ann

    Why not using a sequence for populating the decision_number column ?
    Sequence values are guaranteed to be unique so there's no need to lock anything.
    You'll inevitably have gaps and no different groups will have the same decision_number in common.
    Having to deal with consecutive numbers fixations you can proceed as
    with
    case_record as
    (select 2012 decision_year,'AA' group_abbr,1 decision_number from dual union all
    select 2012,'BB',2 from dual union all
    select 2012,'AA',21 from dual union all
    select 2012,'AA',22 from dual union all
    select 2012,'BB',25 from dual union all
    select 2013,'CC',33 from dual union all
    select 2013,'CC',34 from dual union all
    select 2013,'CC',36 from dual union all
    select 2013,'BB',37 from dual union all
    select 2013,'AA',38 from dual union all
    select 2013,'AA',39 from dual union all
    select 2013,'BB',41 from dual union all
    select 2013,'AA',42 from dual union all
    select 2013,'AA',43 from dual union all
    select 2013,'BB',45 from dual
    select decision_year,
           group_abbr,
           row_number() over (partition by decision_year,group_abbr order by decision_number) decision_number,
           decision_number sequence_number -- not shown (noone needs to know you're using a sequence)
      from case_record
    order by decision_year,group_abbr,decision_number
    DECISION_YEAR
    GROUP_ABBR
    DECISION_NUMBER
    SEQUENCE_NUMBER
    2012
    AA
    1
    1
    2012
    AA
    2
    21
    2012
    AA
    3
    22
    2012
    BB
    1
    2
    2012
    BB
    2
    25
    2013
    AA
    1
    38
    2013
    AA
    2
    39
    2013
    AA
    3
    42
    2013
    AA
    4
    43
    2013
    BB
    1
    37
    2013
    BB
    2
    41
    2013
    BB
    3
    45
    2013
    CC
    1
    33
    2013
    CC
    2
    34
    2013
    CC
    3
    36
    for retrieval (assuming decision_year,group_abbr,decision_number as being the key):
    select decision_year,group_abbr,decision_number -- the rest of columns
      from (select decision_year,
                   group_abbr,
    -- the rest of columns
                   row_number() over (partition by decision_year,group_abbr order by decision_number) decision_number
              from case_record
             where decision_year = :decision_year
               and group_abbr = :group_abbr
    where decision_number = :decision_number
    DECISION_YEAR
    GROUP_ABBR
    DECISION_NUMBER
    2013
    AA
    4
    if that's acceptable
    Regards
    Etbin

  • Report Template, Column Template, Column Template Condition

    I have a template, Standard Revenue from Standard, I have cloned for a Classic report.
    Application ###>Shared Componets>Templates>Edit Report Template
    Column Template 1 looks like:
    <td#ALIGNMENT# headers="#COLUMN_HEADER_NAME#" class="t1data_revenue">#COLUMN_VALUE#</td>
    I have set Column Template 1 Condition to:
    "Use based on PL/SQL expresiion"
    I have tried several expression in "Column Template 1 Expression" - last one is:
    case
    when #COLNUM# <= 2 then false
    when #COLUMN_VALUE# < 0 then true
    else false
    end case;
    I am trying to use the value in "Column Template 2" when to value of the #COLUMN_VALUE# < 0
    where "Column Template 2" is :
    <td#ALIGNMENT# headers="#COLUMN_HEADER_NAME#" class="t1data_revenue_negative">#COLUMN_VALUE#</td>
    I get the following error when I run the page:
    ORA-01403: no data found
    and
    ERR-1025 Error processing PLSQL expression. case when #COLNUM# <= 2 then false when #COLUMN_VALUE# < 0 then true else false end case;
    Any help will be appreciated.
    thank you,
    jwm

    Hi,
    That's actually easier. See: [http://apex.oracle.com/pls/otn/f?p=267:60]
    The SQL for both reports is:
    SELECT EMPNO, ENAME, NVL(SAL,0) SAL, NVL(COMM,0) COMM
    FROM EMP
    ORDER BY EMPNOThe SAL and COMM columns have been formatted using:
    999G999G999G999G990D00For the Row Template, the Row Template 1 setting contains an empty space (you have to have something in there otherwise Apex adds back in a default row containing five cells!). The condition for this is:
    TO_NUMBER('#COMM#','999G999G999G999G990D00') < 100The template will see the data as a string, so we use the same number format to convert that string back into a number and compare this to 100. If we didn't use formatting on the numbers and we are sure that every row contained a number (hence the use of NVL()), then you could use:
    #COMM# < 100Row Template 2 contains the format for the rows that need displaying:
    &lt;tr&gt;
    &lt;td class="t18Data"&gt;#1#&lt;/td&gt;
    &lt;td class="t18Data"&gt;#2#&lt;/td&gt;
    &lt;td class="t18Data" style="text-align:right"&gt;#3#&lt;/td&gt;
    &lt;td class="t18Data" style="text-align:right"&gt;#4#&lt;/td&gt;
    &lt;/tr&gt;and is unconditional.
    The only other settings on the Row Template are the Before Rows:
    &lt;table class="t18Standard" style="border-collapse:collapse; border:1px solid black;"&gt;
    &lt;tr&gt;
      &lt;th class="t18ReportHeader"&gt;Empno&lt;/th&gt;
      &lt;th class="t18ReportHeader"&gt;Ename&lt;/th&gt;
      &lt;th class="t18ReportHeader" style="text-align:right"&gt;Sal&lt;/th&gt;
      &lt;th class="t18ReportHeader" style="text-align:right"&gt;Comm&lt;/th&gt;
    &lt;/tr&gt;and After Rows:
    &lt;/table&gt;Of course, you will note that the record counters at the bottom still show the number of records in both reports - as the SQL still outputs the same data, this doesn't change.
    Andy

  • How can I retrieve the condition in an update or delete using instead of trigger

    I have 2 tables, on which a view is created. To distinguish the tables within the view trigger, a column "source" had been added in the view creation. I want to be able to delete row(s) in table t1 or table t2 through the view, depending on a condition. The problem is that I don't know how I can get back the delete condition IN the INSTEAD of trigger :
    CREATE TABLE t1(m NUMBER, n VARCHAR2(10), o date);
    CREATE TABLE t2(a NUMBER, b VARCHAR2(10), c date);
    -- The view is created based on the 2 tables.
    CREATE OR REPLACE VIEW vt12 AS
    SELECT 't1' source, m, n, o
    FROM t1
    UNION
    SELECT 't2' source, a, b, c
    FROM t2;
    -- The trigger will fire whenever INSERT is performed on the tables through the view
    create or replace trigger tvt12 instead of insert or delete on vt12
    begin
    if inserting then
    if :new.source = 't1' then
    insert into t1 values (:new.m, :new.n, :new.o);
    else
    -- will insert a default value of -1 for the fourth column "d"
    insert into t2(a,b,c,d) values (:new.m, :new.n, :new.o, -1);
    end if;
    elsif deleting then
    -- We don't know the condition for the deletion, so all rows from the
    -- table from which the current row is coming will be deleted
    if :old.source = 't1' then
    delete t1;
    else
    delete t2;
    end if;
    end if;
    end;
    show error
    insert into vt12 values ('t1',1,'1',sysdate);
    insert into vt12 values ('t2',2,'2',sysdate+1);
    insert into vt12 values ('t1',3,'3',sysdate+2);
    insert into vt12 values ('t2',4,'4',sysdate+3);
    insert into vt12 values ('t1',5,'5',sysdate+4);
    insert into vt12 values ('t2',6,'6',sysdate+5);
    commit;
    select * from vt12;
    select * from t1;
    select * from t2;
    delete vt12 where m = 1;
    commit;
    select * from vt12;
    select * from t1;
    select * from t2;
    When I execute this script, the delete statement seems to recognize that the condition is affecting a row in table t1, and therefore deletes all rows from the table, as specified in the delete statement of the trigger... But, what I want to do is ONLY to delete the row affected by the original condition. So my question is to know how I can get back the original condition for the delete, and still use it in the trigger, that will be executed INSTEAD of the delete statement.. I checked in the doc, and everywhere an example of INSTEAD OF trigger can be found, but it's always and only using an INSTEAD OF INSERT trigger, which doesn't need a condition.
    Can anyone help ?
    null

    I've never faced this case myself, but from the documentation it would seem that the INSTEAD OF DELETE is also a FOR EACH ROW trigger. Therefore, you don't really have to worry about the actual "where" clause of the original "delete" operation: Oracle has it all parsed for you, so you just need to redirect, in turn, each view record being deleted to the appropriate table.
    In extenso: for your
    delete vt12 where m = 1;
    => the INSTEAD OF trigger fires once for all records in vt12 where m=1, and I would guess that you trigger code should look like:
    begin
    delete from t1 where m = :old.m and n = :old.n and o = :old.o;
    delete from t2 where a = :old.m and b = :old.n and c = :old.o;
    end;
    It's a bit of overkill compared to the "where" clause of the original "delete" statement, but it should do the job...
    BTW, if by any luck you do have some primary key on tables t1 and t2 (say: columns o and c respectively), then obviously you can make the thing simpler:
    begin
    delete from t1 where o = :old.o;
    delete from t2 where c = :old.o;
    end;
    HTH - Didier

Maybe you are looking for