Trying to call HANA procedure via ABAP
Hi everyone,
I am using ABAP in Eclipse in order to call a HANA procedure within a BPC process chain. While referring to an SCN blog written by Baris Cekic, I have put together a working ABAP Class. This works as my proxy to a functioning HANA stored procedure. My issue is with the ABAP program I am using for the process chain. I believe that I'm passing my input parameter using the wrong format. Please bear with me, as I am not an ABAP programmer! Any help would be much appreciated! Please take a look at the screenshots. Thanks!
ABAP CLASS - ZCL_BPC_AMDP:
HANA PROCEDURE - ZPROC_BPC_AMDP:
ABAP PROGRAM - ZBW_BPC_AMDP:
This is my issue!! -----> INPUT of SP Name: (I've tried with and without the schema):
ABAP PROGRAM ERROR:
Hi Anand,
you should preferentially use "NVARCHAR" instead of the non-unicode derivate "VARCHAR". As ABAP supports both unicode and non-unicode systems, we only allow the mapping of Strings/character literals from ABAP to NVARCHAR variables in HANA in all ABAP on HANA systems.
Please find an example of a _SYS_BIC procedure in an AMDP in class CL_EPM_OIA_SIMP_BP_CLSF_AMDPDT (method AMDP_GET_BP_CLASSIFICATION). Should be available in your system.
And you can additionally try to execute the call you put into the AMDP directly in the HANA SQL console.
Cheers,
Jasmin
Similar Messages
-
How to Call HANA Procedure in ABAP
Hi Everyone,
I am new to ABAP
I have created a procedure in HANA that accepts two input parameters and outputs a table
I am using HANA as a Secondary Database
How can I call this procedure in my ABAP program?
Regards,
VivekHi Vivek,
depends on how you would like to call it :-)
1. Use native SQL to call the procedure (see report ADBC_DEMO_PROC_CALLS_HDB; available in any system with a minimum NetWeaver release 7.40 SP5).
2. Create a DB Procedure Proxy and call the DB Procedure Proxy (Tutorial: How to consume SAP HANA Procedures in ABAP; only "directly" available if HANA is the primary DB underlying your system, for secondary DB system see discussion Execute Procedure with input parameters as table from ABAP).
3. (Method of choice available as of NetWeaver 7.4 SP5): Create an ABAP managed DB procedure (instead of the native HANA procedure) as described in ABAP Managed Database Procedures - Introduction
Cheers,
Jasmin -
Hi,
I wrote a procedure on HANA and i want to call via AMDP. As i saw from examples, developers generally writing the content of the procedure here but i wnt to call pre-written HANAprocedure via here.
Is it possible ?
My scenario is like that;
CLASS ZBPC_AMDP_TEST IMPLEMENTATION.
METHOD RUN_PACKAGE BY DATABASE PROCEDURE FOR HDB
LANGUAGE SQLSCRIPT.
call Z_SP_TEST(:IN_A, :IN_B, :IN_C, ET_DATA ) with overview;
ENDMETHOD.
ENDCLASS.
I dont want to put all my select statement here and also it doesnt support local temporary tables.
Is there a way ?Hi Bilen,
how was the procedure Z_SP_TEST created? If...
you (or your colleague) created it via CREATE PROCEDURE..., e.g. from the SQL console or via native SQL in the ABAP, you only have a catalog object residing in SAP<SID>. In this case you can not simply write the CALL in your AMDP. The reason is that the AMDP runtime either allows
a. the usage of procedures residing in another database schema like SYS_BIC or MY_SCHEMA with a full qualified path name (as mentioned by Jens in his response at Apr 10, 2014 4:05 PM) or
b. the usage of other AMDPs, which reside in the SAP<SID> schema. In this case you have to mention the AMDP in the using clause and you have to omit the schema
you (or your colleague) created the procedure as content object in the HANA database, you should have a catalog object already in the SYS_BIC schema and you can use this object in the AMDP.
If the procedure is created via ADBC (or other native SQL tools), you rather create the procedure in a dedicated namespace like /1BCAMDP/ (namespace reserved for generated objects as in you example). However, as Jens already mentioned, you have to take care about the lifecycle of this generated object, i.e. you have to make sure that the generation is performed before you first call your AMDP (especially the target system), otherwise you'll get a runtime error when the AMDP is executed and you try to call the non-existing procedure Z_SP_TEST.
Cheers,
Jasmin -
Calling stored procedure via java
Hi all,
i have a problem calling a stored procedure in my java code. I found an example at OTN which seems not to be correct. I know there had been a lot of posting regarding this isue but i did not find the solution.
I had the following VB-code to translate to java:
Set k = Server.CreateObject("ADODB.command")
With k
.activeconnection = Db
.CommandType = 4
.CommandText = "Get_SK"
Set vret = .createparameter("vRet", 131, 2) 'Output
.Parameters.append vret
.Execute
End With
In my java code:
CallableStatement sproc_stmt = null;
try {
sproc_stmt = lsession.connection().prepareCall("{ ? = call TCSDBOWNER.Get_SK}");
sproc_stmt.registerOutParameter(1,OracleTypes.NUMERIC);
sproc_stmt.setFetchSize(10);
sproc_stmt.execute();
The call generates an id for inserting new rows in the DB. executing the code shown above i got the following error:
wrong number or types of parameter/arguments
Is there anybody who can help me? Best regards,
akHi again,
this was really ugly:
Re: Executing stored procedure via java
Thanks all, regards,
ak -
Calling ITS Service via abap program
We have made an ITS Service (SAP GUI for HTML) for one of the R/3 programs (Customized).
If the URL is linked directly to the service, it shows correctly.
But if we call the service via transaction code as in: Call tcode Zabc..., it does not work.
How can we call the service directly from the abap program on the click of a button?
Thanks in advance.Hi,
You can do something like this:
CALL FUNCTION 'CALL_BROWSER'
EXPORTING
url = path
new_window = 'X'
EXCEPTIONS
frontend_not_supported = 1
frontend_error = 2
prog_not_found = 3
no_batch = 4
unspecified_error = 5
OTHERS = 6
where PATH variable is ITS service url:
CONCATENATE 'http://server:port/sap/bc/gui/sap/its/webgui?transaction=xxxxxx&okcode=xxxx INTO path.
Hope this helps,
Iván. -
Run/Schedule HANA Procedure via Process Chain or Similar - BW on HANA
Hello Experts,
We have BW 7.4 on HANA database(rev 74). We are working on mixed scenario approach.
We have few of the stored procedure in HANA. We want to schedule it.
Is there any way to schedule it via BW process chain or any similar thing?
Thanks in advance.
Regards
RakeshHi Rakesh,
there is already a nice blog post which describes one way to integrate your stored procedures in a process chain: How to schedule SAP HANA procedures by using SAP BW Process Chains
As Lars said. If you do not need the process chain integration you can use the XS Jobs: Scheduling XS Jobs - SAP HANA Developer Guide for SAP HANA Studio - SAP Library
Best regards,
Florian -
Call pricing procedure - FM, ABAP
Hi,
I would like to call the pricing procedure in ERP. This procedure is called when the user create some sales documents (like quotation) and price is calculated based on Customer, Material, Route, Shipping data).
I would provide all needed data and the procedure (function module) should return detailed pricing calculation (basic price, rebates, final price, ...)
The next level of complexity would be calling that procedure from another system - SAP BI for using in a BPS application.
I hope some one could give me some hint how to proceed with this challenge.
Thanks ,
Tomazhi,
to my understanding what u have to do is u need to maintain a condition record for that material and the customer .
go to VK11 and select the condition type which u want to use . and then select the key ( according to ur requirement) . and then give the sales area data and material info and customer info . and then save it .
once this is done , when ever u create sales order entering the material and the customer , the price will come up .
let me know if im wrong.. .. and do let me know if u find any other answer if im wrong
thanks
madhan -
Calling HANA procedures and Views in oracle DB as secondary DB
Hi Experts
I have a doubt
we know using secondary database connection we can access HANA DB
My primary database is Oracle and Secondary DB is HANA
While creating secondary database connection we need to define default schema.
As we know we can access only the tables present in default schema
Can we access view and procedures created in the default schema or _SYS_BIC schemas in ECC report running on oracle db using ADBC ?
Message was edited by: Jens WeilerHi Pawan,
not sure if I understand your use case correctly.
You can use a secondary DB to the HANA system. Via this secondary DB connection (e.g. in ADBC) you can create views/procedures in the HANA system. And (using again a secondary DB connection) you can consume the views/procedures.
You should not define a schema explicitely in the DDL/DML statements, this is done kind of automatically when you use the secondary database connection.
On the other hand, you have your Oracle DB. You can as well define views/procedures in the Oracle DB via ADBC and consume them (of course with Oracle DB specific syntax :-)). You can use the connection to your primary database, i.e. Oracle DB. You can even use a secondary database connection to your primary database.
What's the concrete use case you'd like to do?
Cheers,
Jasmin -
Calling oracle procedure from ABAP program
There is a requirement to call the oracle stored procedure with some input parameter from ABAP program.
Suppose we have order number which is entered by the user in ABAP program.
This order number needs to be passed to oracle stored procedure as an input parameter in the same ABAP program.
We can call the oracle stored procedure without parameter using the following syntax
exec sql
execute procedure <procedure name>
end exec.
But do not know how to execute the oracle stored procedure with some input parameter?Apologies , following is the correct code.
This will definetly solve your problem.
DATA scarr_carrid TYPE scarr-carrid.
SELECT-OPTIONS s_carrid FOR scarr_carrid NO INTERVALS.
DATA s_carrid_wa LIKE LINE OF s_carrid.
DATA name TYPE c LENGTH 20.
TRY.
EXEC SQL.
CREATE FUNCTION selfunc( input CHAR(3) )
RETURNING char(20);
DEFINE output char(20);
SELECT carrname
INTO output
FROM scarr
WHERE mandt = '000' AND
carrid = input;
RETURN output;
END FUNCTION;
ENDEXEC.
LOOP AT s_carrid INTO s_carrid_wa
WHERE sign = 'I' AND option = 'EQ'.
TRY.
EXEC SQL.
EXECUTE PROCEDURE selfunc( IN :s_carrid_wa-low,
OUT :name )
ENDEXEC.
WRITE: / s_carrid_wa-low, name.
CATCH cx_sy_native_sql_error.
MESSAGE `Error in procedure execution` TYPE 'I'.
ENDTRY.
ENDLOOP.
EXEC SQL.
DROP FUNCTION selfunc;
ENDEXEC.
CATCH cx_sy_native_sql_error.
MESSAGE `Error in procedure handling` TYPE 'I'.
ENDTRY.
Reward points if usefull.
Thanks and regards,
Veerendranath. -
Calling Adobe form via ABAP Web Dynpro
Hi
Ive followed the below WIKI and have encountered an issue and finding it rather frustrating to resolve
http://wiki.sdn.sap.com/wiki/display/WDABAP/CallAdobeFormthroughABAPWebDynpro
Im fairly new to this to pls excuse my ignorance
The message Im getting when I check for errors in my MAIN view is
""A label must refer to element "DISPLAY_NO".""
The procedure tells me the follow
a) Create a label and bind its 'Label for' property to the UI element.
b) Select the label's 'Text' property, bind it to an appropriate context attribute or, alternatively, set the quick info (or accessibility description - if one exists) for the UI element.
c) Either set the visibility of the label to "visible" or set the element that the label refers to as invisible.
Im just not sure where to correct this under my DISPLAY_NO element
Im not sure if thisis the reason why im getting the UNCAUGHT_ EXEPTION - CX_WD_GENERAL runtime error as well
Telling me my object Z************* does not exist
Regards
JustyHi...
in your view for element DISPLAY_NO, There is no label. So create one label and
in corresponding label properties bind its 'Label for' property to the display_no ui element.
And did you activate your component ? if above is the error, you will not able to activate the component. So first check and activate component. if you get any error related to DISPLAY_No, then follow the above procedure.
if you have any doubts, post the same back
Regards
Srinivas -
Call a webservice in abap from an old system (sap_basis 620)
2 - I tried to manage the authentication via abap code: before the call to RECEIVE, I simply inserted this few lines of code:
HTTP_CLIENT->PROPERTYTYPE_LOGON_POPUP = HTTP_CLIENT->CO_DISABLED.
CALL METHOD HTTP_CLIENT->AUTHENTICATE
EXPORTING
PROXY_AUTHENTICATION = ' '
USERNAME = 'username'
PASSWORD = 'password'.
where username and password are obviously the ones that leads to a positive authentication via web browser. Again, I get in output an error 401 Unauthorized due probably to a login procedure error.
Can anyone help me with this task? Thanks in advance
EDIT: sorry for the double post, I wasn't able to get a decent text output in a single message so I had to split the original message in two..Hi Matteo,
I had faced a similar issue when I tried to consume a external web-service from SAP(4.7 with WAS 6.20). But, there was a difference that, there were no authentication required while accessing from a browser, as you have mentioned. So, my solution probably won't work in your case.
Anyways I thought, I should share it. I solved the issue by changing the HTTP proxy settings in transaction SICF(Goto-->Http Proxy). In my case actually I solved the issue by removing the Http proxy settings completely(direct connection). For you I think, you have to probably use the USERID/PASSWORD for the Http proxy.
I may be wrong, just check it out.
Regards
Barada -
How to Call a procedure for UI5 application ?
Hello experts,
What are the possible ways to call a procedure from a UI5 application?
I am trying to call the procedure created in the blog from a ui5 application. I had an idea of calling a procedure from view and generating odata services from views, but this being a read write procedure , not exactly sure if this would work .
Looking forward for your opinions on this .
Regards
VirinchyVirinchi,
Go through the below posts. You can get the source code of how to do it.
How to call HANA store procedure with table variables in xsjs?
JSDoc: Class: Connection
Sreehari -
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
AnveshHi 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 -
Calling a procedure from a portel report
I have a report which is returning rows from a dblink, this works fine. I want to select an individual row from the report and write a new record to a diffent table using some of the columns from the row selected. The table I am writting to will be held within the portal db.
Idea...
Is it possible to call a procedure using the link application wizard (html link), if I could call a procedure via the html link and pass parameters from the record selected then I could write some pl/sql to insert a row in my other table, is this possible ?,if so how do I do it ?
Any other ideas would be most welcome.
Thanks in anticiptaion.The javascript function - you copied it completely, including all my beautiful images - calls an Application Process : toggleAvail.
And I guess you didn't define that one.
You created a stored procedure instead (with another name?), but with an AJAX call you can (only) call Application Processes....(which can call stored procedures...).
(Je mag me ook direct mailen/bellen als dat sneller is...).
Greetings,
Roel
http://roelhartman.blogspot.com/
You can reward this reply by marking it as either Helpful or Correct ;-) -
Calling a procedure from another
i have tried to call a procedure within another and it gives me this error
--PLS-00201: identifier 'P_USER_OBJID' must be declared.
inside the code i put in
BEGIN proc_to_be_called (input_parameter_only); end;
help!!!!!Ok, example using procedures, functions, IN and OUT parameters and variables.
Surely this should give you the answer.
SQL> create procedure B (v_val IN OUT NUMBER) is
2 begin
3 v_val := v_val * 10;
4 end;
5 /
Procedure created.
SQL> create function C (v_val IN NUMBER) RETURN NUMBER is
2 begin
3 RETURN v_val * 10;
4 end;
5 /
Function created.
SQL> ed
Wrote file afiedt.buf
1 create procedure A is
2 v_test1 NUMBER := 5;
3 v_test2 NUMBER := 10;
4 begin
5 B(v_test1);
6 dbms_output.put_line(v_test1);
7 dbms_output.put_line(C(v_test2));
8* end;
SQL> /
Procedure created.
SQL> exec A;
50
100
PL/SQL procedure successfully completed.
SQL>
Maybe you are looking for
-
Setting default filename for servlet-based download
I'm new to servlet programming and am attempting to download a file from the server to the client. When I am prompted to open the file from it's current location or save it to disk, the correct filename appears. However, when I click ok and the Save
-
Dualscreen/dock options Oct. 2013 model.
Hello guys. First and foremost, is this connection possible? 2x Thunderbolt/mini-displayport (left side of MBP) -> DisplayPort monitors Or do I have to rely on Matrix Dualhead2go, USB/DVI adapters, or anything else? Maybe I have to use one mini-displ
-
Connect from SAP gateway to RFC server failed - Java StandAlone app X SAP RAC System
Dears, I'm developing a Java application (RFC SERVER) with JCo3 and I need to connect to SAP RAC system. I have configured the TCP/IP connection via transaction SM59, but when I try to start my server I face the error below (dev_jco_rfc.trc): =======
-
Camera Raw Won't Open B&W Image
I scanned both color negative and b&w negatives to tif files with my Scan Elite 5400 II, using latest Vuescan software. I can't open the b&w image in CR but I can open the color ones. I'm baffled, can CR discriminate between color and b&w images? I'v
-
Bootcamp: Win7, not enough memory.
I mainly run Bootcamp: Win7 for gaming such as StarTrek Online and it generally runs well. However, often when playing StarTrek Online I get a little message from the computer in the upper right hand corner telling me the game is "running in reduced