How to have OUT parameter for see if transaction have been posted correctly

I've a package procedure that reads data from a staging tables into their corresponding target tables. The below procedure variables are in the package specification and body. I need to create another procedure that ensures data has been sent to both target tables successfully.
If successful, commits the transaction. If not, ensures all matching records are deleted from target tables.
Outcome will have two possible values "success" or "failure."
Failure would indicate things such as transaction not found, transaction does not match from source to target tables.
However I need to create another procedure that reads the value of o_outcome parameter in the below procedure code such that if the parameter is a success then commit, and if failure has happened then delete all match records up until that point. I am using Oracle 11.2.0.2 and TOAD 10.5.1.3.
  PROCEDURE edw_rex_pos_trans (p_begin_date     IN     DATE,
                             p_end_date       IN     DATE,
                             p_extract_type   IN     VARCHAR2,
                             o_outcome           OUT VARCHAR2)
IS
   v_extract_type            edw_pos_extract_log.extract_type%TYPE
                                := UPPER (p_extract_type);
   v_begin_date              edw_rex_head_extract.create_date%TYPE := p_begin_date;
   v_end_date                edw_rex_head_extract.create_date%TYPE := p_end_date;
   v_log_seq_nbr             edw_extract_log.log_seq_nbr%TYPE;
   v_record_count            edw_extract_log.record_count%TYPE := 0;
   e_dates_must_match        EXCEPTION;
   e_begin_date_higher       EXCEPTION;
   l_tran_seq_nbr            NUMBER;
   CURSOR edw_rex_head (
      v_begin_date    DATE,
      v_end_date      DATE)
   IS
      SELECT *
        FROM edw_rex_head_extract h
       WHERE 1 = 1
             AND TRUNC (h.create_date) BETWEEN v_begin_date AND v_end_date;
BEGIN
   IF v_begin_date <> v_end_date
      AND (v_extract_type = 'DAILY' OR v_extract_type = 'MANUAL')
   THEN
      RAISE e_dates_must_match;
   ELSIF v_begin_date > v_end_date
   THEN
      RAISE e_begin_date_higher;
===========================================================
   ELSE                             
      SELECT edw_extract_log_seq.NEXTVAL INTO v_log_seq_nbr FROM DUAL;
      DBMS_OUTPUT.PUT_LINE ('SELECTED next log_seq_nbr = ' || v_log_seq_nbr);
      DBMS_OUTPUT.
       PUT_LINE ('INSERTING record into bcf_pos_extract_log table');
      edw_extract_log_table.insert_log_entry (v_log_seq_nbr,
                                              'BCFPOS_TO_REX_EXTRACT',
                                              v_extract_type,
                                              v_begin_date,
                                              v_end_date,
                                              'STARTED',
                                              'bcfpos_to_rex_extract');
      DBMS_OUTPUT.PUT_LINE ('FINISHED creating log entry');
      v_record_count := 0;
     DBMS_OUTPUT. PUT_LINE ('SELECTING data and INSERTING it into REX tables');
      FOR edw_rex_head_rec IN edw_rex_head (v_begin_date, v_end_date)
      LOOP
         v_record_count := v_record_count + 1;
         SELECT navistor.kcpos_tran_seq.NEXTVAL@rex
           INTO l_tran_seq_nbr
           FROM DUAL;
         BEGIN
           INSERT INTO kcpos_tran_header (TRAN_SEQ_NBR,
                               ORG_NUMBER,
                               STORE_NUMBER,
                               TRAN_DATE,
                               TERMINAL_NUMBER,
                               TRAN_NUMBER,
                               TRAN_TIME,
                               BATCH_NUMBER,
                               BATCH_TYPE,
                               TRAN_TYPE)
           VALUES (l_tran_seq_nbr,
             1,
             edw_rex_head_rec.store_number,
             edw_rex_head_rec.tran_date,
             edw_rex_head_rec.terminal_number,
             edw_rex_head_rec.tran_number,
             edw_rex_head_rec.tran_time,
             edw_rex_head_rec.batch_number,
             edw_rex_head_rec.batch_type,
             edw_rex_head_rec.tran_type);
  -- Table 2          
