Calling alternating functions
I have two functions called functionA() and functinoB(). As
the play head travels down the timeline I'd like to call
functionA() on frame 100, functionB() on frame 200, functionA() on
300, functionB() on 400 and so on. However, instead of having to
type functionA() or functionB() in the keyframe, I'd like to just
type functionCaller() and have some logic in that function that
would call the appropriate function based on the last function
called. I've tried an if/else function based on a variable I change
back and forth as each function runs, but it just keeps choosing
functionA() over and over. Any suggestions?
--gw
You still want to put the functionCaller call in the keyframe
(not in an onEnterFrame handler) ? If so:
function functionCaller() {
if ((_currentframe/100)%2 !=0) {
functionA()
} else {
functionB()
}
Similar Messages
-
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 -
Passing arrays with Call Library Function does not work after application builder
Calling a DLL with Call Library Function which requires an array of data works correctly in Labview, but after building an exe with application builder, the call no longer works. Dereferecing the pointer in the DLL retuns all 0s and not the actual values.
Solved!
Go to Solution.
Attachments:
TEST.zip 28 KBI did not run your code because it is a little unclear to me what it does.
Two things:
First, is the DLL you are calling the DLL-ified version of PopUpNames.vi? Then the problem is likely that the panel is not being built into the DLL.
When LabView builds an application / dll, it strips the front panel and block diagram from all VIs that it doesn't think need to show a panel at run time. This reduces file size and increases code security. The App Builder's panel inclusion logic can be overridden by Build Specifications -> Source File Settings -> Remove front panel. A better method is to put a property node on a control in a window you want to show marking it "visible"; this is sufficient to tell the App Builder it should keep the panel.
Currently Source File Settings shows "no dependencies" (clearly incorrect---another evil side effect of Express VIs I guess) but if you change the settings as shown below to keep ALL panels, one might hope the App Builder can figure it to keep the panel when it deconstructs the Express VI. (Alternatively convert the Express VI into a regular one.)
A second comment: I am a bit flummoxed at the larger goal here. You are calling LabView DLL from LabView, which doesn't make a lot of sense, so I assume your larger goal is to call LabView from C or vice-versa. In that case be aware that your DLL is x86 (32-bit) but you are passing 64-bit ints as your pointers. In this case it is 32-bit LabView with 32-bit pointers in embedeed in 64-bit containers calling 32-bit LabView with 32-bit pointers in embedeed in 64-bit containers, so it all works, but if your going to call this from C or whatnot you're going to have to follow that same design.
When calling C code the LabView Call Library Function does have a "unsigned pointer-sized integer" data type that always appears to be 64 bits in the dev env but which actually passes a 64 or 32-bit int to the DLL depending on the environment. The "pointer sized int" has to be 64 bits in the "LabView" part of the code because LabView's strong typing requires the data type to be determined at compile time. Casting all pointers to the largest data type in LabView makes it possible to write platform-independent code, but down at the Call Library level you still have to put the right number of bytes on the stack. -
Window doesn't close wheh Call Library Function Node set to Run in Any Thread
This is a problem regarding Call Library Function Nodes running in the UI thread or any thread.
I have a camera which has its own API supplied as a dll. I have created a set of VI wrappers which each call a function in the dll through a Call Library Function Node.
Initially each CLFN was set to 'Run in the UI thread' (the default).
To start the camera streaming images I call (through a CLFN)
ICubeSDK_Start(int CamIndex, Hwnd, ImgHandle, bool Preview, bool callback);
If Preview = True then the image is displayed in a preview window.
If ImgHandle = NULL a default preview window
is used.
In the CLFN definition I define:
ImgHandle as a U32
Preview as a I32
To stop the camera streaming images I call
ICubeSDK_Stop(int CamIndex)
In the actual implementation I set ImgHandle = 0 (NULL) and Preview = 1 (true).
This all works fine, and a preview window is opened and images displayed. When I call ICubeSDK_Stop the preview window is closed.
However, I would prefer to set the CLFN to 'Run in any thread' because
a) when run in the UI thread the preview window randomly gets sent to the back when I switch focus between open VI windows (presumably because it is in the same thread as the VIs)
b) I don't want to put unnecessary stuff in the UI thread
c) my (naive?) understanding is that it is safer to run in any thread
So I have set all CLFNs to 'Run in any thread'
When I do this the preview window opens OK, and behaves like any other non LabVIEW controlled window in terms of focus. But when I call ICubeSDK_Stop() the preview window does not get closed properly, it just shows a blank image. I can't close it manually, there is no X in the corner and no option to close it from the taskbar. To get rid of it I have to close the LabVIEW project it is spawned from, which often results in a crash. It does appear as a separate item in task manager but if I 'end process' it, LabVIEW closes (and often crashes) as well.
If I change only the CLFNs that call the Start and Stop functions back to 'Run in the UI thread' then it all works fine again, except that the preview window gets sent to the back randomly as before.
So, what do I have to do to get the preview window to close properly if I set the CLFN to 'Run in any thread'.
Alternatively, is there a way to close the window programmatically (ie force it to close) after I have called ICube_Stop.
Thanks
DAveHi Dave,
The "Run In UI Thread" switches from the thread the VIs currently executing in to the user interface thread. If you select "Run in Any Thread", the Call Library Function Node continues in the currently executing thread. By default, all Call Library Function Nodes run in the User Interface thread.
Before you configure the Call Library Function Node to run in any thread, you have to make sure that the code is thread safe. Code is thread safe when it does not store any global data (e.g. global variables, files on disks, etc.), does not access any hardware, does not make calls to any functions, libraries or drivers that are not thread safe.
Unfortunately, since you said that your DLL accesses hardware, it is not recommended to use "Run in Any Thread." This is probably why you are seeing the crash.
If your preview window gets sent to the back you can programmatically bring it forward. Here is an example of how this can be done: http://decibel.ni.com/content/docs/DOC-4551
If you want to completely close the window down you can do so as described in this link: http://digital.ni.com/public.nsf/allkb/81E9C1441900FFCE8625748F0055DBB0?OpenDocument
I also thought you might find this useful: http://zone.ni.com/devzone/cda/tut/p/id/3009
I hope this helps.
Regards,
Mahdieh G
Applications Engineer
National Instruments UK&Ireland -
Call a function module from CRM 5.0 via ITS to FICA
Hi
I want to call a function module in FICA (FICA is using sapgui) from CRM (IC-web) via ITS (Not integrated in FICA)
Is it possible and how should this be done???
If someone know how, please help
BR//JLgenerally RFCs should not have user dialogs.
any how to handle your case, you need ITS and since FICA is a WAS 6.20 system, you need to have a ITS installed for FICA system, without which you cannot do that.
alternatively you can mimic the functionality of the RFC by programming the same in a BSP and call this from CRM system
Regards
Raja -
How can a custom class call a function in "parent" class?
Say I have an application (ultrasimplified):
public class myApp {
myClass mc;
boolean foo=false;
public static void main(String[] args) {
mc = new myClass();
public static void myFunc(boolean blah) {
foo=blah;
in a separate .java file where my questions lie:
public class myClass {
boolean bar=true;
public void myClass() {
// this is wrong, but how would I do this:
foo = bar; // foo in myApp set to true
// or how would I call "myFunc()" in myApp from this class:
myFunc(bar);
my problem is that I've created a new class that I share between two applications so I could share the code. However, I want this class I created to call a function in the application class that instanciated it. Or alternatively, I would like to set a variable in the class that instanciated myClass.
How would go about this? I've used the "this" parameter in applets to pass the parent class to an inner class, but main() in applications doesn't allow the non-static "this":
myClass my = new myClass(this);
Is there something similar I can do?You can let MyApp implement an interface and refer to that object in MyClass:
class MyApp implements Something {
main() {
MyApp app = new MyApp();
MyClass mc = new MyClass(app);
public void foo() { }
class MyClass {
Something app;
MyClass(Something app) {
this.app = app;
app.foo();
interface Something {
public void foo();
Better yet, you can let MyApp extend an abstract class that defines foo(). Then MyApp can override the foo() method. If later on, the abstract class needs to add a bar() method then default implementation can be done in the abstract class. If you make it an interface then all implementing classes will have to be updated to implement the new method. -
Calling a function in the main movie from a loaded swf
I realize this is probably a very basic question, but I have
loaded a SWF file into another movie. I now want to call a function
in the main SWF. Is there a way to do that? Alternatively, I have a
custom class where I could put the function, but I haven't been
able to figure out how to call it from the loaded SWF either. Do I
somehow need to associate the class with the main movie,
or...?Never mind - I was doing something very stupid and wasn't
calling the function as a method of a movie clip. I was simply
calling checkTarget(event) rather than
event.currentTarget.checkTarget(event); which seems to work. -
Alternative function to WM_CONCAT
Hi,
I am using eBusiness Suite 11g containing an Oracle financials 10 database. The schema WMSYS is missing and I am unable to use WM_CONCAT function. Are there any other alternative functions or SQL that can help with cross-tabbing comma seperated values to avoid queries returning multiple lines.
For example:
JE_HEADER_ID SOURCE INVOICE_NUM DESC PO_NO AMOUNT
14055 Payables 38761 Paperchase 10145 461.55
14055 Payables 38761 Paperchase 10148 461.55
I would like the PO_NO to be concatenated on one line so that the query returns only one line as below:
JE_HEADER_ID SOURCE INVOICE_NUM DESC PO_NO AMOUNT
14055 Payables 38761 Paperchase 10145, 10148 461.55
Your feedback will be appreciated.
ThanksHi,
Thanks for your help, rtrim(xmlagg(xmlelement(e,ph.segment1,',').extract('//text()')),',') segment1 seems to work best in eBusiness suite with database version 10. The function LISTAGG works from 11g onwards and STRAGG requires a functions to be created and called within a SQL query.
All of the above were useful to know.
Thanks again -
Altering function will block calling this function when concurrency?
Hi
I would alter a function dynamically in a procedure,when altering function and calling this function occur at the same time,will it generate a blocking?
thanks in advanceYes. If the function is being called and its running then the ALTER STATEMENT to such function will be in suspended mode until the execution of the function completes.
However I cannot understand why would you want to modify a function in a stored procedure. You can always write a condition based function to perform different tasks on different conditions.
Let us know the complete requirement and may be we can suggest some other alternatives.
Please specify your SQL Server version while posting questions
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
thank you very much for your reply.
My requirement is like below:
In our existed system,there is one Employee table,now every user logining in system can see all employees in Employee table.
Now we want to control users see specific employees meeting some conditions which are configurable in system.
To minimize the effect on existed codes,we plan to rename Employee table to EmployeeTbl and create a called Employee view in which EmployeeTbl joins the generated function which contains the sql generated by configured conditions for different users.
I have finished the test,and it'ok,but I don't know whether it affects performance too much.
Why not have a table to determine access groups ie what rows a employee can have access to (like say only immediate reportees for supervisors etc) and then link it to your existing users (AD logins). Then its just a matter of dtermining what group the executing
user is part of and then using relationship set for group to determine whch all employees data he can view.
The concept will look like this
http://blogs.wrox.com/article/filtering-user-specific-report-data-in-sql-server-reporting-services/
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page -
I have to call javascript function at the time of iview is loading. I am not able use onload event which is not working in SAP Portal environment. Please suggest me any other alternative to call the function at the time of iview is loading. I have to set some properties when form is loading.
I will explain my scenario correctly
Let us take two pages
1. Main Page (A)
2. Child page (B)
I have displayed records in tableview and each having checkbox and two buttons "print" and "viewDetails" at down in page A. If I clicked "print" button the records which i have selected checkboxes details will be displayed in new window( page B). In page B i have given this following code
<script language="javascript">
window.opener.setTarget('Search');
</script>
setTarget() function is in page A.
function setTarget(opt) {
if(opt=='print')
opt="";
document.<%=strFormControl%>.target="_blank";
else
document.<%=strFormControl%>.target="_self";
This code is executing after the content of all records details displayed.
My condition is If i click print button new window is opened and details are displaying. And before displaying content in new page B (means after opened new window) if i click on "viewDetails" button that is also opening new window because <script> code is not executed not yet. but it should display in same window when i click "viewDetails" button. -
Hi
I have a problem in form6i.i wrote a c++ program calling forms bjects and changing properties .The code gets complied(let file name be some.cpp file).now how can i use this file .where should i use this file .please replay
from
Pradeepgang lee (guest) wrote:
: sir:
: For some reasons,I want to call the windows api functions
: from developer/2000 2.1,I want to know how to do that?
: thanks for your help!
There are two ways to invoke windows api functions: First, and I
believe the simplest of the two is the Forms package ORA_FFI,
which stands for Foreign Function Interface. This allows you to
load the dll and call any function in that dll as long as its
arguments uses standard data type (e.g. int, floats, chars), but
it does not support complex datatype such as structures and
pointers to structures.
Thoe other alternative is writing your own C function in a dll
and calling the windows api from the user exit. This is more
flexible as it can call functions that pass complex data types.
Either approach will require time and tinkering to get it to
work. A good knowledge of C would be helpful.
null -
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 -
/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
Maybe you are looking for
-
Adobe Creative Suite 5.5 Design Standard - Windows
I am trying to install the paid-for (not trial) Education Edition of the above software on my PC. My PC meets the system requirements of the software. The issue is that at 20% installation, while the Adobe Switchboard 2.0 component is being installed
-
How add a watermark to the smartform page
Hi All, Can anybody give me some pointers, how to add a watermark to the page . I have to display a water image, when the user trying to see print preview. I.e. on certain condition i need to print the water mark on the page . I have uploaded the BMP
-
The environment is aSharepoint2010 and ProjectServer2010we hadlast nighta crach ofapplication poolwithan error on thew3wpandkernelbase. We canrevivetheappbutthe firstaccess to the sitewe have thew3wpcrash. we did adumpand here are thedetails. Informa
-
Problem opening after crash - "compatible catalogs on your computer"?
I am using 2.3 and just had a few crashes. After the last crash, when I try to launch, I get the message, "Lightroom 2 has found compatible catalogs on your computer. Would you like to upgrade an existing catalog or open Lightroom with a new catalog?
-
Getting (error code -6584) when starting time machine
Hello, I have an early 2011 mbp running Lion. I tried this morning to start time machine and got the error described above. I have access to my time capsule but the program will not start. This is the first time I start time machine since installing