Calling a procedure from an OAF page through a button in the screen

problem: calling a procedure from an OAF page through a button in the screen

CREATE OR REPLACE procedure APPS.xx_delete_dept_prc(p_id in number)
as
begin
delete from xx_training_dept_tbl where td_dept_id=p_id;
commit;
end;
2.     create image button for delete
3.     set the following property to this button:
action type : fire action
event :DeleteDept
parameter :
name: DEptIdParam value: ${oa.XxTrainingDeptVO1.TdDeptId}
4.     create Co and writing the following code on process form request
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
super.processFormRequest(pageContext, webBean);
String actionInscreen=pageContext.getParameter(EVENT_PARAM);
if ("deleteDept".equals(actionInscreen))
String deptidparam=pageContext.getParameter("DeptIdParam");
Serializable [] s={deptidparam};
Class [] c={deptidparam.getClass()};
OAApplicationModule am=pageContext.getApplicationModule(webBean);
am.invokeMethod("deleteDept",s,c);
throw new OAException("delete completed",OAException.INFORMATION);
5.     create AM and writing the following code
public void deleteDept(String deptid) {
XxTrainingDeptVOImpl deptview= getXxTrainingDeptVO1();
deptview.deleteDept(deptid); }
6.create VO and writing the following code in view object class
public void deleteDept(String deptid
System.out.println("Dept ID =" +deptid);
String s = "call xx_delete_dept_prc(:1)"; // :1 is the number of parameter to pass it to procedure
CallableStatement cs =trx.createCallableStatement(s,1); // 1 number of record to fetch but delete always delete 1 row
try
cs.setString(1,deptid); // the name of the first parameter
cs.execute();
cs.close();
catch (SQLException e)
e.printStackTrace();
}