INSERT INTO kcpos_tran_line (TRAN_SEQ_NBR,
                                                   TRAN_LINE_NBR,
                                                   ORG_NUMBER,
                                                   STORE_NUMBER,
                                                   TRAN_DATE,
                                                   TERMINAL_NUMBER,
                                                   TRAN_NUMBER,
                                                   TRAN_TIME,
                                                   TRAN_TYPE)
   SELECT l_tran_seq_nbr,
          tran_line_nbr,
          1,
          store_number,
          tran_date,
          terminal_number,
          tran_number,
          tran_time,
          tran_type
     FROM edw_rex_line_extract
    WHERE     1 = 1
          AND edw_rex_seq_nbr = edw_rex_head_rec.edw_rex_seq_nbr
          AND revision_number = edw_rex_head_rec.revision_number
          AND store_number = edw_rex_head_rec.store_number
          AND tran_date = edw_rex_head_rec.tran_date
          AND terminal_number = edw_rex_head_rec.terminal_number
          AND tran_number = edw_rex_head_rec.tran_number
          AND TRUNC (create_date) BETWEEN v_begin_date AND v_end_date;
EXCEPTION
              WHEN OTHERS THEN
                 DBMS_OUTPUT.put_line (TO_CHAR (SQLCODE) || ' ' || SQLERRM);
                 l_error := TO_CHAR (SQLCODE) || ' ' || SUBSTR(SQLERRM,1,300);
                 v_record_count := v_record_count - 1;
END LOOP;
          DBMS_OUTPUT.PUT_LINE('Total transactions inserted: ' || v_record_count);
           DBMS_OUTPUT.PUT_LINE('UPDATING log table');
         o_outcome := 'SUCCESS';
END IF;
   EXCEPTION
      WHEN e_dates_must_match THEN
         o_outcome  := 'FAILURE';
       -- insert into error log table
      WHEN e_begin_date_higher THEN
         o_outcome  := 'FAILURE';
       -- insert into error log table
      WHEN OTHERS THEN
         DBMS_OUTPUT.put_line (TO_CHAR (SQLCODE) || ' ' || SQLERRM);
         o_outcome  := 'FAILURE';
         --- insert into error log table
      END;

Barnes12 wrote:
I've a package procedure that reads data from a staging tables into their corresponding target tables. The below procedure variables are in the package specification and body. I need to create another procedure that ensures data has been sent to both target tables successfully.
If successful, commits the transaction. If not, ensures all matching records are deleted from target tables.
Outcome will have two possible values "success" or "failure."
Failure would indicate things such as transaction not found, transaction does not match from source to target tables.
However I need to create another procedure that reads the value of o_outcome parameter in the below procedure code such that if the parameter is a success then commit, and if failure has happened then delete all match records up until that point. I am using Oracle 11.2.0.2 and TOAD 10.5.1.3.Why do you wish to see if the Parameter is returned as SUCCESS?
Step 1: Load the data into Target Tables.
Step 2: Delete the data from Staging Tables.
Step 3: Verify if all the data is proper and there are no errors (Logical)
Step 4: If No errors, Commit the transaction.
Step 5: If any error, then Rollback the transaction.
Step 4, 5 ensures the data is either Inserted and Deleted or is untouched.
Thus, you can negate the need for another sub-program to verify it!!!
Regards,
P.

