Function calling a function
Hello,
If a fumction say F1 is calling an another function say F2.
If I change the definition of the function F2, then what will happen with the function F1.
(F1and F2 are stored function)
Does Oracle automatically recompile the function F1?
THANKS.
See this
CREATE FUNCTION F1(ARG_1 IN NUMBER) RETURN NUMBER AS
VAL NUMBER;
BEGIN
SELECT ARG_1*2 INTO VAL FROM DUAL;
RETURN ( VAL );
END;
SQL> ED
Wrote file afiedt.buf
1 CREATE OR REPLACE FUNCTION F2(ARG_1 IN NUMBER) RETURN NUMBER AS
2 VAL NUMBER;
3 BEGIN
4 SELECT F1(ARG_1) + 100 INTO VAL FROM DUAL;
5 RETURN ( VAL );
6* END;
SQL> /
Function created.
SQL> SELECT OBJECT_NAME,STATUS FROM DBA_OBJECTS WHERE OBJECT_NAME IN ('F1','F2');
OBJECT_NAME
STATUS
F1
VALID
F2
VALID
SQL> ED
Wrote file afiedt.buf
1 CREATE OR REPLACE FUNCTION F1(ARG_1 IN NUMBER) RETURN NUMBER AS
2 VAL NUMBER;
3 BEGIN
4 SELECT ARG_1*2 + 100 INTO VAL FROM DUAL;
5 RETURN ( VAL );
6* END;
7 /
Function created.
SQL> SELECT OBJECT_NAME,STATUS FROM DBA_OBJECTS WHERE OBJECT_NAME IN ('F1','F2');
OBJECT_NAME
STATUS
F1
VALID
F2
INVALID
SQL> SELECT F2(100) FROM DUAL;
F2(100)
400
SQL> SELECT OBJECT_NAME,STATUS FROM DBA_OBJECTS WHERE OBJECT_NAME IN ('F1','F2');
OBJECT_NAME
STATUS
F1
VALID
F2
VALID
Similar Messages
-
Function call another function variable
Is it possible to call another function variable?
Below is my Script:
f2();
function f1() {
var v2 = 1;
function f2(v2) {
var v3= 2;
alert(v2);Hi creativejoan0425,
Some additional notes:
> Is it possible to call access another function variable?
No, it isn't. A local variable only lives in the scope of the function (body) where it is declared. In that sense any local variable should be considered private—in OOP terms.
pixxxel schubser's solution is based on setting a global scope for the variable myA, so it is visible from every place of your code.
Another solution could be implemented using JS closure mechanism. You can create a local scope (in an anonymous function which is executed once) then return your main function and additional helpers from that scope. All inner functions have then access to the local variables that have been declared in the scope. For example, you can create your function f1 and attach a getter function to it, as follows:
var f1 = (function(/*anonymous*/__)
// Local variable to be nested in the closure
var v1;
(__ = function(/*optional init value*/x)
// Here is your *actual* function
// do what you want with v1
v1 = 'undefined'!=typeof x ? x : Math.random();
).getVar = function()
// Here is your getter
return v1;
return __;
var f2 = function()
alert( f1.getVar() );
// Process
f1('init');
f2(); // => 'init'
f1();
f2(); // => some random number
f1();
f2(); // => another random number
// etc
This way v1 remains almost private but the outer code can read it through f1.getVar().
Anyway this seems to me a complicate approach for a basic script that probably does not require high security level. Another option, really easy to set up, is to use the fact that a function is an object. Instead of declaring a local variable, just handle v1 as a (public) member of f1, as follows:
var f1 = function F(/*optional init*/x)
// Do something with F.var
F.v1 = 'undefined'!=typeof x ? x : Math.random();
var f2 = function()
alert( f1.v1 );
f1('init');
f2(); // => 'init'
f1();
f2(); // => some random number
f1();
f2(); // => another random number
That's it!
> why every function need to return?
No, return is not required. By default, any function that has no return statement will simply return undefined.
@+
Marc -
Local function calling remote function - error
Dear All
i have following remote function wich return some value from both methods ie.
1) select func1(variable, varialbe) from dual@remoteDB; working
2) select func1(variable, varialbe) from dual; -- by making a synonym at local
Now i create a local function funclocal calling remote functino i.e. func1 in this example as:
CREATE OR REPLACE FUNCTION funclocal(locc varchar2, artnoo number)
RETURN NUMBER IS
query_str VARCHAR2(1000);
STKQTYY NUMBER;
artno number(10);
loc varchar2(80);
BEGIN
artno := artnoo;
loc := locc;
query_str := 'select func1(loc, artno) from dual ';
EXECUTE IMMEDIATE query_str
INTO STKQTYY;
RETURN STKQTYY;
END;
compiled successfully.
But when i run as:
SQL> select funclocal('abc', 469183) from dual;
select funclocal('@st3', 469183) from dual
ERROR at line 1:
ORA-00904: "ARTNO": invalid identifier
ORA-06512: at "funclocal", line 11
Please guide me.
Regards
SaeedEXECUTE IMMEDIATE query_strAs Andreas states: Why are you using dynamic sql?
From what I see all you need is sth like
create or replace function funclocal (locc varchar2, artnoo number)
return number
is
begin
return func1 (locc, artnoo);
end funclocal ;
/even the whole concept of a »local« function seems suspicious. Why do you need that one? -
How to call this function in onload event
Hi All,
I would like to call this function on page load, how to achieve? Thanks in advance.
var siteUrl = '/sites/MySiteCollection';
function retrieveListItems() {
var clientContext = new SP.ClientContext(siteUrl);
var oList = clientContext.get_web().get_lists().getByTitle('Announcements');
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml('<View><Query><Where><Geq><FieldRef Name=\'ID\'/>' +
'<Value Type=\'Number\'>1</Value></Geq></Where></Query><RowLimit>10</RowLimit></View>');
this.collListItem = oList.getItems(camlQuery);
clientContext.load(collListItem);
clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
function onQuerySucceeded(sender, args) {
var listItemInfo = '';
var listItemEnumerator = collListItem.getEnumerator();
while (listItemEnumerator.moveNext()) {
var oListItem = listItemEnumerator.get_current();
listItemInfo += '\nID: ' + oListItem.get_id() +
'\nTitle: ' + oListItem.get_item('Title') +
'\nBody: ' + oListItem.get_item('Body');
alert(listItemInfo.toString());
function onQueryFailed(sender, args) {
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());Try modifying as
<script language="javascript" type="text/javascript">
var siteUrl = 'http://mysite/sites/';
$(document).ready(function()
//Call your function here like
ExecuteOrDelayUntilScriptLoaded(retrieveListItems,"SP.js");
function retrieveListItems() {
var clientContext = new SP.ClientContext(siteUrl);
var oList = clientContext.get_web().get_lists().getByTitle('Project_Issues_and_Risks');
var camlQuery = new SP.CamlQuery();
// camlQuery.set_viewXml('<View><Query><Where><Eq><FieldRef Name=\'Project_x0020_Code\'/>' +
// '<Value Type=\'Lookup\'>NGI-P1</Value></Eq></Where></Query><RowLimit>10</RowLimit></View>');
// <Query><Where><And><IsNotNull><FieldRef Name="ID" /></IsNotNull><IsNotNull><FieldRef Name="Title" /></IsNotNull></And></Where></Query>
camlQuery.set_viewXml('<View><Query><Where><And><Eq><FieldRef Name="Project_x0020_Code" /><Value Type="Lookup">NGI-P1</Value></Eq><Eq><FieldRef Name="Project_x0020_Issue_x0020_Status" /><Value Type="Choice">Issue</Value></Eq></And></Where></Query></View>');
this.collListItem = oList.getItems(camlQuery);
clientContext.load(collListItem);
clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
function onQuerySucceeded(sender, args) {
var listItemInfo = '';
var close = '';
var open = '';
var listItemEnumerator = collListItem.getEnumerator();
while (listItemEnumerator.moveNext()) {
var oListItem = listItemEnumerator.get_current();
listItemInfo += '\nID: ' + oListItem.get_id()+
'\nTitle: ' + oListItem.get_item('Close')+
'\nBody: ' + oListItem.get_item('Open');
close = oListItem.get_item('Close');
open = oListItem.get_item('Open');
alert(close);
alert(listItemInfo.toString());
function onQueryFailed(sender, args) {
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
</script>
<input id="Button1" type="button" value="Retrieve Data" OnClick="retrieveListItems()" />
Geetanjali Arora | My blogs | -
CNTL_ERROR while calling a function module from Java webdynpro
I am calling a RFC function module from javawebdynpro app
which inturn calls a function module performing BDC on CAPP transaction. When I run this from SE37 of the same system or a different system everything works fine. But when called from Java webdynpro app, it raises a CNTL_ERROR exception and creates a short dump.
Any help on this is highly appreciatedGood catch, BI Learner. This was exactly it: when assigning the values from SOURCEFIELDS directly to the import/export parameters, you have to make sure that the types are EXACTLY the same, otherwise it will not work (the routine stops with an error when calling the FM, but there is no dump).
Therefore, to solve my problem, I created the declarations precisely as expected by the FM and assigned the values to these fields:
DATA:
SOURCEVAL TYPE /BIC/OIINVQTY,
SOURCEUOM TYPE /BIC/OIUSUOM,
USITM TYPE /BIC/OIUSITM,
TARGETUOM TYPE /BIC/OIUSUOM,
CONVERTED_COST TYPE /BIC/OIINVQTY.
DATA PRODUCTION_UOM TYPE /BIC/OIUSUOM.
" get the Production UOM
SELECT SINGLE I~/BIC/USPRDUOM
FROM /BIC/PUSITM AS I
INTO PRODUCTION_UOM
WHERE I~/BIC/USITM = SOURCE_FIELDS-/BIC/USITM AND I~OBJVERS = 'A'.
IF ( SY-SUBRC = 4 ). " no records found
"RAISE PARTNO_NOT_FOUND.
RAISE EXCEPTION TYPE CX_RSROUT_SKIP_RECORD.
ENDIF.
" load the parameters
SOURCEVAL = SOURCE_FIELDS-/BIC/USFRZMFC.
SOURCEUOM = SOURCE_FIELDS-BASE_UOM.
USITM = SOURCE_FIELDS-/BIC/USITM.
" then you can call the FM
CALL FUNCTION 'Z_CA_CONVERT_US_COST'
EXPORTING
PSOURCEVAL = SOURCEVAL
PSOURCEUOM = SOURCEUOM
PUSITM = USITM
PTARGETUOM = PRODUCTION_UOM
IMPORTING
PTARGETVAL = CONVERTED_COST
EXCEPTIONS
CONVERSION_NOT_MAINTAINED = 1
PARTNO_NOT_FOUND = 2
OTHERS = 3.
" ... [do the rest]
Thanks for your help,
Dennis -
Error while calling a function.
Hi,
below is my callable statement through which am calling a function which returns the service years of a person with personid as parameter.
But dont know why am getting an error which is returning the serviceyrs as 0.
when i try to debug, the problem is in this statement
System.out.println("the output1 is "+cs.getInt(1));
is there any problem with my code.
please look the code below
thanks
kumar
OADBTransaction txn=getOADBTransaction();
OracleCallableStatement cs = (OracleCallableStatement) txn.createCallableStatement("begin :1:=LMIG_UTILITY_PKG.GET_TOTAL_SERVICE(p_person_id => :2); end;",1);
try
cs.registerOutParameter(1,Types.INTEGER);
cs.setInt(2,Integer.parseInt(pid));
System.out.println("person id is "+pid);
System.out.println("the output1 is "+cs.getInt(1));
cs.execute();
serviceyrs= cs.getInt(1);
cs.close();
catch(SQLException sqle)
System.out.println("ERROR"+sqle.toString());
System.out.println("Service years are "+serviceyrs);Hi, Guess u are missing the connection to the JDBC call.
Try the following...it worked for me..
Connection conn = this.getOADBTransaction().getJdbcConnection();
OracleCallableStatement ocs = null;
String param = null;
try {
String stmt = "BEGIN :1 := <PkgName>.<FunctionName>(:2); end;";
ocs = (OracleCallableStatement)conn.prepareCall(stmt);
ocs.registerOutParameter(1, OracleTypes.CHAR);
ocs.setString(2, <param>);
ocs.execute();
param = ocs.getString(1);
} catch(SQLException se)
{ throw OAException.wrapperException(se);
finally
try {
ocs.close();
return(param);
} catch(Exception e)
throw OAException.wrapperException(e);
} -
Can we call a function module in ADHOC query
Hi
Can we call a function module in ADHOC query if yes how.
Also we ned to know how to call a function module in SAP query.
An early responce is appreciated.
Thanks and best regards
RajeevOkay as far as I understand your aim is:
To fill a field in the output list with a value that is based on the current line information and calculated by a function module
So go to SQ02 and create an additional field in the InfoSet.
You can refer in the coding to the technical names you can see in the left tree window like P0000-PERNR.
More information is avaiable in the Help part look for additional field in SQ02.
Regards,
Michael -
Revision: 3045
Author: [email protected]
Date: 2008-08-29 10:59:25 -0700 (Fri, 29 Aug 2008)
Log Message:
Fix FB-13900: Expression Evaluator: 'is' and 'as' expressions return 'Target player does not support function calls'
Ticket Links:
http://bugs.adobe.com/jira/browse/FB-13900
Modified Paths:
flex/sdk/trunk/modules/debugger/src/java/flash/tools/debugger/concrete/BinaryOp.java
flex/sdk/trunk/modules/debugger/src/java/flash/tools/debugger/concrete/PlayerSession.javaRevision: 3045
Author: [email protected]
Date: 2008-08-29 10:59:25 -0700 (Fri, 29 Aug 2008)
Log Message:
Fix FB-13900: Expression Evaluator: 'is' and 'as' expressions return 'Target player does not support function calls'
Ticket Links:
http://bugs.adobe.com/jira/browse/FB-13900
Modified Paths:
flex/sdk/trunk/modules/debugger/src/java/flash/tools/debugger/concrete/BinaryOp.java
flex/sdk/trunk/modules/debugger/src/java/flash/tools/debugger/concrete/PlayerSession.java -
DLL Wrapper works when functions called out of main(), not from elsewhere?
Hello all,
I am currently trying the JSAsio wrapper out ( http://sourceforge.net/projects/jsasio )
Support on this project is nearly unexisting and a lot of people seem to complain that it doesn't work well.
It works very nicely here, I wrote a few test classes which called some functions (like playing a sound or recording it) and had no problems whatsoever.
These test classes were all static functions and ran straight out of the main() method and printed some results to the console.
public static void main(String[] args)
boolean result = callFunction();
.. end..
public static boolean callFunction()
initASIO();
openASIOLine();
return true;
}The results were all great!
Then I tried to implement these test classes into my swing-based applications. So I want to call these same functions, as in the test classes, as a result of any user action (for example, selecting the asio driver in a combobox) But then these asio driver functions just stop to work. I get errors saying that the ASIO driver is not available. (meaning that the dll wrapper loads the wrong asio driver or can't load one at all)
The library path and classpath are all set correctly, exactly the same as the test classes. Even copied the test code word for word in to my swing applications but it still will not work. I am calling these functions in a new Thread, and even put them in a static methods to try and get that working. When calling these asio methods from the main() method AFTER I set up my components gives me the desired results as well. But as soon as I call these same methods (which are in the same class) from a swing event, it fails;
public class ASIOTest
public static void main(String[] args)
ASIOTest test = new ASIOTest();
test.callFunction(); // <-- WORKS
public ASIOTest()
initializeComponents();
private void initializeComponents()
frame = new JFrame();
choices = new JComboBox();
choices.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event)
// user made selection
new Thread(
new Runnable() {
public void run() {
try
callFunction(); // <-- DOES NOT WORK
catch (Exception e)
e.printStackTrace();
}).start();
public void callFunction()
initASIO();
openASIOLine();
}Is there something fundamental I am missing here?
For what reasons can an application which uses JNI functions go wrong when working in a swing enviroment? (and out of a static context, although this does not seem to make any difference, eg. when calling these functions from static methods inside another class, inside a new thread when the user has generated an event)
I am hoping someone could point me in the right direction :-)
Thank you in advance,
Steven
Edited by: dekoffie on Apr 21, 2009 11:11 AM
Edited by: dekoffie on Apr 21, 2009 11:16 AMjschell wrote:
Two applications.
And you probably run them two different ways.
The environment is different so one works and the other doesn't.Thank you for your fast reply!
Well, I am running the "updated" version from the same environment; I copied the jframe, and a jcombobox into my original test class which only ran in the java console. Consider my second code example in my original post as the "updated" version of the first code example. And as I pointed out, it works fine when I call the jni functions in the main method, but not when I call it from inside the ActionListener.
Or am I again missing something essential by what you mean with a different environment? The classpath and the working directory is exactly the same, as is the Djava.library.path option. :-)
Thanks again! -
Upload data from excel with vba by calling a function module
Hello all,
i have a problem with the function module "ALSM_EXCEL_TO_INTERNAL_TABLE". I will call this function module with vba to load data from excel to sap with a Buttonclick. I have copied this function module and set it remotable. But i can´t call it from excel.
Can you give me some tips how can i
upload data from excel with vba by click a button.
The problem seems the function: call method cl_gui_frontend_services=>clipboard_import in the function module, because when i comment this function call the vba-call is true but no results.
How can I call the function module correct with vba?
Thanks a lot for your tips!!!!
Chris
Message was edited by:
Christoph KirschnerHI
Uploading data directly from Excel file format
* Upload data direct from excel.xls file to SAP
REPORT ZEXCELUPLOAD.
PARAMETERS: filename LIKE rlgrap-filename MEMORY ID M01,
begcol TYPE i DEFAULT 1 NO-DISPLAY,
begrow TYPE i DEFAULT 1 NO-DISPLAY,
endcol TYPE i DEFAULT 100 NO-DISPLAY,
endrow TYPE i DEFAULT 32000 NO-DISPLAY.
* Tick don't append header
PARAMETERS: kzheader AS CHECKBOX.
DATA: BEGIN OF intern OCCURS 0.
INCLUDE STRUCTURE alsmex_tabline.
DATA: END OF intern.
DATA: BEGIN OF intern1 OCCURS 0.
INCLUDE STRUCTURE alsmex_tabline.
DATA: END OF intern1.
DATA: BEGIN OF t_col OCCURS 0,
col LIKE alsmex_tabline-col,
size TYPE i.
DATA: END OF t_col.
DATA: zwlen TYPE i,
zwlines TYPE i.
DATA: BEGIN OF fieldnames OCCURS 3,
title(60),
table(6),
field(10),
kz(1),
END OF fieldnames.
* No of columns
DATA: BEGIN OF data_tab OCCURS 0,
value_0001(50),
value_0002(50),
value_0003(50),
value_0004(50),
value_0005(50),
value_0006(50),
value_0007(50),
value_0008(50),
value_0009(50),
value_0010(50),
value_0011(50),
value_0012(50),
value_0013(50),
value_0014(50),
value_0015(50),
value_0016(50),
value_0017(50),
value_0018(50),
value_0019(50),
value_0020(50),
value_0021(50),
value_0022(50),
value_0023(50),
value_0024(50),
value_0025(50),
value_0026(50),
value_0027(50),
value_0028(50),
value_0029(50),
value_0030(50),
value_0031(50),
value_0032(50),
value_0033(50),
value_0034(50),
value_0035(50),
value_0036(50),
value_0037(50),
value_0038(50),
value_0039(50),
value_0040(50),
value_0041(50),
value_0042(50),
value_0043(50),
value_0044(50),
value_0045(50),
value_0046(50),
value_0047(50),
value_0048(50),
value_0049(50),
value_0050(50),
value_0051(50),
value_0052(50),
value_0053(50),
value_0054(50),
value_0055(50),
value_0056(50),
value_0057(50),
value_0058(50),
value_0059(50),
value_0060(50),
value_0061(50),
value_0062(50),
value_0063(50),
value_0064(50),
value_0065(50),
value_0066(50),
value_0067(50),
value_0068(50),
value_0069(50),
value_0070(50),
value_0071(50),
value_0072(50),
value_0073(50),
value_0074(50),
value_0075(50),
value_0076(50),
value_0077(50),
value_0078(50),
value_0079(50),
value_0080(50),
value_0081(50),
value_0082(50),
value_0083(50),
value_0084(50),
value_0085(50),
value_0086(50),
value_0087(50),
value_0088(50),
value_0089(50),
value_0090(50),
value_0091(50),
value_0092(50),
value_0093(50),
value_0094(50),
value_0095(50),
value_0096(50),
value_0097(50),
value_0098(50),
value_0099(50),
value_0100(50).
DATA: END OF data_tab.
DATA: tind(4) TYPE n.
DATA: zwfeld(19).
FIELD-SYMBOLS: <fs1>.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
mask = '*.xls'
static = 'X'
CHANGING
file_name = filename.
START-OF-SELECTION.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = filename
i_begin_col = begcol
i_begin_row = begrow
i_end_col = endcol
i_end_row = endrow
TABLES
intern = intern
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0.
WRITE:/ 'Upload Error ', SY-SUBRC.
ENDIF.
END-OF-SELECTION.
LOOP AT intern.
intern1 = intern.
CLEAR intern1-row.
APPEND intern1.
ENDLOOP.
SORT intern1 BY col.
LOOP AT intern1.
AT NEW col.
t_col-col = intern1-col.
APPEND t_col.
ENDAT.
zwlen = strlen( intern1-value ).
READ TABLE t_col WITH KEY col = intern1-col.
IF sy-subrc EQ 0.
IF zwlen > t_col-size.
t_col-size = zwlen.
* Internal Table, Current Row Index
MODIFY t_col INDEX sy-tabix.
ENDIF.
ENDIF.
ENDLOOP.
DESCRIBE TABLE t_col LINES zwlines.
SORT intern BY row col.
IF kzheader = 'X'.
LOOP AT intern.
fieldnames-title = intern-value.
APPEND fieldnames.
AT END OF row.
EXIT.
ENDAT.
ENDLOOP.
ELSE.
DO zwlines TIMES.
WRITE sy-index TO fieldnames-title.
APPEND fieldnames.
ENDDO.
ENDIF.
SORT intern BY row col.
LOOP AT intern.
IF kzheader = 'X'
AND intern-row = 1.
CONTINUE.
ENDIF.
tind = intern-col.
CONCATENATE 'DATA_TAB-VALUE_' tind INTO zwfeld.
ASSIGN (zwfeld) TO <fs1>.
<fs1> = intern-value.
AT END OF row.
APPEND data_tab.
CLEAR data_tab.
ENDAT.
ENDLOOP.
CALL FUNCTION 'DISPLAY_BASIC_LIST'
EXPORTING
file_name = filename
TABLES
data_tab = data_tab
fieldname_tab = fieldnames.
*-- End of Program
<b>Excel Upload Alternative - KCD_EXCEL_OLE_TO_INT_CONVERT</b>
*Title : Excel Uploading
TYPES: BEGIN OF t_datatab,
col1(25) TYPE c,
col2(30) TYPE c,
col3(30) TYPE c,
col4(30) TYPE c,
col5(30) TYPE c,
col6(30) TYPE c,
col7(30) TYPE c,
col8(30) TYPE c,
col9(30) TYPE c,
col10(30) TYPE c,
col11(30) TYPE c,
END OF t_datatab.
DATA: it_datatab TYPE STANDARD TABLE OF t_datatab INITIAL SIZE 0,
wa_datatab TYPE t_datatab.
Data : p_table type t_datatab occurs 0 with header line.
DATA : gd_scol TYPE i VALUE '1',
gd_srow TYPE i VALUE '1',
gd_ecol TYPE i VALUE '256',
gd_erow TYPE i VALUE '65536'.
DATA: it_tab TYPE filetable,
gd_subrc TYPE i.
field-symbols : <fs>.
*Selection screen definition
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_file LIKE rlgrap-filename
DEFAULT 'c:test.xls' OBLIGATORY. " File Name
SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
REFRESH: it_tab.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = 'Select File'
default_filename = '*.xls'
multiselection = ' '
CHANGING
file_table = it_tab
rc = gd_subrc.
LOOP AT it_tab INTO p_file.
* so_fpath-sign = 'I'.
* so_fpath-option = 'EQ'.
* append so_fpath.
ENDLOOP.
START-OF-SELECTION.
PERFORM upload_excel_file TABLES it_datatab
USING p_file
gd_scol
gd_srow
gd_ecol
gd_erow.
* END-OF-SELECTION.
END-OF-SELECTION.
LOOP AT it_datatab INTO wa_datatab.
WRITE:/ wa_datatab-col1,
wa_datatab-col2,
wa_datatab-col3,
wa_datatab-col4,
wa_datatab-col5,
wa_datatab-col6,
wa_datatab-col7,
wa_datatab-col8,
wa_datatab-col9,
wa_datatab-col10,
wa_datatab-col11.
ENDLOOP.
*& Form UPLOAD_EXCEL_FILE
* upload excel spreadsheet into internal table
* -->P_TABLE Table to return excel data into
* -->P_FILE file name and path
* -->P_SCOL start column
* -->P_SROW start row
* -->P_ECOL end column
* -->P_EROW end row
FORM upload_excel_file TABLES p_table
USING p_file
p_scol
p_srow
p_ecol
p_erow.
DATA : lt_intern TYPE kcde_cells OCCURS 0 WITH HEADER LINE.
* Has the following format:
* Row number | Colum Number | Value
* i.e. 1 1 Name1
* 2 1 Joe
DATA : ld_index TYPE i.
* Note: Alternative function module - 'ALSM_EXCEL_TO_INTERNAL_TABLE'
CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
EXPORTING
filename = p_file
i_begin_col = p_scol
i_begin_row = p_srow
i_end_col = p_ecol
i_end_row = p_erow
TABLES
intern = LT_INTERN
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0.
FORMAT COLOR COL_BACKGROUND INTENSIFIED.
WRITE:/ 'Error Uploading file'.
EXIT.
ENDIF.
IF lt_intern[] IS INITIAL.
FORMAT COLOR COL_BACKGROUND INTENSIFIED.
WRITE:/ 'No Data Uploaded'.
EXIT.
ELSE.
SORT lt_intern BY row col.
LOOP AT lt_intern.
MOVE lt_intern-col TO ld_index.
assign component ld_index of structure
p_table to <fs>.
move : lt_intern-value to <fs>.
* MOVE lt_intern-value TO p_table.
AT END OF row.
APPEND p_table.
CLEAR p_table.
ENDAT.
ENDLOOP.
ENDIF.
ENDFORM. "UPLOAD_EXCEL_FILE
Regards
Pavan -
/How to call a function in another PowerShell script
Hi All,
I want to use dot-sourced method to call the function from other script,While calling Function.ps1 from the second script there is a Null value in the beginning,
How can we ignore this null value or there is a better approach of doing it without using Import-Module.
#=======Function.ps1============
function add($x,$y)
$z=$x+$y
Write-Host "The value is $Z"
add $a $b
#===========End==================
The second script which has been dot-source to call the function
#================Main script==========
. C:\Users\Anirban\Desktop\Tester.ps1 |Out-Null
add 1 2
#================================
Regards,
Anirban SinghaDot Sourcing is adding the function ADD to console environment and the script is acting like a module vs a script with parameters.
The Add $a $b line should be removed. (Where are $a and $b defined?)
They are not defined hence, "The Value is " blank line
#=======Function.ps1============
function add($x,$y)
$z=$x+$y
Write-Host "The value is $Z"
add $a $b
Should be
#=======Function.ps1============
function add($x,$y)
$z=$x+$y
Write-Host "The value is $Z"
PS C:\Test> . c:\tester.ps1
Add 1 2
Add 3 4
The value is 3
The value is 7
However the add can work without dot sourcing the script file by parameterizing the script
#=======Function.ps1============
Param ($a,$b) # Parameters to the script
function add($x,$y)
$z=$x+$y
Write-Host "The value is $Z"
Add $a $b # body of script
PS C:\Test>
C:\Tester.ps1 1 2
C:\Tester.ps1 3 4
The value is 3
The value is 7 -
How to call a C function calling a Java Method from another C function ?
Hi everyone,
I'm just starting to learn JNI and my problem is that I don't know if it is possible to call a C function calling a Java Method (or doing anything else with JNI) from another C function.
In fact, after receiving datas in a socket made by a C function, I would like to create a class instance (and I don't know how to do it too ; ) ) and init this instance with the strings I received in the socket.
Is all that possible ?
Thank you very much for your help !Hard to understand the question, but by most interpretations the answer is going to be yes.
You do of course understand that JNI is the "API" that sits between Java and C and that every call between the two must go through that. You can't call it directly. -
How to call a C pointer from call library function node
I have a client/server application which the client I am trying to develop using Labview. When I use to communicate the server and the client using the program provided by the manufacter, the system works perfectly.
Now, I am trying to develop a system using labview, because I need to get another things.
I have the DLL provided by the manufacter and the .h too, so I can check the functions parameters. One of these functions needs to be called using a struct element. Probably, the function's DLL instantiates the elements of this struct. I use the call library function node to do it.
When I receive the data, the function returns to me the struct that I passed as a parameter before, and then I can read all the elements of the struct, except the string element that returns nothing. The struct elements that are numerical, I can read them perfectly.
Another thing that is important to say, is that the string data was not returned in fact by the DLL function that the system calls. I have to pass a pointer (I use it as unsigned 16 in Labview, but I tried before as string and unsigned 8) as a parameter, and this pointer will point to the memory location that the string is. When I try to read what is returned by the function, I can read nothing. The same function returns that the size of data that is returning is 17 bytes.
How can I solve it?
Thank you in advanceDid you take a look at the example that ships with LabVIEW that shows how to do all sorts of data passing to DLLs. I believe your situation is one of the examples listed. You can find the example VI in the "<LabVIEW install directory>\examples\dll\data passing" directory.
-
How to call a function module from the Web Template?
Hi all,
how can I call a function module from a BI 7.x web template and then show the result of the FM on the web template?
Many thanks for your hints.
Regards, NilsHi!
I am too working on a similar issue.
Probably this helps:
Re: Calling a function module from a Web Template
Regards,
Sri -
Program making a RFC call to Function Module not working in background
Hi All,
I have an ABAP Program which is used to do a reconciliation check between the R/3 and BI system for Invoice Data. Please find below the details of the program flow:
1. Program counts the number of records in the DSO table and aggregates the Net_Value based on the date range (passed as parameters)
2. Program calls a Function Module (RFC Call) which counts the number of records in the R/3 table and aggregates the Net_Value for the same date range
3. Function Module Passes back the count values and aggregated Net_Value to the program
4. Program compares the count and aggregated Net_Value from EDWH and MSP systems and sends an email mentioning whether the counts match or not
However we are facing an issue.
Whenever, we execute the program in dialog mode, it works fine and fetches results within 5-6 minutes. However if we schedule the program to run in background (parameters through a variant), it gives no results even after running for over 3-4 hours. We tried figuring it out yesterday but could not come to any conclusion. Since there is a RFC call being to the function module, we were wondering if we need to specify some other parameter as well.
Thanks & Regards
DharmendraRFC Call is a procedure for executing remote enables function modules. It is done via the 'Remote Enabled' radio button on the function module's attribute screen.
Maybe you are looking for
-
Default value for Read-Only Picklist Field
Hi, all-- I would like to have a default value ("Undetermined") for the "Associated Account" read-only picklist value. I have an account record of this value for this purpose. This is because if there is no value in the field, the record will not be
-
Information Message-Values for Ordinary deprec. have changed in dep. area 0
We had changed the scrap value for few assests and when ever we goto AW01N i.e asset explorer ,it displays the message - Values for Ordinary deprec. have changed in dep. area 01 in fiscal year XXXX. The user doesnt this message popping up every time
-
2960 does not start on every first attempt
Hi, I have a Cisco 2960 PoE-24 that every time I connect the power cable for the first time (after a long pause) it freezes with the System Light on and not blinking and not giving anything in the console. Any help? Thanks
-
I want to execute a procedure that is stored in the database . I am trying to place the call in the when-button-pressed trigger. What is the syntax for calling a procedure from when-button-pressed trigger ? Thanks Kim
-
I know that the company disclaims of what might happen because to do ....But is Jailbreak .. Illegal access.