Call a function module inside of another function module
Has anyone ever called a function module inside of a remote enabled function module? Maybe this needs to be accomplished inside of an include. Just wondering.
Thanks!
Hi
No u can't do it because the RE_LAST_DAY_OF_MONTH is not remote function module.
If you need to call it u should insert it in a RFC, so u should create in R/3 a new RFC calling both fms: RE_LAST_DAY_OF_MONTH and the remote one.
And so call this new rfc instead of the other one.
Max
Similar Messages
-
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 -
Is it possible to call a adobe form inside a function module?
Hi gurus,
i am trying to generate the pdf data source inside a custom function module,
the function module will call the FUNCTION 'FP_JOB_OPEN' , then call the function module of the pdf interface. then get the pdf data back and return.
but at run time i got the error message:
FPRUNX101, the job already started.
then the program stopped.
i checked the service market place, there is a note for that:858325 Message "Job already started" when you display PDF forms .
according to the notes,it seems that it's only possible to call the pdf generated function module in a program.
my question is , is there a way to call that in a funciton module?
best regards.
Jun
the note states that:
Reason and Prerequisites
At runtime, a PDF-based form is called using a generated function module. If you use the new interface, it is necessary to set the function modules FP_JOB_OPEN and FP_JOB_CLOSE as control structures with one or several generated function modules. In order for the single test from Transaction SFP to work simultaneously, however, the system checks for the test environment of Transaction SE37 (in which the test ultimately runs) in the single test. In this case, the function modules FP_JOB_OPEN or FP_JOB_CLOSE are called automatically.
If you then test a function module that calls a PDF based form and therefore calls the function module FP_JOB_OPEN itself, this leads to the error message mentioned above.
Solution
The test should be carried out using a program that in turn calls the function module to be tested.sorry, i found out the reason.
the fm can not test direct in se37, it should be wrapped by a program.
br.
zj -
How can call a function module(RFC)in one server to another sever in my rep
How can call a function module(RFC)in one server to another sever in my report program.
What i am know whenever rfc enabled immediately radio button checks then only it will come.
please justify.Syntax
CALL FUNCTION func DESTINATION dest [EXPORTING p1 = a1 p2 = a2 ...]
[IMPORTING p1 = a1 p2 = a2 ...]
[CHANGING p1 = a1 p2 = a2 ...]
[TABLES t1 = itab1 t2 = itab2 ...]
[EXCEPTIONS [exc1 = n1 exc2 = n2 ...]
[system_failure = ns [MESSAGE smess]]
[communication_failure = nc [MESSAGE cmess]]
[OTHERS = n_others]].
http://help.sap.com/saphelp_47x200/helpdata/en/22/042537488911d189490000e829fbbd/frameset.htm -
How to call a function defined inside a module loader
I wanna know...the method of calling a function defined
inside a module loader component?
Th
<mx:ViewStack id="myViewStack" >
<mx:Canvas id="Mgmt1">
<mx:Label text="Gopher"/>
</mx:Canvas>
<mx:Canvas id="Mgmt2" >
<mx:Label id="gopherlbl" top="-2" left="0"
height="40"/>
<CustomComp:MgmtGrid id="ManageCom"/>
</mx:Canvas>
<mx:Canvas id="Admin">
<mx:ModuleLoader id="adminModule" url="{adminModUrl}"
width="100%" height="100%" />
</mx:Canvas>
where adminModUrl="admin.swf";
Thru the MangeCom id reference,I am able to call the fucntion
defined inisde the CustomComponent File MgmtGrid...But I am unable
to call the funciton defined inside adminModule
ModuleLoader...(using id reference).Anyone pls suggest a solution
for this..Ensure the module is loaded before calling the method in
particular if you are calling it at the initialization of your
app. -
Calling a function inside another class
I have the following two classes and can't seem to figure to figure out how to call a function in the top one from the bottom one. The top one get instantiated on the root timeline. The bottom one gets instantiated from the top one. How do I call functions between the classes. Also, what if I had another call instantiated in top one and wanted to call a function in the bottom class from the second class?
Thanks a lot for any help!!!
package
import flash.display.MovieClip;
public class ThumbGridMain extends MovieClip
private var grid:CreateGrid;
public function ThumbGridMain():void
grid = new CreateGrid();
public function testFunc():void
trace("testFunc was called");
package
import flash.display.MovieClip;
public class CreateGrid extends MovieClip
public function CreateGrid():void
parent.testFunc();kglad,
Although I agree that utilizing events the way you attempted in your suggestion is better for at least a reason of eliminating dependency on parent, still you code doesn't not accomplish what Brian needs.
Merely adding event listener to grid instance does nothing - there is no mechanism in the code that invokes callTGMFunction - thus event will not be dispatched. So, either callTGMFunction should be called on the instance (why use events - not direct call - in this case?), or grid instance needs to dispatch this event based on some internal logic ofCreateGrid AFTER it is instantiated - perhaps when it is either added to stage or added to display list via Event.ADDED. Without such a mechanism, how is it a superior correct way OOP?
Also, in your code in ThumbGridMain class testFunc is missing parameter that it expects - Event.
Am I missing something?
I guess the code may be (it still looks more cumbersome and less elegant than direct function call):
package
import flash.display.MovieClip;
import flash.events.Event;
public class ThumbGridMain extends MovieClip
private var grid:CreateGrid;
public function ThumbGridMain():void
grid = new CreateGrid();
grid.addEventListener("callTGMFunction", testFunc);
addChild(grid);
// to call a CreateGrid function named cgFunction()
public function callCG(){
grid.cgFunction();
public function testFunc(e:Event):void
trace("testFunc was called");
package
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.Event;
public class CreateGrid extends MovieClip
public function CreateGrid():void
if (stage) init();
else addEventListener(Event.ADDED, callTGMFunction);
// to call a TGM function
public function callTGMFunction(e:Event = null):void
// I forgot this one
removeEventListener(Event.ADDED, callTGMFunction);
this.dispatchEvent(new Event("callTGMFunction"));
public function cgFunction(){
trace("cg function called");
I think this is a case of personal preference.
With that said, it is definitely better if instance doesn't rely on the object it is instnatiated by - so, in this case, either parent should listen to event or call a function directly. -
Calling a function module on another server
Dear all,
I have a function module on a test server which accesses a database table on it. I need to call that function module from a development server. Both servers are AS ABAP. I believe I need RFC, but how do I specify the test server address from the development server function call?
Thanks for your help,
PhilonYou need to call the Function module as a RFC FM.
The function module needs to be set as such.
In its atributes, it needs to be Remote-enabled function module.
To call it, proceed as follows:
CALL FUNCTION <FUNCTION MODULE> ON <DESTINATION>.
<DESTINATION> needs to be a predefined RFC destination. (See transaction SM59)
CALL FUNCTION func DESTINATION dest parameter_list.
Effect
Synchronous call of a remote-enabled function module specified in func using the RFC interface. Use addition DESTINATION to specify the destination in dest. For func and dest, character-type data objects are expected. After terminating the remotely called function, the calling program is continued after CALL FUNCTION.
Note
If the content of dest is equal to the constant space, then the addition DESTINATION is ignored and a normal call CALL FUNCTION func is executed.
Leonardo De Araujo -
Calling a function that's inside another function
function test1():void
function test2():void {..}
How do I call test2 function (outside test1 function)? Is it possible?Hi,
yes it is possible.
Here is the code helps u
function foo():Function
var x:int = 40;
function rectArea(y:int):int // function closure defined
return x * y
return rectArea;
var myProduct:Function = foo();
var s = myProduct(4);
trace(s);
Saransoft -
Can't call a function inside another function
Hello,
i have the following function :
FUNCTION test_day_week (P_DATE DATE)
RETURN VARCHAR2 IS
BEGIN
RETURN TO_CHAR(P_DATE ,'DAY');
END;
--it returns the day name of a given date
FUNCTION TEST_DAY_NUMBER (P_DAY_NAME VARCHAR2)
RETURN NUMBER IS
V_RESULT NUMBER;
V_RETURN_DAY VARCHAR2(30);
P_DATE DATE;
BEGIN
V_RETURN_DAY := test_day_week (P_DATE );
MESSAGE('V_RETURN_DAY'|| V_RETURN_DAY);
MESSAGE('V_RETURN_DAY'|| V_RETURN_DAY);
IF V_RETURN_DAY = 'MONDAY' THEN V_RESULT :=1;
END IF ;
IF V_RETURN_DAY = 'TUSEDAY' THEN V_RESULT :=2;
END IF ;
IF V_RETURN_DAY = 'WENDSDAY' THEN V_RESULT :=3;
END IF ;
IF V_RETURN_DAY = 'THURSDAY' THEN V_RESULT :=4;
END IF ;
IF V_RETURN_DAY = 'FRIDAY' THEN V_RESULT :=5;
END IF ;
IF V_RETURN_DAY = 'SATURDAY' THEN V_RESULT :=6;
END IF ;
IF V_RETURN_DAY = 'SUNDAY' THEN V_RESULT :=7;
END IF ;
RETURN V_RESULT;
END;
--The above function returnds the day name in numbers
The proble is that when i call test_day_week function it returns no value even it is tested separatly and works fine don't know where is my problem :
1-number of argrments in function[b] TEST_DAY_NUMBER
?? and so ..!
Regards,
Abdetu..You could also cut the whole thing down to a simple function... (assuming you have a need to customise your start of week rather than use built in date functionality)
SQL> ed
Wrote file afiedt.buf
1 CREATE OR REPLACE FUNCTION test_day_week (P_DATE DATE) RETURN NUMBER IS
2 BEGIN
3 RETURN (INSTR('MONTUEWEDTHUFRISATSUN',TO_CHAR(P_DATE,'DY'))+2)/3;
4* END;
SQL> /
Function created.
SQL> select test_day_week(sysdate) from dual;
TEST_DAY_WEEK(SYSDATE)
1
SQL> select test_day_week(sysdate+1) from dual;
TEST_DAY_WEEK(SYSDATE+1)
2
SQL> select test_day_week(sysdate+2) from dual;
TEST_DAY_WEEK(SYSDATE+2)
3
SQL> select test_day_week(sysdate+3) from dual;
TEST_DAY_WEEK(SYSDATE+3)
4
SQL> select test_day_week(sysdate+4) from dual;
TEST_DAY_WEEK(SYSDATE+4)
5
SQL> select test_day_week(sysdate+5) from dual;
TEST_DAY_WEEK(SYSDATE+5)
6
SQL> select test_day_week(sysdate+6) from dual;
TEST_DAY_WEEK(SYSDATE+6)
7
SQL> select test_day_week(sysdate+7) from dual;
TEST_DAY_WEEK(SYSDATE+7)
1
SQL> -
How to call a function module in VC
Hi,
I want to call a function module for an addition formula which shall calculate and infer the value.
eg. quantities of 5 different characteristics (of numeric data) is to be summed up and inferred against the 6th characteristic.
I want to know the detailed process to create a Variant Function and use it in a dependency.
Request to please advise the steps, type of dependency and its code.
Regards,
Rajesh MohapatraDear Rajesh,
I also wanted to learn how to do that, your post motivated me to use a bit of freetime and investigate on the subject. I finally made my function work, so here are the tips.
The example is very simple, just a variant function with two inputs and which multiplies inside the input values and transfer that result to the output ( 3 x 4 => 12 ).
Deducting how to add five values or any other logic would be easier starting from there.
STEP 1: Create Variant Class for the product. I imagine you already have that. In my case its name is ZVC_CLASS, you have already a material assigned to the class, a configuration profile, etc....
STEP 2: Create Three Characteristics Z_NUM_CH_1,Z_NUM_CH_2,Z_NUM_CH_3 the three of numeric type
STEP 3: Assign characteristics from step 2 into class ZVC_CLASS
STEP 4: Create the function module with the code given below. I put the name ZVC_FUN_TEST
FUNCTION ZVC_FUN_TEST.
""Interfase local
*" IMPORTING
*" REFERENCE(GLOBALS) TYPE CUOV_00
*" TABLES
*" QUERY STRUCTURE CUOV_01
*" MATCH STRUCTURE CUOV_01
*" EXCEPTIONS
*" FAIL
*" INTERNAL_ERROR
*- Inicializar los valores.
DATA:
GV_VALOR_FINAL TYPE CUOV_01-ATFLV,
GV_VALOR_NUM1 TYPE CUOV_01-ATFLV,
GV_VALOR_NUM2 TYPE CUOV_01-ATFLV.
CLEAR:
gv_valor_final,
gv_valor_num1,
gv_valor_num2.
CALL FUNCTION 'CUOV_GET_FUNCTION_ARGUMENT'
EXPORTING
ARGUMENT = 'Z_NUM_CH_1'
IMPORTING
VTYPE = P_VTYPE1
SYM_VAL = P_VALOR_SYM1
NUM_VAL = gv_valor_num1
IO_FLAG =
TABLES
QUERY = QUERY
EXCEPTIONS
ARG_NOT_FOUND = 01.
IF SY-SUBRC <> 0.
RAISE INTERNAL_ERROR.
ENDIF.
CALL FUNCTION 'CUOV_GET_FUNCTION_ARGUMENT'
EXPORTING
ARGUMENT = 'Z_NUM_CH_2'
IMPORTING
VTYPE = P_VTYPE1
SYM_VAL = P_VALOR_SYM1
NUM_VAL = gv_valor_num2
IO_FLAG =
TABLES
QUERY = QUERY
EXCEPTIONS
ARG_NOT_FOUND = 01.
IF SY-SUBRC <> 0.
RAISE INTERNAL_ERROR.
ENDIF.
*- Calculate final value
gv_valor_final = gv_valor_num1 * gv_valor_num2. "Especifico de c/u.
DATA: VTYPE TYPE CUOV_01-ATFOR.
VTYPE = 'NUM'.
CALL FUNCTION 'CUOV_SET_FUNCTION_ARGUMENT'
EXPORTING
ARGUMENT = 'Z_NUM_CH_3'
VTYPE = VTYPE
NUM_VAL = gv_valor_final
TABLES
MATCH = MATCH
EXCEPTIONS
EXISTING_VALUE_REPLACED = 01.
IF SY-SUBRC <> 0.
RAISE INTERNAL_ERROR.
ENDIF.
ENDFUNCTION.
STEP 5: Activate the function module for Variant Configuration in transaction CU65, put there your function module, release int and in button characteristics write Z_NUM_CH_1,Z_NUM_CH_2,Z_NUM_CH_3. Flag the first two lines as they are inputs.
STEP 6: Create a Dependency ZVC_PROC_TEST of type Procedure to call the function with this code:
000010 Function ZVC_FUN_TEST
000020 (Z_NUM_CH_1 = $root.Z_NUM_CH_1,
000030 Z_NUM_CH_2 = $root.Z_NUM_CH_2,
000040 Z_NUM_CH_3 = $self.Z_NUM_CH_3)
STEP 7: Lets say I want to calculate the multiplication only upon the selection of another characteristic "Calculate" YES/NO. For this I create a characteristic in CT04 Z_CALCULATE type CHAR 1 with possible values Y or N. For the value Y y add the procedure ZVC_PROC_TEST so that formula only activates on Y.
STEP 8: Add characteristic Z_CALCULATE to class ZVC_CLASS
STEP 9: VA01, it should work -
Call RFC Function Module in R/3 via XI during Mapping
Hi,
I have an XI scenario where I have to fill the IDoc ADRMAS03 in XI and send it to R/3. Unfortunately the sender system does not provide the required address number (ADRNR) for the Business Partner, only the Business Partner number. Therefore I want to call a Function Module in R/3 during the mapping in order to get the ADRNR.
Does anybody know which RFC-Function Module I can call in R/3 4.6c providing the Busness Partner number in order to get the ADRNR?
Thanks.
AlexHi,
no need for RFC lookup it's better to do as he wants
(inside an exit in R3) - just my point of view
BTW
don't use a FM just find a table with both values
and create a select statement youself
Regards,
michal
<a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a> -
Can we call a function module from a structure?
Hi everyone,
I have a requirement to send an idoc. I have to populate a segment with signing authority . I have to create a custom table for that and call the function module. How do i do that ?
Thanks in advance,
VenkatHi!
When you have an outbound IDOC, then there is a function module to create the IDOC and fill the segments. Often the function name follows the form MASTERIDOC_CREATE_NNN with NNN = IDOC-name.
Inside this function module should be an user exit to add some own coding.
Regards,
Christian -
Can I call a function in another package?
Dear all,
Can I call a function in another package?
Say I have package A, and package B.
Is it possible for me to call a function in inside package A, within a function inside package B?
If yes, what's the syntax.
Thanks in advance!The variable in the calling package that will receive the value of the function in the other package needs to be defined based on that type in the other package directly:
sql>create or replace package pkg_a
2 is
3 type testTable is table of varchar2(10) index by binary_integer;
4
5 function f_a return testTable;
6 end;
7 /
Package created.
sql>create or replace package body pkg_a
2 is
3 function f_a
4 return testTable
5 is
6 v_table testTable;
7 begin
8 v_table(1) := 'One';
9 v_table(2) := 'Two';
10 return v_table;
11 end;
12 end;
13 /
Package body created.
sql>create or replace package pkg_b
2 is
3 procedure p_b;
4 end;
5 /
Package created.
sql>create or replace package body pkg_b
2 is
3 procedure p_b
4 is
5 v_table pkg_a.testTable; -- this variable has to be based on the type in pkg_a
6 begin
7 v_table := pkg_a.f_a;
8 for i in 1..v_table.count loop
9 dbms_output.put_line( v_table(i) );
10 end loop;
11 end;
12 end;
13 /
Package body created.
sql>exec pkg_b.p_b
One
Two
PL/SQL procedure successfully completed. -
Calling a function inside a symbol?
Hi there,
I'm one of those flash-devs that are trying to get Edge Animate to do what I usually do in Flash, so I might be doing this the wrong way, but I've got a symbol with a function "inside" on my stage, and I wanna call that function from the stage.
I've been trying to use sym.getComposition().getStage().getSymbol("symbolName").functionName(); but it doesn't work.
I don't have any problems manipulating the symbol itself by calling .play() or .hide() so I know the path works....can anyone show me the right syntax to call a function inside a symbol?
Thx in advanceHi Abnesher,
An important principle to grasp is that symbols (and the stage is one of them) lies in parallel, despite the fact of instances of different symbols being nested one in another (and all in fine nested in the stage).
The consequence is that from inside your nested symbol you have no direct visibility of the function defined inside the stage symbol !
Inside the Stage symbol, in the document.compositionReady event handler :
sym.yourGlobalFunction = function( firstParameter)
// your stuff
Inside another symbol, in one of its events handlers :
sym.getComposition().getStage().yourGlobalFunction( 5);
Gil -
Call a function inside a package from a stored procedure
Hello:
I am kind of new to the stored procedure. Does anyone know how to call a function inside a package from another stored procedure?
I have a existing function (func_b) inside a package (pack_a) and it returns a cursor. I want to call this function from a stored procedure (proc_c) so that I use the data inside the cursor.
can I do the following in proc_c:
my_cursor1 SYS_REFCURSOR;
begin
my_cursor1 := exec pack_a.func_b
end
It will be very helpful if anyone can point me to any reading or example. Thank you very much for your information.guys:
Thank you for your information so far. I need some more help here. I was able to run the function in my stored procedure. However, I was not able to print the result on the screen to view the cursor result, although I am using dbms_output.put_line statement inside my stored procedure.
I use the following statement to execute my stored procedure on sql*plus. I can tell the stored procedure is executed successfully, but I did see anything printed:
DECLARE TEMP VARCHAR2(100);
BEGIN PROC_LAWS_CAD_NAME_SEARCH('LPD', 'TEST DEVICE ID', 'TEST LAST NAME', 'TEST FIRST NAME', 'F', '11112009', TEMP); END;
I tried to use 'set serveroutput on' and got the following error:
ERROR:
ORA-06502: PL/SQL: numeric or value error: host bind array too small
ORA-06512: at line 1
I am kind of confused now. thank you for your help.
Jack
Here is my procedure:
create or replace
PROCEDURE PROC_SEARCH
( AGENCY_ID IN VARCHAR2,
DEVICE_ID IN VARCHAR2,
L_NAME IN VARCHAR2,
F_NAME IN VARCHAR2,
SEX IN VARCHAR2,
DOB IN VARCHAR2,
CAD_NAME_SCH_RESULT_STR OUT VARCHAR2)
AS
v_agy_id varchar2(10);
v_device_id varchar2(20);
v_l_name varchar2(25);
v_f_name varchar2(15);
v_sex varchar2(1);
v_dob date;
-- this cursor is going to be used to store a list of warrant matching
-- name search criteria
cad_srch_cursor sys_refcursor;
objSrch SEARCH_RESULT_TEMP%ROWTYPE;
BEGIN
cad_srch_cursor := SEARCH_PKG.SEARCH('TESTING', 'TESTER', null, null,null, null, getPhonetic('TESTING'));
LOOP
FETCH cad_srch_cursor INTO objSrch;
EXIT WHEN cad_srch_cursor%NOTFOUND;
--insert into SEARCH_RESULT_TEMP (name_last) values (objSrch.name_last);
CAD_NAME_SCH_RESULT_STR := objSrch.name_last;
dbms_output.put_line('First:'||objSrch.name_first||':Last:'||objSrch.name_last||':Middle:'||objSrch.name_middle);
end LOOP;
END PROC_LAWS_SEARCH;
-----------------------------------------
Maybe you are looking for
-
How to create an Editable report?
I want to generate one report using BEx Analyser as my clients requirement. What the clients requirement is, when he refreshes the query, he wants the query to be get refreshed and another user-editable sheet need to be get created. And the calcula
-
I can access the EM 12c with the ssl address https://server:7799/em but I would like to use the non-ssl side of it... I can access http://server:7788 and get the welcome index page.. but if I use http://server:7788/em I get Error 403 Forbidden...
-
Extendind a network with an airport Extreme and a TimeCapsule (new extreme)
I have a Timecapsule in the basement and have hard wired an extreme to it upstairs. I have my iMac hardwired to the Timecapsule (802.11ac version). I have the extreme set up to extend the network. My problem is the iMac connected to the TimeCapsule j
-
Texas Hold 'Em Suddently Stopped Working
I bought Hold Em a week or so after the games came out and I enjoy it a nice bit. I went over to my cousin's house one night and I was playing it and suddently the whole thing froze in the middle of a hand. I forgot how to reset the iPod so I brought
-
IMac won't connect to internet, but can on internal network
Hi, I've tried resetting the router and various other things that I found on the internet. I know its not a router problem as I am using my MBP to post this discussion. It won't even connect to the router's internap page. Any thoughts?