Similar Messages

  • How to clear incoming payement for the invoices which has been posted through payement terms

    Hi All ,
    Could any one help me on the below problem which i am facing from last 1 month.
    Here is my activity which i have done.
    1) i posted one invoice in f-22 with the payment term 002 which is predefined by SAP.
    01 - CUSTOMER A/C
    50 - SALES A/C with the amount 3000
    2) Now i want to clear incoming payment through F-28
    entry will come for Bank a/c and customer a/c
    now if i want to clear the amount of 3000 and i m getting the error message'correct the marked line item'
    please find the screenshot below for the same and help me to resolve this issue.
    Thanks
    Ashutosh

    Hi Ashutosh,
    Great - now you know the required field (Asset retirement) that is causing the error. (It is obviously not the Text field - otherwise it would be marked as such on the screenshot.)
    The second question is - does it make sense to push asset retirement here? Normally, you do it on an account for a revenue from asset sale, not on cash in transit.
    If yes, then after ticking the checkbox and pushing Enter, you will get a popup box, asking you to enter a number of fixed asset that you want to retire, plus perhaps some other data (sorry, I do not have it in front of me). When saving the document, the system will then automatically add lines for setting to zero (or reducing) asset value and accummulated depreciation against gain/loss from sale (or revenue vs cost), as per your AA configuration. Is this what you want?
    If not, then check if you have the correct field status assigned to the account (in trans. FS03, tab "Create / bank / interest").
    Good luck!

  • How to get out of for loop in eclipse debugging

    How to get out of for loop in eclipse debugging for java classes ?
    I am in a for loop in a code. i want to get out of it ...but how ?

    is changing the behaviour of a running class like that really going to be any use for debugging? what's the actual problem?

  • How to remove payment block for AP invoices which has been cleared

    How to remove payment block for AP invoices which has been cleared
    Thanks
    Chiru

    Hi,
    Thanks for immediate response in fb02 is in deable mode
    mrbr unable to change
    please provide to to remove blocking code i will assign points
    Thnaks
    Chiru

  • Goods receipt for purchase assignments has not been posted

    Hi all;
    In Vl02n in goods issue steps i have a message "Goods receipt for purchase assignments has not been posted"
    -the purchas order is assined to items delivery correctelly!
    -in our case, we haven't a stock.
    -after goods issue in vl02n we have tow goods mvt (101 for goods receipt) and (601 for goods issue) for the same quantity.
    so can you tell me how to solve this problem
    thx

    ok sir ;
    No i don't talke abouat STP i don't have any transit stock it's a simpl sales based on global purchas
    -first with me21n i created global purchas order
    -the sales will be picked from this purchas .
    -delivery is assigned automatically to this purchas order  with user exit.
    -with vl02n in goods issue steps there is tow operations ( stock mvt 101 in purchas assignement and a normal 601 for delivery )

  • Goods receipt for purchase assignments has not been posted. Mes. no. O1573

    Dear expert,
    I got a proplem with Intercompany STO as detail below:
    Goods receipt for purchase assignments has not been posted.
    Message no. O1573
    Diagnosis
    Certain fields needed for posting Goods Receipt have not been entered.
    System Response
    The goods receipt for Purchase Assignment was not posted.
    Procedure
    Check the error log and make the required entry.
    process Step by steps:
    1- create PO (intercompany PO) --> save
    2- create SO to sell to endcustomer (at receiving company)
    3- create DO
    4- assign the previewous PO to DO  (exchange function)
    5- PGI ---> problem as above
    Please, kindly help

    Dear all,
    In this case,  if I enter itemcategory "U" into PO I can post GR and GI at the same time I do PGI. but you know if I use "U" which mean I can't enter the net price as normal because this is a "stock transfer".
    Is there any ideal for this?
    Please, help me

  • What is the SAFEST SEQUENCE to convert from a Outlook/iPad/iPhone synced with MobileMe to syncing with iCloud (I have 10 years of calendar diary events and 3000 contacts) - I am worried about the data issues that have been posted about iCloud.

    What is the SAFEST SEQUENCE to convert from a Outlook/iPad/iPhone synced with MobileMe to syncing with iCloud (I have 10 years of calendar diary events and 3000 contacts) - I am worried about the data issues that have been posted about iCloud.
    This has worked fine with MobileMe with only a couple of minor glitches in the past.
    Any experience doing this the "right" way?

    The warranty entitles you to complimentary phone support for the first 90 days of ownership.

  • No activities have been posted

    Hi All,
    I am getting the following error message when i am calculating Actual price
    T.Code - KSII
    No activities have been posted
    Message no. KP254
    Diagnosis
    No activity consumption was posted in controlling area 1400 in fiscal year 2009.
    System Response
    Actual prices cannot be calculated for activity quantities or process quantities that do not exist. The system cannot therefore calculate activity prices.
    Procedure
    Post activity consumption in controlling area 1400.
    Thanks,
    Raj

    It shows that you have not posted any Activities in that period , for which you want to do the price calculation. Please check your cost center line item (KSB1)report and check whether system has any Qty data for these activtiy type in that period.
    regards
    Ranjan

  • How set and get parameter for a session of a portlet (Java)

    I would like get parameter and set parameter for a portlet in portal 9.02. This parameter must be availbale during the session of the portal.
    With Java Servlet
    // I retrieve my session
    HttpServletRequest httpreq = (HttpServletRequest)req;
    HttpServletResponse httpresp = (HttpServletResponse)resp;
    HttpSession session = httpreq.getSession();
    //And after i can get or set some parameter for this servlet
    //Example
    session.setAttribute("MyEmployeeNumber","600000");
    String id = (String)session.getAttribute("MyEmployeeNumber");
    // But with Portlet in portal, i can't do it.
    PortletRenderRequest pr= (PortletRenderRequest)httpreq.getAttribute(HttpCommonConstants.PORTLET_RENDER_REQUEST);
    String sUser=pr.getUser().getName();
    ProviderSession session=pr.getSession();
    // But after if i want get or set a value in this session i have a internal error 500
    session.setAttribute("MyEmployeeNumber","600000");
    I would like my parameter is avalaible during a session for a user in each page of the portal, because my portlet is on each page.

    I have almost the same problem. I tried as you suggested, but it doesn't work yet.
    provider.xml
    <session>true</session>
    <passAllUrlParams>true</passAllUrlParams>
    My code in my jsp-portlet is
    <%@page contentType="text/html; charset=windows-1252"
    import="oracle.portal.provider.v2.render.PortletRenderRequest"
    import="oracle.portal.provider.v2.render.PortletRendererUtil"
    import="oracle.portal.provider.v2.http.HttpCommonConstants"
    import="oracle.portal.provider.v2.ParameterDefinition"
    import="oracle.portal.provider.v2.render.http.HttpPortletRendererUtil"
    %>
    <%@page session="true"%>
    <%
    PortletRenderRequest pReq = (PortletRenderRequest)request.getAttribute(HttpCommonConstants.PORTLET_RENDER_REQUEST);
    String valueSession = (String)pReq.getAttribute("sesion");
    if (valueSession != null) {
    pReq.setAttribute("session", "value1");
    out.println("<br>(1)valueSession != null");
    out.println("<br>(1)valueSession : " + pReq.getAttribute("session"));
    } else {
    pReq.setAttribute("session", "value2");
    out.println("<br>(2)valueSession == null");
    out.println("<br>(2)valueSession : " + pReq.getAttribute("session"));
    %>
    And i always get as result:
    (2)valueSession == null
    (2)valueSession : value2
    Even when i send values (post) at the same page or browsing between tabs:
    I check my provider registration and it has the value "once per session"
    I have portal 9.0.2.2.14
    Thanks

  • How to disable selection parameter for a particular radio button

    hi experts,
    How to disable selection parameter(bukrs) for a particular radio button 'radio1'.

    hi,
    Check This Code (copy paste and run it ).
    U have to use MODIF ID along with the parameter.
    *----------------Option
    *---Background
    *---Summary Report
    PARAMETERS       : p_backgd RADIOBUTTON GROUP rad1
                       USER-COMMAND radio DEFAULT 'X'.
    PARAMETERS       : p_sumrep RADIOBUTTON GROUP rad1 .
    *----------------File
    PARAMETERS       : p_sumfl TYPE char255 modif id ABC  .
    PARAMETERS       : p_detfl TYPE char255 modif id ABC.
    *---------------Activate & Deactivate Screen Fields--------------------*
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF p_sumrep = 'X'.
          IF screen-group1  = 'ABC'.
            screen-input  = '0'.
            MODIFY SCREEN.
          ENDIF.
        ENDIF.
      ENDLOOP.
    <b>Please Reward Points & Mark Helpful Answers</b>
    To mark Helpful Answers ;click radio Button next to the post.
    RadioButtons
    <b>o</b> Helpful Answer
    <b>o</b> Very helpful Answer
    <b>o</b> Problem Solved.
    Click any of the above button next to the post; as per the anwers
    <b>To close the thread; Click Probelm solved Radio Button next to the post ,
    which u feel is best possible answers</b>

  • How to find out the userid  is ddic,  how to find out thepassword for this.

    hi
      i am mohan. We user-id is DDIC. we forgot the password for this user id. how to find out the password for this. we find the table for this usr02. but it is hexa decimal code. how to find that code

    hi
      check these threads
    Re: Check SAP username and password.
    Re: Validation of user name, pwd  in ZXUSRU01 exit
    if helpful, reward
    Sathish. R

  • Need to increase the Time out  parameter for executing BI queries

    Folks,
    We are publishing BI Query on portal , we are getting Time out error while executing the quries , please let me know how to increment the time out parameter
    Thanks
    Manish

    Hi Manish,
    Try this link
    Time out time
    Cheers....

  • How to find out tcode for the zprogram.

    Hi All,
    How to find out the Tcode of a Zprogram.
    I will appritiate your help.
    Thanks,
    Veni.

    Couple of ways to do this,  one is to go to SE93 and do F4 on the transaction code field, click information system,  click the all selections icon, then put the name of the z program in the field, and hit enter,  this will give you the tcode.
    Regards,
    RIch Heilman
    Message was edited by:
            Rich Heilman

  • How to take a report for the assigned transaction and activity in a role

    Hi Colleagues,
    I want to take a report for the assigned transaction with activity for all roles, which are assigned to the users,
    Transaction list for a role i can able to take it from SUIM but not able to take the ACTVT for the role.
    Please suggest how to take this information.
    BR,
    Jai

    Hi Jaikumar from the post :
    I think you have reached the state of finding the USER to ROLE relationship
    Take the output to an excel,
    COPY just the roles column exactly in order do not rearrange , use AGR_1251 like other experts have mentioned
    insert the roles copied from you buffer and execute, the output will have multiple entries for each role take the output to an EXCEL again , make it unique and match the outputs between both the EXCELS.
    It will be a little tricky to do this, but I think you are proficient in MS EXCEL.
    This is one of the ways to do , there are many other ways to do it.

  • HT2534 How does one get reimbursed for an app that has been immediately deleted after download and open?

    I downloaded an app that cost $7.99 and immediately realized that it was not functional the way I understood it to be. I deleted the app and now I wqould like to be reimbursed.
    How does one go about getting that accomplished?
    Thanks - George

    Dear telwow,
    Apple did not do anything to solve this problem, they said I shoud apply to ITunes which I did. However, ITunes in Belgium does not even have a customer friendly call center, and they reply with standard info if you apply by e-mail which have no relevance to my problem. As I do not have hours to spend on the phone, I tasked my secretary to call Itunes many times. In the end, she found someone to look into the matter which took months.
    Simultaneously, I applied to VISA through my bank for fraud investigation. I had to cancel my credit card. In the end, VISA paid my money back and they said they will deal with ITunes. I received a new credit crad from VISA with a new number. I tried to use this new card in the ITunes but ITunes did not accept my card because in their system my name has been registered as if I have commited the fraud! This was again outrageus! I have complained about this to both Belgium and the USA Apple/ITunes, but no satisfactory answer was given. I am now using my wife's credit card to buy smth I want in ITunes. But because of my very unpleasant experience I am not buying much on ITunes store. I am also considering to quit Apple all together. This is unfortunate because I have been an apple fan until I had this experience.
    Many thanks for sharing your problem.
    Mustafa

Maybe you are looking for

  • After upgrading to Yosemite, I had to upgrade my iPhoto, now the full res versions of my images cannot be found.

    After upgrading to Yosemite, I had to upgrade my iPhoto, now the full res versions of my images cannot be found.  I had created a book to print (before upgrade) but, after the upgrade the book can't be created as I get the message that images can't b

  • Select to a file (.CSV)

    Hello people, I'm working with a table, and I whant, by a select, put all my result into a .csv file (after I'll transform in .xls) Then I'm trying to do this: XFILE := UTL_FILE.FOPEN('FOLDERNAME', 'Export.csv', 'W'); -- THIS IS THE HEADING UTL_FILE.

  • Outlook 2007 won't connect / Autodiscover issues

    Hello Foristas, I'm stuck ... so I hope someone will point me in the right direction. This is the scenario: Target: Migrate 2003SBS to EX2013. SBS hat been migrated to 2008R2 AD Server plus EX2010. This went without problems. Outlook and OWA worked j

  • [PS CS5] Type tool-related crash.

    The Checklist: Photoshop CS5 12.0.4 x64 running on a Windows 7 x64 SP1 machine, with 8 GBs of RAM, plenty HD space on both drives (174GB free on C, 321GB free on D), no related software interferring with Photoshop that I know off, besides an Intuos 4

  • SOLUTION:  802.11n - Vista Getting IP Address but no Connectivity

    I noticed a few threads in which folks mentioned their 802.11n adapters not working in Vista. Specifically cases in which you could get an IP address from DHCP but can not actually connect to anything. I've found that the Linksys WPC300N drivers work