Similar Messages

  • Calling a procedure from Dynamic Page

    I am trying to call a procedure from a dynamic page. The procedure displays multi records from a table. I have created a procedure:
    PROCEDURE process_student_request( p_primary_request in wwv_utl_api_types.vc_arr,
    p_alternate_request in wwv_utl_api_types.vc_arr,
    p_action in varchar2,
    l_status in out varchar2);
    When I hit the submit button on the dynamic page it does not execute the procedure and tries to open a new page. How do I get this to work?
    Here is the text of the page:
    <HTML>
    <HEAD>
    <TITLE>Example</TITLE>
    </HEAD>
    <BODY>
    <FORM action="portal30.star_portal.process_student_requests" method="post">
    <TABLE BORDER="0" WIDTH="100%" CELLPADDING="2" CELLSPACING="0" class="RegionBorder">
    <TR>
    <TD valign="top" align="left" width="40%"><FONT class="PortletText1">
    <ORACLE>declare
    row_num number := 1;
    hold_row_num number;
    hold_class_cd stars3.req.class_cd%TYPE;
    begin
    for c1 in (select A.start_yy, A.school, A.student_id, A.class_cd, B.name from stars3.course B, stars3.req A
    where A.student_id = portal30.star_portal.get_session_variable('STUDENT_ID') and A.start_yy = '01' and
    A.alternate_no = '0' and
    B.start_yy = A.start_yy and
    B.school = A.school and
    B.class_cd = A.class_cd)
    loop
    hold_class_cd := c1.class_cd;
    htp.p(lpad(to_char(row_num),2,'0'));
    htp.p('<select name="p_primary_request">');
    htp.p('<option value="' || c1.class_cd|| '">' || c1.name || '</option>');
    row_num := row_num + 1;
    htp.p('<BR>');
    end loop;
    htp.p('<input type="submit" name="p_action">');
    end;
    </ORACLE>
    </BODY>
    </FORM>
    </TD>
    </TR>
    </TABLE>
    </HTML>

    Bob,
    You have variables in your procedure like l_status, p_alternate_status which you do not have in the form. Are these IN or OUT variables ?
    If these are IN variables, this proc will not work because you do not have any variable in the form. So from where does it get the values? There is not any default declared too. You have to explicitly define IN or OUT variables.
    Have you also given execute permission to public ?

  • Calling a procedure from AM

    Hi,
    I am getting the following error while trying to call a procedure from AM. I have check and all the parameters are being passed correctly. Not sure why this is throwing error. Below is the error message.
    oracle.apps.fnd.framework.OAException: java.sql.SQLException: ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'AbcPositionDetails'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    Any help is appreciated.
    Thanks in advance
    PK

    You will get this error when you pass wrong number of arguments to a pl/sql procedure.
    use named parameter binding like proc(a=>'value') to avoid this error.
    --Prasanna                                                                                                                                                                                                                                                                                                                                                       

  • Error calling a procedure from AM

    Hi,
    I am getting the following error while trying to call a procedure from AM. I have checked and all the parameters are being passed correctly. Not sure why this is throwing error. Below is the error message.
    oracle.apps.fnd.framework.OAException: java.sql.SQLException: ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'AbcPositionDetails'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    Any help is appreciated.
    Thanks in advance
    PK

    Pk,
    The exception "wrong number or types of arguments in call to 'AbcPositionDetails'" means you are passing wrong parameter types to the procedure or the parameter arguement is differrent.
    for example if the procedure definition is AbcPositionDetails(*x* in varchar2, y in varchar2) , you are calling in AM
    Like Call procedure (begin AbcPositionDetails(*z* => :1 , t => :2) ; end;
    To resolve the issue, you should call the procedure (begin AbcPositionDetails*(x* => :1 , y => :2) ; end;
    i.e. The definition of the procedure should not change
    (or) You can call like this (begin AbcPositionDetails( :1 , :2) ; end;
    thanks,
    Kumar

  • How do I raise a Business Event from a OAF page?

    Hello,
    I am developing a custom system using the OAF and need to raise a custom Business Event, which in turn will have a subscription to launch a workflow process.
    How do I raise a Business Event from a OAF page ?
    Can I use the classes in oracle.apps.fnd.wf.bes.* ?
    Any help would be highly appreciated.
    Best Regards,
    Andries Hanekom

    Hi,
    When I try to compile just the basic part of my class I receive the following error:
    Error(21,36): cannot access class javax.jms.TextMessage; file javax\jms\TextMessage.class not found
    Class Code:
    import oracle.apps.fnd.wf.bes.BusinessEvent;
    public class VscmsEvents
    public VscmsEvents()
    public static void main(String[] args)
    VscmsEvents vscmsEvents = new VscmsEvents();
    //Initialize BusinessEvent, Payload objects
    public void initEvent(String eventName, String eventKey, String eventData)
    //Create BusinessEvent Object
    BusinessEvent mEvent = new BusinessEvent(eventName, eventKey);
    Furthermore, when using the BusinessEvent object to raise the event I will need to provide the raise method with a java.sql.Connection parameter. In the context of a OAF page how will I perform this?
    Thanks for the help.
    Best Regards,
    Andries Hanekom

  • Calling a Web service from Standard OAF Page.

    Hi All,
    how to call a webservice page from Standard OAF Page and get back the response from that webservice.
    Can anyone please give me the process how to do it.Can anyone please provide code it will helpful to me.
    Not using any PL/SQL API's.only through web services how to do it?.
    Thanks in Advance.
    Regards,
    Ajay.

    look in the tutorial the web-client example or the dii interface example... and read all about jaxrpc ...
    bye
    J

  • To get date Parameter from an OAF page

    Hi,
    I want to get a date parameter from an OAF page and pass them to a query in Vo as binding variables.
    How can that be done.
    I tried this to get the date from my page but it gives an error when I pass it to the query-
    String v_date = pageContext.getParameter("StartDate");

    My CO --------------------------
    if( pageContext.getParameter("Submit") != null)
    String userid = (new Integer(pageContext.getUserId())).toString();
    String personid = (new Integer(pageContext.getEmployeeId())).toString();
    String v_date = pageContext.getParameter("StartDate")+"";
    String v_end_date = pageContext.getParameter("EndDate")+"";
    System.out.println("call to process request0 : " + userid);
    System.out.println("call to process request0 : " + personid);
    System.out.println("call to process request0 : " + v_date);
    System.out.println("call to process request0 : " + v_end_date);
    Serializable[] params = {personid,v_date,v_end_date};
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    String empUserid = pageContext.getUserName();
    System.out.println(pageContext.getUserName());
    System.out.println("Calling initMoverQuery");
    am.invokeMethod("initMoverQuery", params);
    System.out.println("Call out of initMoverQuery");
    My AM------------------------------------------------------------
    public void initMoverQuery(String pid,String sd,String ed)
    System.out.println("In init Query of AM" +pid);
    EmployeeMoverVOImpl vorep = getEmployeeMoverVO1();
    Number personid = new Number(Integer.parseInt(pid));
    System.out.println("user id"+ personid);
    System.out.println("start date"+ sd);
    System.out.println("end date"+ ed);
    if (vorep == null)
    MessageToken[] tokens = { new MessageToken("OBJECT_NAME", "EmployeeMoverRepVO1")};
    throw new OAException("AK", "FWK_TBX_OBJECT_NOT_FOUND", tokens);
    if (!vorep.isPreparedForExecution())
    // vorep.initQuery(personid,sd1,ed1);
    vorep.setWhereClauseParam(0,personid);
    vorep.setWhereClauseParam(1,sd);
    vorep.setWhereClauseParam(2,ed);
    vorep.executeQuery();
    System.out.println("End SP VO Query");
    }

  • Is it possible to launch a form from an OAF page using OAF Personalization

    In R11, the Customer Standard form ARXCUDCI was customized to call a custom block from the Address screen. In R12 the customer standard form has become an OAF page. We have decided to create a custom form for the custom block using Oracle Developer. However we need a mechanism to call this custom form from the Customer Standard OAF page.
    My query is if it is possible to call a custom form from an OAF page using OAF personalization only (i.e. without directly customizing the code of the OAF page)
    Thanks
    Sanjay

    Dear Apurba,
    I have made some progress.
    I have open the Customers OAF Page, queried a customer, selected a site and opened it.
    Then chose Personalize "Account Site Address"
    There I added a Button on the Header Address level
    ID=XXTVL_LASSY_BUTTON
    Populated the Additional Text and Prompt properties.
    Also set Destination URI=form:SYSADMIN:SYSTEM_ADMINISTRATOR:STANDARD:FND_FNDMNMNU.
    The button is now showing in the address page, and when I click on it it opens the seeded Menu form.
    I now have to create the custom form and set Destination URI to the Custom Form.
    I am also aware how to add parameters to Destination URI.
    But could you let me know how to read the value from a OAF page form field and reference it in Destination URI.
    I need the value of PARTY_SITE_ID of the Address OAF page.
    Alternatively, the Site Number is displayed on the OAF page. If I can read it that will also do. I can use the Site Number in the custom form rather than PARTY_SITE_ID
    Thanks
    Sanjay

  • Calling Stored Procedure from Oracle DataBase using Sender JDBC (JDBC-JMS)

    Hi All,
    We have requirement to move the data from Database to Queue (Interface Flow: JDBC -> JMS).
    Database is Oracle.
    *Based on Event, data will be triggered into two tables: XX & YY. This event occurs twice daily.
    Take one field: 'aa' in XX and compare it with the field: 'pp' in YY.
    If both are equal, then
         if the field: 'qq' in YY table equals to "Add" then take the data from the view table: 'Add_View'.
         else  if the field: 'qq' in YY table equals to "Modify"  then take the data from the view table: 'Modify_View'.
    Finally, We need to archive the selected data from the respective view table.*
    From each table, data will come differently, means with different field names.
    I thought of call Stored Procedure from Sender JDBC Adapter for the above requirement.
    But I heard that, we cannot call stored procedure in Oracle through Sender JDBC as it returns Cursor instead of ResultSet.
    Is there any way other than Stored Procedure?
    How to handle Data Types as data is coming from two different tables?
    Can we create one data type for two tables?
    Is BPM required for this to collect data from two different tables?
    Can somebody guide me on how to handle this?
    Waiting eagerly for help which will be rewarded.
    Thanks and Regards,
    Jyothirmayi.

    Hi Gopal,
    Thank you for your reply.
    >Is there any way other than Stored Procedure?
    Can you try configuring sender adapter to poll the data in intervals. You can configure Automatic TIme planning (ATP) in the sender jdbc channel.
    I need to select the data from different tables based on some conditions. Let me simplify that.
    Suppose Table1 contains 'n' no of rows. For each row, I need to test two conditions where only one condition will be satisfied. If 1st condition is satisfied, then data needs to be taken from Table2 else data needs to be taken from Table3.
    How can we meet this by configuring sender adapter with ATP?
    ================================================================================================
    >How to handle Data Types as data is coming from two different tables?
    If you use join query in the select statement field of the channel then whatever you need select fields will be returned. This might be fields of two tables. your datatype fields are combination of two diff table.
    we need to take data only from one table at a time. It is not join of two tables.
    ================================================================================================
    Thanks,
    Jyothirmayi.

  • How to hide drilldown field from a OAF page.

    Hi,
    I have a requirement to hide few drilldown fields from one of the seeded OAF page. through personalization I am able to hide all the fields except the drilldown fields. Can anyone tell me why I cannot hide a drilldown field using personalization. Is there any other way to achieve it other then extending the controller.
    Thanks in advance.

    Let us know whether this forum solve your issue or not?
    Re: Hide About this page,Home,Logout,Preferences links
    Thanks, Avaneesh

  • Customized JSP Page for LOV from a OAF Page

    We want a customized LOV page that will be a new JSP page instead of OAF JRAD XML. Right next to this new item we will put a link to open us this new JSP page. The base page is OAF page. When user selects the data from the new LOV JSP page, it has to be passed to the base page items. Is it possible to acheive this?

    You cannot do that, all queries and eventual data binds to UIX beans must ha[[en through VOs.
    What I can suggest as a workaround is this.
    1. Create a normal LOV based on a VO
    2. Create rows for the LOV VO
    3. populate the attributes of the VO row with the values that you have in your collection object.
    4. Insert the row in your VO.
    Thanks
    Tapash                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Calling a Procedure from a Button?

    Hi All,
    I'm using Oracle Application Express 11g & I'm currently working on an application. One of the requirements for this particular application is that a user has to be able to enter an applicant's id number (in the id textfield) & if a user clicks a button then they should be able to check in the db whether the applicant exists or not. If the applicant exists then name & surname textfields should be populated with values from the database corresponding to the id number & all these three textfields should be read only. If the applicant doesn't exist then the user will be directed to a page where he/she will fill in new applicant's details.
    So, I wrote the following procedure to do that:
    CREATE OR REPLACE PROCEDURE search_applicant(
    P17_APPLICANT_IDNUMBER IN FIR_APPLICANT.applicant_idnumber%TYPE,
    P17_NAME OUT FIR_APPLICANT.name%TYPE,
    P17_SURNAME OUT FIR_APPLICANT.surname%TYPE,
    P17_COUNT IN FIR_CURRENCY.currency_id%TYPE) IS
    BEGIN
    SELECT count(*)
    INTO P17_COUNT
    FROM fir_applicant
    WHERE applicant_idnumber = :P17_APPLICANT_IDNUMBER;
    IF P17_COUNT > 0 THEN
    SELECT name,surname
    INTO P17_NAME, P17_SURNAME
    FROM fir_applicant
    WHERE applicant_idnumber = :P17_APPLICANT_IDNUMBER;
    dbms_output.put_line('Name: ' || P17_NAME || ' & Surname: ' || P17_SURNAME);
    ELSE
    dbms_output.put_line('Applicant does not exit.');
    END IF;
    EXCEPTION WHEN NO_DATA_FOUND THEN
    dbms_output.put_line('Applicant does not exit.');
    END;
    So far I have not been able to find any help in this regard. I know how to invoke a javascript from a button but I'm not sure how to go about this one.
    Any help in this regard is highly appreciated.
    THANK YOU
    Kamo

    Thanx PaulD & Chris,
    Sorry for the delay in response - I couldn't implement the solutions you recommended for me. My ApEx instance is down (& has been for the past week). It finally dawned on me that I could recreate my problem @ apex.oracle.com. Please take a look at the following application & see if you can help:
    http://apex.oracle.com/pls/otn/f?p=45267:2:714925804498386:::::
    Username: Kamo
    Password: admin
    PS: I have tried to call a Procedure from a button using a page process but it still couldn't work.
    THANK YOU!
    Kamo
    Edited by: user5429001 on 2009/01/28 6:10 AM
    Edited by: user5429001 on 2009/01/28 6:21 AM

  • Error while calling a procedure from ESB

    Hi,
    I am calling a procedure from ESB using DB adapter. and in the routing rules i am mapping the i/p values for schema to procedure input variables using mappings(transformation) but the values are going as null to the procedure call.
    Please help me out.
    The exception follows...
    An unhandled exception has been thrown in the ESB system. The exception reported is: "org.collaxa.thirdparty.apache.wsif.WSIFException: esb:///ESB_Projects/ESB-Issues_issue3/db3.wsdl [ db3_ptt::db3(InputParameters,OutputParameters) ] - WSIF JCA Execute of operation 'db3' failed due to: Error while trying to prepare and execute an API.
    An error occurred while preparing and executing the SYSTEM.INSERT_ISSUE_PROC API. Cause: java.sql.SQLException: ORA-01400: cannot insert NULL into ("SYSTEM"."ISSUES"."ISSUE_NAME")
    ORA-06512: at "SYSTEM.INSERT_ISSUE_PROC", line 16
    ORA-06512: at line 1
    [Caused by: ORA-01400: cannot insert NULL into ("SYSTEM"."ISSUES"."ISSUE_NAME")
    ORA-06512: at "SYSTEM.INSERT_ISSUE_PROC", line 16                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    This is likely being caused by a problem that we've seen a number of times. You'll have namespace issues and problems with NULLs if your JDev is 10.1.3.1 and SOA is 10.1.3.3 (or vice-versa). You MUST synchronize JDev 10.1.3.3 (or higher) with SOA 10.1.3.3 (or higher). It doesn't matter if you mix 10.1.3.3 and 10.1.3.4. You just need to get away from 10.1.3.1.

  • Unable to call a procedure from inside a another procedure

    Dear members
    I am trying to call a procedure from inside an another procedure.Both the procedures are present within the same package.I am trying to call the second procedure just before the end of the first procedure.Both the procedures are compiling fine but the tables are not getting populated inside the second procedure.Also the DBMS_OUTPUT statements present in second procedures are not getting displayed.(I feel the second procedured is not getting called).
    The package specification is as follows:
    CREATE OR REPLACE package ANVESH.conv_api_pkg
    is
        PROCEDURE PROC_CONVERSION_API(FILE_PATH IN VARCHAR2,FILE_NAME IN VARCHAR2) ;
        TYPE cts_order_details IS TABLE OF XXCTS_ORDER_DETAILS_STG%ROWTYPE;
        PROCEDURE proc_conversion_api2(p_orderdetails IN cts_order_details) ;
    end conv_api_pkg;The package body is as follows:
    CREATE OR REPLACE package body ANVESH.conv_api_pkg
    is
    PROCEDURE PROC_CONVERSION_API(FILE_PATH IN VARCHAR2,FILE_NAME IN VARCHAR2)
    IS
        v_file_type utl_file.file_type;
        v_buffer VARCHAR2(1000);
        V_CUSTOMER_NAME VARCHAR2(100);
        V_MANUFACTURER VARCHAR2(100);
        V_PRODUCT_NAME VARCHAR2(100);
        V_QUANTITY NUMBER;
        V_REQ_SHIP_DATE DATE;
        V_REQ_PRICE NUMBER;
        V_LOG_FILE utl_file.file_type;
        V_COUNT_CUST NUMBER;
        V_COUNT_PROD NUMBER;
       L_ORDER_LINES CONV_API_PKG.cts_order_details:=CONV_API_PKG.cts_order_details();
    BEGIN
        DBMS_OUTPUT.PUT_LINE('Inside begin 1');
        v_file_type := UTL_FILE.fopen(FILE_PATH, FILE_NAME, 'r',null);
            DBMS_OUTPUT.PUT_LINE('Inside begin 1.1');
        LOOP
            BEGIN
                        DBMS_OUTPUT.PUT_LINE('Inside begin 2');
                         UTL_FILE.GET_LINE (v_file_type,v_buffer);
                        DBMS_OUTPUT.PUT_LINE('Inside begin 2.1');
                        DBMS_OUTPUT.PUT_LINE('the  buffer is '||v_buffer);
                        DBMS_OUTPUT.PUT_LINE('the length of buffer is '||length(v_buffer));
                         V_CUSTOMER_NAME := trim(substr(v_buffer, 1, 30));
                         DBMS_OUTPUT.PUT_LINE('Customer Name is '||V_CUSTOMER_NAME);
                         V_MANUFACTURER  := trim(substr(v_buffer, 31, 40));
                         DBMS_OUTPUT.PUT_LINE('Manufacturer is '||V_MANUFACTURER);
                         V_PRODUCT_NAME  := trim(substr(v_buffer,  71, 20));
                         DBMS_OUTPUT.PUT_LINE('Product Name is '||V_PRODUCT_NAME);
                         V_QUANTITY      := to_number(trim(substr(v_buffer, 91, 5)));
                         DBMS_OUTPUT.PUT_LINE('Quantity is '||V_QUANTITY);
                         V_REQ_SHIP_DATE     := to_date(trim(substr(v_buffer, 96, 20)), 'DD-MON-YYYY');
                         DBMS_OUTPUT.PUT_LINE('Requested Ship Date is '|| V_REQ_SHIP_DATE);
                        V_REQ_PRICE        :=nvl(substr( trim(v_buffer), 116, length(v_buffer)-116),0);
                        --DBMS_OUTPUT.PUT_LINE('Requested Price is1 '||substr(v_buffer, 116, 5));
                        DBMS_OUTPUT.PUT_LINE('The requested price is  '||V_REQ_PRICE);
                V_LOG_FILE := UTL_FILE.FOPEN(FILE_PATH, 'LOG_FILE.dat', 'A');
                    IF (V_QUANTITY > 0)
                     THEN
                     DBMS_OUTPUT.PUT_LINE('The quantity is '||V_QUANTITY);
                       SELECT COUNT (*)
                       INTO V_COUNT_CUST
                       FROM CONVERSION_CUSTOMERS
                       WHERE CUSTOMER_NAME = V_CUSTOMER_NAME;
                       DBMS_OUTPUT.PUT_LINE('The Customer count is '||V_COUNT_CUST);
                       IF(V_COUNT_CUST > 0)
                       THEN
                           SELECT COUNT(*)
                           INTO V_COUNT_PROD
                           FROM conversion_products
                           WHERE PRODUCT_NAME = V_PRODUCT_NAME;
                           DBMS_OUTPUT.PUT_LINE('The Product count is '||V_COUNT_PROD);
                          IF(V_COUNT_PROD >0)
                           THEN
                                INSERT INTO XXCTS_ORDER_DETAILS_STG VALUES (V_CUSTOMER_NAME, V_PRODUCT_NAME, V_MANUFACTURER, V_QUANTITY, V_REQ_SHIP_DATE, V_REQ_PRICE, 'ACTIVE', 'ORDER TAKEN');  
                           ELSE
                                DBMS_OUTPUT.PUT_LINE('PRODUCT SHOULD BE VALID');
                                UTL_FILE.PUT_LINE(V_LOG_FILE, 'PRODUCT SHOULD BE VALID');                   
                           END IF;
                       ELSE
                          DBMS_OUTPUT.PUT_LINE('CUSTOMER SHOULD BE VALID');
                          UTL_FILE.PUT_LINE(V_LOG_FILE, 'CUSTOMER SHOULD BE VALID');
                       END IF;      
                    ELSE
                        DBMS_OUTPUT.PUT_LINE('QUANTITY SHOULD BE VALID');
                        UTL_FILE.PUT_LINE(V_LOG_FILE, 'QUANTITY SHOULD BE VALID');
                    END IF;
                    EXCEPTION
                    WHEN NO_DATA_FOUND THEN
                        EXIT;
                    END;
        END LOOP;
    SELECT CUSTOMER_NAME, PRODUCT_NAME, MANUFACTURER, QUANTITY, REQUESTED_SHIP_DATE, REQUESTED_PRICE, STATUS,MESSAGE
    BULK COLLECT
    INTO L_ORDER_LINES
    FROM XXCTS_ORDER_DETAILS_STG;
    DBMS_OUTPUT.PUT_LINE('values inserted');
    proc_conversion_api2(p_orderdetails=>L_ORDER_LINES);
    END;
    PROCEDURE proc_conversion_api2(p_orderdetails IN cts_order_details)
      IS
      V_AVL_QUANTITY CONVERSION_PRODUCTS.AVL_QUANTITY%TYPE;
      V_REQ_SHIP_DATE DATE;
      V_LIST_PRICE CONVERSION_PRODUCTS.LIST_PRICE%TYPE;
      V_NET_PRICE CONVERSION_PRODUCTS.LIST_PRICE%TYPE;
      V_NET CONVERSION_PRODUCTS.LIST_PRICE%TYPE;
      V_EXTN_PRICE CONVERSION_PRODUCTS.LIST_PRICE%TYPE;
      V_CUST_DISC CONVERSION_CUSTOMERS.DISCOUNT%TYPE;
      V_CERT_DISC CONVERSION_CERTIFICATION.DISCOUNT%TYPE;
      V_CUST_ID XXCTS_ORDER_DETAILS.CUSTOMER_ID%TYPE;
      V_PROD_ID XXCTS_ORDER_DETAILS.PRODUCT_ID%TYPE;
      V_DISC_PRICE CONVERSION_PRODUCTS.LIST_PRICE%TYPE;
      V_DISC_NAME CONVERSION_CERTIFICATION.CERTIFICATION%TYPE;
      V_TOTAL_DISC_AMT NUMBER;
      V_TOTAL_DISC NUMBER;
      V_LIMIT NUMBER;
    BEGIN
        DBMS_OUTPUT.PUT_LINE('INSIDE API_2 BEGIN 1');
            FOR i IN p_orderdetails.FIRST..p_orderdetails.LAST
            LOOP
                 BEGIN
                DBMS_OUTPUT.PUT_LINE('INSIDE API_2 BEGIN 2');
                SELECT PRODUCT_ID,AVL_QUANTITY,LIST_PRICE
                INTO V_PROD_ID,V_AVL_QUANTITY,V_LIST_PRICE
                FROM CONVERSION_PRODUCTS
                WHERE PRODUCT_NAME=p_orderdetails(i).PRODUCT_NAME;
                DBMS_OUTPUT.PUT_LINE('PRODUCT QUANTITY is '||V_PROD_ID);
                DBMS_OUTPUT.PUT_LINE('AVAILABLE QUANTITY is '||V_AVL_QUANTITY);
                DBMS_OUTPUT.PUT_LINE('LIST PRICE is '||V_LIST_PRICE);
                SELECT CUSTOMER_ID,NVL(DISCOUNT,0)
                INTO V_CUST_ID,V_CUST_DISC
                FROM CONVERSION_CUSTOMERS
                WHERE CUSTOMER_NAME=p_orderdetails(i).CUSTOMER_NAME;
                DBMS_OUTPUT.PUT_LINE('CUSTOMER ID is '||V_CUST_ID);
                DBMS_OUTPUT.PUT_LINE('CUSTOMER DISCOUNT IS '||V_CUST_DISC);
                SELECT A.DISCOUNT,A.CERTIFICATION
                INTO  V_CERT_DISC,V_DISC_NAME
                FROM CONVERSION_CERTIFICATION A,CONVERSION_CUSTOMERS B
                WHERE A.CERTIFICATION=B.CERTIFICATION(+)
                AND B.CUSTOMER_NAME=p_orderdetails(i).CUSTOMER_NAME;
                DBMS_OUTPUT.PUT_LINE('CERTIFICATION DISCOUNT IS '||V_CERT_DISC);
                V_NET:=((V_LIST_PRICE)-(V_LIST_PRICE)*(V_CERT_DISC)/100);
                DBMS_OUTPUT.PUT_LINE('NET PRICE AFTER CERTIFICATION DISCOUNT IS '||V_NET);
                V_NET_PRICE:=((V_NET)-(V_NET)*(V_CUST_DISC)/100);
                DBMS_OUTPUT.PUT_LINE('NET PRICE AFTER COMPLETE DISCOUNT IS '||V_NET_PRICE);
                V_EXTN_PRICE:=(V_NET_PRICE)*(p_orderdetails(i).QUANTITY);
                DBMS_OUTPUT.PUT_LINE('EXTENDED PRICE IS '||V_EXTN_PRICE);
                V_TOTAL_DISC:=((V_CERT_DISC)/100+(V_CUST_DISC)/100);
                DBMS_OUTPUT.PUT_LINE('TOTAL DISCOUNT IS '|| V_TOTAL_DISC);
                V_TOTAL_DISC_AMT:=(V_LIST_PRICE)-(V_NET_PRICE);
                DBMS_OUTPUT.PUT_LINE('TOTAL DISCOUNT PRICE IS '|| V_TOTAL_DISC_AMT);
                SELECT MAX(A.LIMIT)
                INTO V_LIMIT
                FROM CONVERSION_CERTIFICATION A,CONVERSION_CUSTOMERS B
                WHERE A.CERTIFICATION=B.CERTIFICATION(+)
                AND B.CUSTOMER_NAME=p_orderdetails(i).CUSTOMER_NAME;
                IF p_orderdetails(i).QUANTITY<V_AVL_QUANTITY THEN
                INSERT INTO XXCTS_ORDER_DETAILS VALUES(SEQ_HEADER_ID.NEXTVAL,SEQ_LINE_ID.NEXTVAL,V_CUST_ID,V_PROD_ID,p_orderdetails(i).QUANTITY,p_orderdetails(i).REQUESTED_SHIP_DATE,p_orderdetails(i).REQUESTED_PRICE,V_LIST_PRICE,V_TOTAL_DISC,V_NET_PRICE,V_EXTN_PRICE,'QTY HOLD','REQ QNTY LESS THAN AVL QTY',SYSDATE);
                INSERT INTO xxcts_order_discounts VALUES(SEQ_HEADER_ID.NEXTVAL,SEQ_LINE_ID.NEXTVAL,SEQ_DISCOUNT_ID.NEXTVAL,V_DISC_NAME,V_TOTAL_DISC_AMT);
                END IF;
                IF p_orderdetails(i).REQUESTED_SHIP_DATE<SYSDATE THEN
                INSERT INTO XXCTS_ORDER_DETAILS VALUES(SEQ_HEADER_ID.NEXTVAL,SEQ_LINE_ID.NEXTVAL,V_CUST_ID,V_PROD_ID,p_orderdetails(i).QUANTITY,p_orderdetails(i).REQUESTED_SHIP_DATE,p_orderdetails(i).REQUESTED_PRICE,V_LIST_PRICE,V_TOTAL_DISC,V_NET_PRICE,V_EXTN_PRICE,'DATE HOLD','SHIPDATE CANNOT BE LESS THAN CURR DATE',SYSDATE);
                INSERT INTO xxcts_order_discounts VALUES(SEQ_HEADER_ID.NEXTVAL,SEQ_LINE_ID.NEXTVAL,SEQ_DISCOUNT_ID.NEXTVAL,V_DISC_NAME,V_TOTAL_DISC_AMT);
                END IF;
                IF V_NET_PRICE>p_orderdetails(i).REQUESTED_PRICE THEN
                INSERT INTO XXCTS_ORDER_DETAILS VALUES(SEQ_HEADER_ID.NEXTVAL,SEQ_LINE_ID.NEXTVAL,V_CUST_ID,V_PROD_ID,p_orderdetails(i).QUANTITY,p_orderdetails(i).REQUESTED_SHIP_DATE,p_orderdetails(i).REQUESTED_PRICE,V_LIST_PRICE,V_TOTAL_DISC,V_NET_PRICE,V_EXTN_PRICE,'PRICE HOLD','NET PRICE CANNOT BE MORE THAN REQ PRICE',SYSDATE);
                INSERT INTO xxcts_order_discounts VALUES(SEQ_HEADER_ID.NEXTVAL,SEQ_LINE_ID.NEXTVAL,SEQ_DISCOUNT_ID.NEXTVAL,V_DISC_NAME,V_TOTAL_DISC_AMT);
                END IF;
               /* IF V_LIMIT<p_orderdetails(i).REQUESTED_PRICE THEN
                INSERT INTO XXCTS_ORDER_DETAILS VALUES(SEQ_HEADER_ID.NEXTVAL,SEQ_LINE_ID.NEXTVAL,V_CUST_ID,V_PROD_ID,p_orderdetails(i).QUANTITY,p_orderdetails(i).REQUESTED_SHIP_DATE,p_orderdetails(i).REQUESTED_PRICE,V_LIST_PRICE,V_TOTAL_DISC,V_NET_PRICE,V_EXTN_PRICE,'ORDER LIMIT HOLD','PRICE CANNOT EXCEED ORDER LIMIT',SYSDATE);
                INSERT INTO xxcts_order_discounts VALUES(SEQ_HEADER_ID.NEXTVAL,SEQ_LINE_ID.NEXTVAL,SEQ_DISCOUNT_ID.NEXTVAL,V_DISC_NAME,V_TOTAL_DISC_AMT);
                END IF;*/
                EXCEPTION
                WHEN NO_DATA_FOUND THEN
                DBMS_OUTPUT.PUT_LINE(' INSIDE EXCEPTION BLOCK');
                END;
            END LOOP;
    END;
    end conv_api_pkg;
    /the pl/sql block to invoke the the procedure :
    declare
    begin
    PROC_CONVERSION_API('/usr/tmp' ,'Walmart_Orders_062908.dat');
    end;please let me know what is wrong in the program.
    Thanks
    Anvesh

    Hi Walter
    Yes 'Inside begin 1' and 'Inside begin 2' were printed.Please find the the DBMS_OUTPUT statements that were printed.
    Inside begin 1
    Inside begin 1.1
    Inside begin 2
    Inside begin 2.1
    the  buffer is BESTBUY                       SONY ERICSSON                           W580i               25   1-AUG-2008          50
    the length of buffer is 118
    Customer Name is BESTBUY
    Manufacturer is SONY ERICSSON
    Product Name is W580i
    Quantity is 25
    Requested Ship Date is 01-AUG-08
    The requested price is  50
    The quantity is 25
    The Customer count is 1
    The Product count is 0
    PRODUCT SHOULD BE VALID
    Inside begin 2
    Inside begin 2.1
    the  buffer is BESTBUY                       SAMSUNG                                 BLACKJACK           50   15-JUL-2008         150
    the length of buffer is 119
    Customer Name is BESTBUY
    Manufacturer is SAMSUNG
    Product Name is BLACKJACK
    Quantity is 50
    Requested Ship Date is 15-JUL-08
    The requested price is  150
    The quantity is 50
    The Customer count is 1
    The Product count is 1
    Inside begin 2
    Inside begin 2.1
    the  buffer is BESTBUY                       APPLE                                   IPHONE 4GB          50   15-JUL-2008        
    the length of buffer is 116
    Customer Name is BESTBUY
    Manufacturer is APPLE
    Product Name is IPHONE 4GB
    Quantity is 50
    Requested Ship Date is 15-JUL-08
    The requested price is  0
    The quantity is 50
    The Customer count is 1
    The Product count is 1
    Inside begin 2
    Inside begin 2.1
    the  buffer is BESTBUY                       ATT                                     TILT                100  15-JUN-2008        
    the length of buffer is 116
    Customer Name is BESTBUY
    Manufacturer is ATT
    Product Name is TILT
    Quantity is 100
    Requested Ship Date is 15-JUN-08
    The requested price is  0
    The quantity is 100
    The Customer count is 1
    The Product count is 1
    Inside begin 2
    Inside begin 2.1
    the  buffer is BESTBUY                       NOKIA                                   N73                 50   15-JUL-2008         200
    the length of buffer is 118
    Customer Name is BESTBUY
    Manufacturer is NOKIA
    Product Name is N73
    Quantity is 50
    Requested Ship Date is 15-JUL-08
    The requested price is  20
    The quantity is 50
    The Customer count is 1
    The Product count is 0
    PRODUCT SHOULD BE VALID
    Inside begin 2In the first procedure I am trying to read the data from a flat file and store it in a table.Here is the sample data from the flat file.
    BESTBUY                       SONY ERICSSON                           W580i               25   1-AUG-2008          50
    BESTBUY                       SAMSUNG                                 BLACKJACK           50   15-JUL-2008         150
    BESTBUY                       APPLE                                   IPHONE 4GB          50   15-JUL-2008        
    BESTBUY                       ATT                                     TILT                100  15-JUN-2008        
    BESTBUY                       NOKIA                                   N73                 50   15-JUL-2008         200When tried to execute the second procedure independently using the PL/SQL block,the tables in second procedure were populated and the DBMS_Output statements were also displayed.I have made use of the same query in that case
    Thanks
    Anvesh
    Edited by: Anvesh Reddy on Dec 23, 2008 12:40 PM

  • How can i call a zreport from my bsp page.

    Hi friends,
    How can i call a zreport from my bsp page.
    Moosa

    Hi Friend,
    These are the codings  to be wirtten in BSP for transferring values to the REPORT
    DATA:wf_date TYPE ztable-ID.
          data:seltab type standard table of rsparams,
           wa_seltab like line of seltab,
         event TYPE REF TO if_htmlb_data.
    DATA:p_value TYPE REF TO CL_HTMLB_INPUTFIELD.
    event = cl_htmlb_manager=>get_event( runtime->server->request ).
    p_requ ?= CL_HTMLB_MANAGER=>GET_DATA(
                                            request  = runtime->server->request
                                            name     = 'inputField'
                                            id       = 'i1'
    if p_requ is not initial.
      wf_date = p_requ->value.
    endif.
    clear wa_seltab.
    if wf_date is not initial.
      wa_seltab-selname = 'P_REQU'.
      wa_seltab-kind = 'P'.
      wa_seltab-option = 'EQ'.
      wa_seltab-low = wf_date.
      append wa_seltab to seltab.
    endif.
    submit *ZSAMPLEAP1* with selection-table seltab AND RETURN  .(ZSAMPLEAP1 refers to the report name and AND RETURN for coming back to the BSP page after the completion of its operation in Report )
    IMPORT int_name TO int_name FROM MEMORY ID '*zid*'.(For importing the obtained value from Report)
    In Report
    REPORT  ZSAMPLEAP1.
    SELECT-OPTIONS: p_requ FOR ztable-id  NO INTERVALS.
    SELECT SINGLE name from ztable into int_name WHERE id = p_requ-low.
    WRITE:int_name.
        EXPORT int_name TO MEMORY  ID 'zsharmila'.
    With Regards,
    SHARMILA BRINDHA.M

Maybe you are looking for

  • How to use a thirdparty look and feel

    how to use a thirdparty look and feel i download some from http://javootoo.l2fprod.com/ but how to use?

  • Itunes 10.5 update problems

    I am trying to update itunes to 10.5, however the normal update does not occur, i get directed to the Apple website with the message 'Content was blocked because it was not signed by a valid security certificate'. I've not seen this before, any ideas

  • A game I purchased no longer works!

    I purchased a game several months ago and it worked fine. Now the game opens to the main screen and then closes out. I have uninstalled and reinstalled the game 3 times through Itunes. It is still not working!

  • Help with HD ?

    If i already have data saved in my Time Capsule or any external HD all from my old Mac. I want use these HD's on my new Mac with time machine if i set it up with time machine will it write over my data or use the free space and go from there because

  • Outdated documentation

    Why is it that the only documentation I can find on migrating Access DB to APEX is outdated? I'm using MS Access 2007, migrating to Oracle 11g and the latest version of APEX. The doco that I have (updated June 2009) refers to security settings in Acc