HOW TO CREATE A GLOBAL USER DEFINED FUNCTION
Hi Expert,
I'd like to know if there is a way to globalize a user defined function?
I'd like to reuse a user defined function (e. g. DeleteLeadingCharacter) in several scenario/SWC instead of recreated it from scratch everytime - Is it possible?
Thanks
NO you cannot not reuse one UDF not even in other namespace even in the same namespace in diff Mapping programme.
UDF is liminted to GraphicalMappingProgramme that you created you cannot reuse it in other MappingProgrammes.
Like your MM =A has function <b>getMyName</b>
you can use it in MM=A but if you want to use it in MM=B then u cannot.
So its not possible in XI or PI.
But it is possible in new release PI 7.1. That says you can write UDF and can reuse in any MM programme.
Thanks
Farooq.
*Rewards Points if you find it useful*
Similar Messages
-
How to use StreamTransformationException in user-defined function?
Hi,
I'm doing a DBLookup (using Java pgm in one of my Imported Java archives) for populating one of the fields in message mapping. If the DB connection fails, I want to terminate the mapping by throwing a StreamTransformationException from within a user-defined function.
I require urgent help in this regard.
Thanks in advance.
Regards,
Sridhar Rajan NHi,
I had the same problem. I failed to find the way how to throw a StreamTransformationException in my user-defined function. But I used another exception: NullPointerException. Yes, I know, this is not an elegant solution...
Best regards,
Andrzej Filusz -
How to call Microsoft SQL User defined function??
I am trying to call Miscrosoft SQL user defined function (not stored procedure) and experience problems. The function -- func_profile_history takes 3 inputs and returns resultSet.
Please let me know if there is any examples some where. All the examples I found are for stored procedure.
Thanks....
Siu
************ source *************
public Vector callSqlFunction(String eidTradcom, String idSku, String endDate, String idUserPost)
throws TradcomException, RemoteException
System.out.println("--------------in callSqlFunction--------------1");
Connection conn = null;
java.sql.CallableStatement cstmt = null;
ResultSet rs = null;
ForecastInfo info = null;
Vector v = new Vector();
try{
conn = TradcomUtils.getConnection();
String sql = "{call func_profile_history(?,?,?)}";
System.out.println("--------------in callSqlFunction--------sql="+sql);
cstmt = conn.prepareCall(sql);
System.out.println("--------------in callSqlFunction-------2");
cstmt.setString(1, eidTradcom);
cstmt.setString(2, idSku);
cstmt.setString(3, endDate);
System.out.println("--------------in callSqlFunction-------3");
rs = cstmt.executeQuery();
System.out.println("--------------in callSqlFunction-------4");
while (rs.next()){
info = new ForecastInfo ();
info.setEidTradcom(rs.getString("eid_tradcom"));
info.setIdSku(rs.getString("id_sku"));
info.setQtOnHand(rs.getDouble("qt_on_hand"));
info.setQtOnHold(rs.getDouble("qt_hold"));
info.setQtNetOnHand(rs.getDouble("qt_net_on_hand"));
info.setQtAlloc(rs.getDouble("qt_alloc"));
info.setQtAvailUnalloc(rs.getDouble("qt_avail_unalloc"));
info.setQtPoShip(rs.getDouble("qt_po_ship"));
info.setQtPoRcvd(rs.getDouble("qt_po_rcvd"));
info.setQtTransit(rs.getDouble("qt_transit"));
info.setQtAsn(rs.getDouble("qt_asn"));
info.setQtPo(rs.getDouble("qt_po"));
info.setQtPoBalance(rs.getDouble("qt_po_balance"));
info.setQtSoShip(rs.getDouble("qt_so_ship"));
info.setQt4Cast(rs.getDouble("qt_4cast"));
v.addElement(info);
System.out.println("--------------in callSqlFunction-------5");
System.out.println("--------------in callSqlFunction-------v="+v);
return v;
}catch(Exception ex){
System.out.println("Error in callSqlFunction:"+ ex.getMessage());
throw CachingManager.getTradcomException(ex, "Error in callSqlFunction");
}finally{
try{ if (cstmt != null) cstmt.close(); } catch(Exception ex){}
try{ if (conn != null) conn.close(); } catch(Exception ex){}
********************* error output ***************
********************* bef calling callSqlFunction
--------------in callSqlFunction--------------1
--------------in callSqlFunction--------sql={call func_profile_history(?,?,?)}
--------------in callSqlFunction-------2
--------------in callSqlFunction-------3
Error in callSqlFunction:The request for procedure 'func_profile_history' failed
because 'func_profile_history' is a function object. Severity 18, State 1, Proc
edure 'LAP_DUAL null', Line 4
ERROR=Error in callSqlFunction...The request for procedure 'func_profile_history
' failed because 'func_profile_history' is a function object. Severity 18, State
1, Procedure 'LAP_DUAL null', Line 4well, I tried the preparedStatemnet and it worked. Case closed.
-
Creating Index on user defined function
Does anyone know if you can create an index on a user defined, or system defined function like LOWER or UPPER in Oracle 8i?
According to Steve Yam's previous post:
DO you turn on the QUERY_REWRITE_ENABLED within session or instance? You need to
have this to utilize function based index in query.
Besides, Oracle may still use FULL TABLE SCAN if your table size is not big enough for
using index search. Determine number of blocks occupied by the table and determine
whether you really gain from the index.
Steve
" -
How to Create CFL to user defined table
Hi all,
I have a user table with four fields. How to create a CFL for these fields?
Regards,
Fabio Ferreira.this is sub fn required for registration
Here i mentioned heder level table and child table
Fields are mentioned will be displayed on CFL
If u want assign this CFL to any text field assign normal way but object id is:VEDA_PRN_WR_DOC
Public Function UDOExists(ByVal code As String) As Boolean
GC.Collect()
Dim v_UDOMD As SAPbobsCOM.UserObjectsMD
Dim v_ReturnCode As Boolean
v_UDOMD = objMain.objUtilities.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserObjectsMD)
v_ReturnCode = v_UDOMD.GetByKey(code)
System.Runtime.InteropServices.Marshal.ReleaseComObject(v_UDOMD)
v_UDOMD = Nothing
Return v_ReturnCode
End Function
'Second fn
Function registerUDO(ByVal UDOCode As String, ByVal UDOName As String, ByVal UDOType As SAPbobsCOM.BoUDOObjType, ByVal findAliasNDescription As String(,), ByVal parentTableName As String, Optional ByVal childTable1 As String = "", Optional ByVal childTable2 As String = "", Optional ByVal childTable3 As String = "", Optional ByVal LogOption As SAPbobsCOM.BoYesNoEnum = SAPbobsCOM.BoYesNoEnum.tNO) As Boolean
Dim actionSuccess As Boolean = False
Try
registerUDO = False
Dim v_udoMD As SAPbobsCOM.UserObjectsMD
v_udoMD = objMain.objUtilities.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserObjectsMD)
v_udoMD.CanCancel = SAPbobsCOM.BoYesNoEnum.tNO
v_udoMD.CanClose = SAPbobsCOM.BoYesNoEnum.tNO
v_udoMD.CanCreateDefaultForm = SAPbobsCOM.BoYesNoEnum.tNO
v_udoMD.CanDelete = SAPbobsCOM.BoYesNoEnum.tYES
v_udoMD.CanFind = SAPbobsCOM.BoYesNoEnum.tYES
v_udoMD.CanLog = LogOption
v_udoMD.CanYearTransfer = SAPbobsCOM.BoYesNoEnum.tYES
v_udoMD.ManageSeries = SAPbobsCOM.BoYesNoEnum.tYES
v_udoMD.Code = UDOCode
v_udoMD.Name = UDOName
v_udoMD.TableName = parentTableName
If LogOption = SAPbobsCOM.BoYesNoEnum.tYES Then
v_udoMD.LogTableName = "A" & parentTableName
End If
v_udoMD.ObjectType = UDOType
For i As Int16 = 0 To findAliasNDescription.GetLength(0) - 1
If i > 0 Then v_udoMD.FindColumns.Add()
v_udoMD.FindColumns.ColumnAlias = findAliasNDescription(i, 0)
v_udoMD.FindColumns.ColumnDescription = findAliasNDescription(i, 1)
Next
If childTable1 <> "" Then
v_udoMD.ChildTables.TableName = childTable1
v_udoMD.ChildTables.Add()
End If
If childTable2 <> "" Then
v_udoMD.ChildTables.TableName = childTable2
v_udoMD.ChildTables.Add()
End If
If childTable3 <> "" Then
v_udoMD.ChildTables.TableName = childTable3
v_udoMD.ChildTables.Add()
End If
If v_udoMD.Add() = 0 Then
registerUDO = True
objMain.objApplication.StatusBar.SetText("Successfully Registered UDO >" & UDOCode & ">" & UDOName & " >" & objMain.objCompany.GetLastErrorDescription, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Success)
Else
objMain.objApplication.StatusBar.SetText("Failed to Register UDO >" & UDOCode & ">" & UDOName & " >" & objMain.objCompany.GetLastErrorDescription, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
registerUDO = False
End If
System.Runtime.InteropServices.Marshal.ReleaseComObject(v_udoMD)
v_udoMD = Nothing
GC.Collect()
Catch ex As Exception
End Try
End Function
This is a code for registration of table that will create CFL with mentioned fields.
Hope help this
By
firos.C
Edited by: firoz101 on Aug 18, 2009 6:07 AM
Edited by: firoz101 on Aug 18, 2009 6:08 AM
Edited by: firoz101 on Aug 18, 2009 6:08 AM -
How to create instance of user defined suite
I have create one user defined suite interface (ISuite) and inherite it to IsuiteASB and IsuiteCSB . The purpose of creating user defined suite is to provide hyphenation for selected text. I want to add a method which will detect whether a text has been selected by user or not , if selected then I am calling one hyphator function. I am not able to create an instance of user defined suite . I am using following syntax: <br />in UpdateActionState I am using <br /> InterfacePtr<ISuite>suite(ac->GetContextSelection(),UseDefaultIID()); <br /><br />in one user defined method I am using <br /> InterfacePtr<ISuite>suite(Utils<ISelectionUtils>()->GetActiveSelection() , UseDefaultIID()); <br /><br />Both calls unsuccessfull. <br /><br />Which Interface I should use to detect whether Text has been selected by user or ITextUtils or any other. <br />Please tell me the preoper way to create interface suite and create instance of it. <br />Thank you.
I've seen this wording before ... Wait -- you must be referring to the SDK. Better post your question in the SDK forum, we're just helpless end-users, and in this case, clueless as well.
-
How to create custom(or) user defined component in SAPTAO
Hi,
Please provide me some document or steps on how to create custom component in sap tao.
Thanks a lot in advance.
Regards,
SudhaHi,
If you want create any custom components, you should use SAP QTP to create it.
Here are the simple steps:
i) Go to QTP -> Click on New - > Select Scripted Component - > ((Select SAP_Doc) area (i.e. whatever application area you have created for SAP TAO installation)) -> Record or Write a script based on your requirement & save
ii) Go to QC -> BPT -> open above component and insert the parameters and call these values in QTP script level (either way you can do)
iii) Create a datasheet and declare the parameters in datasheet and call this sheet whenever you have required.
Good luck.
Ram -
How do I modify a user-defined function in SQL Plus
I have created some functions in my database. Can anybody tell me how to modify/edit those functions?
PS C:\> $Class2 = New-Object MyTest.Class1
PS C:\> $Class2
MyString Struct1Property Struct2Property
MyTest.Struct1 MyTest.Class1+Struct2
PS C:\> $Struct2 = New-Object MyTest.Class1+Struct2
PS C:\> $Struct2.Property = "X"
PS C:\> $Struct2
Property
X
PS C:\> $Class2.Struct2Property = $Struct2
PS C:\> $Class2.Struct2Property.Property
XPS C:\> $Struct2.GetType()
IsPublic IsSerial Name BaseType
False False Struct2 System.ValueType
Struct2 is a valuetype, (by value)
The classes are by reference
PS C:\> $Struct3 = $Class2.Struct2Property
PS C:\> $Struct3
Property
X
PS C:\> $Struct3.Property = "Y"
PS C:\> $Class2.Struct2Property.Property
X
PS C:\> $Class2.MyString = "A"
PS C:\> $Class3 = $Class2
PS C:\> $Class3.MyString = "B"
PS C:\> $Class2.MyString
B -
User - defined functions for calculating the taxes of state and country
hi expects,
how can write user-defined function in message mapping in which i want to calculate the states taxes (2500) and country taxes (5000) and give the result as grand total in output.please help me?Hi,
Activities
1. To create a new user-defined function, in the data-flow editor, choose Create New Function (This
graphic is explained in the accompanying text), which is located on the lower left-hand side of the
screen. In the menu, choose Simple Function or Advanced Function.
2. In the window that appears, specify the attributes of the new function:
Name
Technical name of the function. The name is displayed in the function chooser and on the data-flow
object.
Description
Description of how the function is used.
Cache
Function type (see above)
Argument Count
In this table, you specify the number of input values the function can process, and name them. All
functions are of type String.
3. In the window that appears, you can create Java source code:
a. You can import Java packages to your methods from the Imports input field, by specifying them
separated by a comma or semi-colon:
You do not need to import the packages java.lang., java.util., java.io., and java.lang.reflect. since
all message mappings require these packages and therefore import them. You should be able to
access standard JDK and J2EE packages of the SAP Web Application Server by simply specifying the
package under Import. In other words, you do not have to import it as an archive into the Integration
Repository. You can also access classes of the SAP XML Toolkit, the SAP Java Connector, and the
SAP Logging Service (see also: Runtime Environment (Java-Mappings)).
In addition to the standard packages, you can also specify Java packages that you have imported as
archives and that are located in the same, or in an underlying software component version as the
message mapping.
b. Create your Java source text in the editor window or copy source text from another editor.
4. Confirm with Save and Close.
5. User-defined functions are limited to the message mapping in which you created the function. To
save the new function, save the message mapping.
6. To test the function, use the test environment.
The new function is now visible in the User-Defined function category. When you select this category,
a corresponding button is displayed in the function chooser pushbutton bar. To edit, delete, or add the
function to the data-flow editor, choose the arrow next to the button and select from the list box
displayed.
Regards
Seshagiri -
User Defined function in "Decision between multiple alternatives"
Hello,
I am looking to create my own User Defined function in the formula builder of the process type - "Decision between multiple alternatives" in a process chain.
Could anyone advise please how this can be done?
Many Thanks,
AbhijitHi Abhijit,
Where you want create you own user definefunction in Intergation planning or some where else.
Please specify your requirement.
Thanks and Regards,
Venkat. -
Need help with user defined function
Hello SDN,
I need some help with a user-defined function. My source message contains multiple
generic records (1000 char string), and my target message is 1 header record,
then multiple generic records. See description of source and target messages below:
Source:
GenericRecordTable 1..unbounded
Row (1000 char string)
Target:
Field1 (char5)
Field2 (char5)
Field3 (char5)
IT_Data
GenericRecordTable 1..unbounded
Row (1000 char string)
Basically, what I need to do in my user defined funtion is to map the first record
in my source record to the 3 header fields, then map all of the rest of the records
(starting from line 2) into the GenericRecordTable.
Can someone please help me with the code for the user defined function(s) for this
mapping?
Thank you.hi,
Activities
1. To create a new user-defined function, in the data-flow editor, choose Create New Function (This
graphic is explained in the accompanying text), which is located on the lower left-hand side of the
screen. In the menu, choose Simple Function or Advanced Function.
2. In the window that appears, specify the attributes of the new function:
Name
Technical name of the function. The name is displayed in the function chooser and on the data-flow
object.
Description
Description of how the function is used.
Cache
Function type (see above)
Argument Count
In this table, you specify the number of input values the function can process, and name them. All
functions are of type String.
3. In the window that appears, you can create Java source code:
a. You can import Java packages to your methods from the Imports input field, by specifying them
separated by a comma or semi-colon:
You do not need to import the packages java.lang., java.util., java.io., and java.lang.reflect. since
all message mappings require these packages and therefore import them. You should be able to
access standard JDK and J2EE packages of the SAP Web Application Server by simply specifying the
package under Import. In other words, you do not have to import it as an archive into the Integration
Repository. You can also access classes of the SAP XML Toolkit, the SAP Java Connector, and the
SAP Logging Service (see also: Runtime Environment (Java-Mappings)).
In addition to the standard packages, you can also specify Java packages that you have imported as
archives and that are located in the same, or in an underlying software component version as the
message mapping.
b. Create your Java source text in the editor window or copy source text from another editor.
4. Confirm with Save and Close.
5. User-defined functions are limited to the message mapping in which you created the function. To
save the new function, save the message mapping.
6. To test the function, use the test environment.
The new function is now visible in the User-Defined function category. When you select this category,
a corresponding button is displayed in the function chooser pushbutton bar. To edit, delete, or add the
function to the data-flow editor, choose the arrow next to the button and select from the list box
displayed.
http://help.sap.com/saphelp_nw04/helpdata/en/d9/718e40496f6f1de10000000a1550b0/content.htm
http://java.sun.com/j2se/1.5.0/docs/api/
/people/krishna.moorthyp/blog/2006/07/29/documentation-html-editor-in-xi
/people/sap.user72/blog/2006/02/06/xi-mapping-tool-exports
http://help.sap.com/saphelp_nw04/helpdata/en/43/c4cdfc334824478090739c04c4a249/content.htm
UDF -
http://help.sap.com/saphelp_nw04/helpdata/en/22/e127f28b572243b4324879c6bf05a0/content.htm
Regards -
User-Defined Function and Context Manipulation
Hi Mapping Gurus, I need your help.
I have a user-defined function and one of my input parameter (c) is in a loop (EDI segment). So one, if I execute my function I get:
Exception:[java.lang.ArrayIndexOutOfBoundsException: 0]
If I change the context or use the remove context node function its working but its always taking the first row in consideration since I'm using c[0] . Here is the logic:
String WHERE_CLAUSE = "A"" = ""'"b[0]"'"" and B = ""'"c[0]"'";
So since c is an array [], I have tried different logic to get to the right row.
1- I tried using another parameter (e) to pass a counter or an index to my function. So each time it's looping, it's passing a new value to the function but Im still getting the first row and Im not to sure why?
int G = Integer.parseInt(e[0]); // e[] = My counter field
String WHERE_CLAUSE = "A"" = ""'"b[0]"'"" and B = ""'"c[G]"'";
2- I tried using a parameter stored in the container:
String Num;
Num = (String)getParameter(counter);
if (Num == null) G = 0;
else
G = Integer.parseInt(Num);
G = G + 1;
String WHERE_CLAUSE = "A"" = ""'"b[0]"'"" and B = ""'"c[G]"'";
Num = "" + G;
setParameter(e[0], Num);
and Im still getting the first one, look like its using a different container each time its looping so the Value is always the same?
4- I created a new user-defined function with the container logic, then its working but Im back to the same problem in my main function, its only looking at e[0] for my counter all the time.
5- I tried using the Seeburger Java Variables and guess what in the main fonction, as new UDF,... and guess what, same result!
So anybody out there that was able to get UDF's working into a multiple context scenario?
Am I missing something?
I will reward points and beer for any help!This is one of the text with passing a counter to the function to try to go to the right row in the array since I'm doing a remove context and I'm getting all the d_234's:
public void ReadTable(String[] a,String[] b,String[] c,String[] d,String[] e,ResultList result,Container container){
int G = Integer.parseInt(e[0]); // My counter
String var;
String DBTABLE = a[0];
String lookUpField = d[0];
String WHERE_CLAUSE = "A"" = ""'"b[0]"'"" and B = ""'"c[G]"'";
Now this one was with the internal container logic:
int G;
String DBTABLE = a[0];
String lookUpField = d[0];
String Num;
Num = (String)getParameter(e[0]);
if (Num == null) G = 0;
else
G = Integer.parseInt(Num);
G = G + 1;
Num = "" + G;
setParameter(e[0], Num);
String WHERE_CLAUSE = "A"" = ""'"b[0]"'"" and B = ""'"c[G]"'";
And now with the Seeburger Variables:
int G;
try {
VariableBean be=VariableFactory.getVariableInstance("");
G = Integer.parseInt(String.valueOf(be.getStringVariable("yves")));
} catch (Exception f) {
throw new RuntimeException(f);
String DBTABLE = a[0];
String lookUpField = d[0];
String WHERE_CLAUSE = "A"" = ""'"b[0]"'"" and B = ""'"c[G]"'";
try {
G = G + 1;
Num = "" + G;
VariableBean be=VariableFactory.getVariableInstance("");
be.setStringVariable("yves",Num);
catch (Exception f) {
throw new RuntimeException(f);
All 3 logics were returning always the first row or a counter of 1 if the logic is in the main ReadTable function. -
Calling user defined functions through OBIEE
Can anyone tell me how I can call the user defined functions on database through the new BI tool.
The idea is to collect certain parameters through the prompt when launching the request, the function is supposed to pick up the parameters, make a certain calculation, and return a value.
I wrote the function, I just need help over how to call the function through the BI tool - that was pretty easy in the old Discoverer.
Thanks.
Message was edited by:
user611377Hi Kresimir ,
You can use EVALUATE function to call a user defined function.
EVALUATE('FUNCTIONNAME(%1,..)' As DATATYPE,parameter1,...)
Here DATATYPE is the returntype of function.
Hope this will help.
Thanks
Ashok -
Using Xquery predefined functions in User defined functions
Hi All,
I have a requirement of calling a user defined function in osb xquery file.In that function i have to use osb predefined string functions but they are not working it shows error message in xquery file.Can you please suggest how to use them in user defined functions.
Thanks,
Srinivas.Hi Eric,
I have a Proxy service it reads mfl data and transform to some other schema.In this Transformation one element data is taken and we have to manipulate that data
based on the incoming value and return .For this process i took one function and i have to check weather it contains some symbols like ^,~ so i used contains function of
String with and with out prefix with if else condition it gives error "Unexpected token if"
declare function insp:buildReferenceRange($inRange as xs:string)
as xs:string
let $low:=""
l
if(contains($inRange,"^")) //"Unexpected token if"
name space and prefix are defined in the top of file.
Thanks,
Srinivas. -
How to create user defined functions in xi.
how to create user defined functions in xi.
can anyone give info with screen shots.Hi,
Please follow the steps mentioned in below link
http://help.sap.com/saphelp_nw04/helpdata/en/f8/2857cbc374da48993c8eb7d3c8c87a/frameset.htm
also refer below links to know more about UDF
udf
Thanks
Swarup
Edited by: Swarup Sawant on Mar 3, 2008 3:59 PM
Maybe you are looking for
-
Hi, While i create a report with grid display with oops ALV using custom container, its giving short dump.. DUMP: CNTL ERROR ouccured..
-
Va02 date of releasing billing block new calculate of billing schedule
I create sales document type with billing block Date of creating the sales document is also the date of calculating billing schedule But after a will by releasing the block reason of the document (transaction VA02) billing schedule is not changing I
-
I obtained the NSS 322 unit today and attempted to update from the 1.0.0.0 firmware to the newer 1.3.0.5 After waiting for about an hour for it to restart, I connected a monitor to the VGA output to discover that it won't boot due to missing files. H
-
Help dynamic view ???
Hi, How can I create a view with Vairables like ex: CREATE or replace VIEW MYvew AS SELECT * FROM xyz where val=VARIABLEsthanks in advance sh Edited by: user10736825 on Feb 10, 2010 11:14 AM
-
Rgb sliders where are they?
Hello forum I am trying to calibrate my emac with a Spyder monitor calibrator the set up takes me to a point where it says " move RGB sliders" I know what they are BUT where are they?. I have looked in vain in System preferences but can not find them