JAVA Functions in XI
1. Split Function
String [ ] StrArray = LGORT.split(",") //-- pass LGORT to this UDF
int len1 = LGORT.length;
for ( i=0;i<len1;i++){
result.addValue(StrArray[i]); }
2. Global Containers
2.1 To
store values in global variable
container.getGlobalContainer
().setParameter ("str", FIELDNAME);
2.2 To get the value already
stored in global variable.
String myStr = (String)
container.getGlobalContainer().getParameter ("str");
3.
RemoveLeadingZeros
int value = Integer.parseInt(str);
String str1 = Integer.toString(value) ;
return str1;
You can also use this code.
Here a is input
string.
//write your code here
String b =
a.replaceFirst("^0+", "");
return b;
4.
Unique Value
String strLocal =
(String)
container.getGlobalContainer().getParameter ("strGlobal");
container.getGlobalContainer ().setParameter ("strGlobal", str);
if (!str.equals(strLocal))
return "1";
else
return "0";
5. Credit/Debit using Substring
int i = str.length();
String str1 =
str.substring(i-1,i);
if (str1.equals("-"))
return
"D";
else
return "K";
6. Capturing
Input File name in output file
DynamicConfiguration conf =
(DynamicConfiguration)
container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key =
DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File" , "FileName");
String Outputfile = conf.get(key,a); //ENABLE ASMA in Receiver
File Channel
return Outputfile;
7. Remove Comma from
string
Here 'a' is a input string.
//write your
code here
String b = "";
b = a.replaceAll(",", "");
return b;
8. Find Index of a word or sentence inside one
sentence and get sub string starting from that index
Fixed string to
find in sentence coming from input "a". Result will contain that index no as
start point of index in other sentence.
//write your code here
String fixed = "ORDER OF"; //Fixed string to find in sentence coming from
input "a". Result will contain that index no as start point of index in other
sentence.
String res = "";
int index = 0;
index = a.indexOf(fixed);
res = b.substring(index+9,index+12);
return res;
9. Add New line
in End of Each xml tag
xmlstring is input to this program.
//write your code here
String res = "";
int flag = 0;
for(int i =
0;i<xmlString.length();i++)
{ if(xmlString.charAt =='<')
Unknown macro: { flag = 1; res = res + xmlString.charAt (i); }
else
{ if(xmlString.charAt =='>')
Unknown macro:
{ flag = 0; res = res +xmlString.charAt (i) + "n"; }
else
Unknown macro: { res = res +xmlString.charAt (i); }
}
}
return res;
10. Displaying XMLString in single line into
approriate XML format
xmlString =
xmlString.replaceALL("><","">\n<");
11. Check if Integer
try
{
int i=Integer.parseInt(input,10);
return "Integer";
}catch (NumberFormatException exception)
{
return "String";
}
12. Remove duplicates from list
//write your code here
HashSet h = new HashSet();
for (int i=0; i<a.length; i++)
{
if (! h.contains(a[i]))
Unknown macro: { h.add(a[i]);
result.addValue(a[i]); }
}
http://wiki.sdn.sap.com/wiki/display/XI/JAVA+Functions+in+XI
分享到:
相关推荐
Java 读取 PI 数据库测点值需要使用 PI API 和 JNative,了解 PI 数据库的存储结构,掌握 time functions、archive functions 和 snapshot functions,以及在 Java 中使用 PI API和 JNative 的注意事项。
11.3 Custom Enterprise Java Bean Functions 11.3.1 Create EJB and EAR Development Components 11.3.2 Create the Enterprise Java Bean 11.3.3 Build and Deploy 11.3.4 Create a New Enterprise Java Bean ...
在Oracle数据库中,Java函数、存储过程和触发器允许开发者利用Java的强大功能来处理数据库操作。这种方式结合了SQL的高效数据处理与Java的面向对象编程能力,为开发复杂的企业级应用提供了灵活性。以下是对这些概念...
本示例“PoMappingDemo”是关于如何在SAP PO中进行消息映射(Message Mapping)的一个具体实践,同时包含了Java编程元素。以下是基于这个主题的详细知识点解释: 1. **SAP PO**: SAP PO是SAP NetWeaver Process ...
1.2 Matrix-Monotone Functions 3 1.3 Classification and Organization 4 1.4 Notation 7 2 Majorization Theory 9 2.1 Definition and Examples 10 2.2 Basic Results 18 2.3 Majorization and Optimization 30 3 ...
### Dyadic Green Functions in Electromagnetic Theory #### 引言 在电磁理论的研究与应用领域,绿函数(Green's function)作为一种重要的数学工具被广泛应用于求解偏微分方程问题,尤其是在散射、衍射及波导等...
### 更多功能重用性在C/C++/Objective-C中的应用:Curried Functions #### 引言 本文讨论了如何在C、C++以及Objective-C语言中实现更多功能性的重用,特别是通过使用Curried Functions机制来提升代码的复用性和...
Java in easy steps, 6th edition instructs you how to easily create your own exciting Java programs. Updated for Java 9, which was released September 2017, it contains separate chapters on the major ...
在给定的文档标题“web dynpro demo\Accessing ABAP Functions in Web Dynpro Java.pdf”及描述中,我们了解到这是一份关于如何在Web Dynpro Java应用中调用ABAP函数的教程。Web Dynpro for Java是SAP提供的一种用于...
Expert T-SQL Window Functions in SQL Server takes you from any level of knowledge of windowing functions and turns you into an expert who can use these powerful functions to solve many T-SQL queries....
本资源主要针对初学者,旨在深入浅出地介绍如何利用Java进行Azure Functions的开发。 在Java开发者的世界里,Azure Functions提供了一种全新的方式来构建和部署应用,它以事件驱动的模型运行,只在代码实际执行时...
functions/Array/forEach.js -- every functions/Array/every.js -- some functions/Array/some.js -- filter functions/Array/filter.js -- find functions/Array/find.js -- reduce functions/Array/reduce.js -- ...
Thinking in C: Foundations for Java & C++ by Chuck Allison produced by Bruce Eckel Chapter 1: Introduction and Getting Started40 MinutesStart Lecture Chapter 2: Fundamental Data Types41 ...
class CClientSocket : public CSocket { // Attributes public: // Operations ... // NOTE - the ClassWizard will add and remove member functions here. //}}AFX_MSG // Implementation protected: };
This library allows you to replace functions in other DLLs with functions from your own DLL使用自己的dll替代别的dll函数的库
在本文中,我们将深入探讨如何使用Visual Studio 2017来创建和管理Azure Functions,这是一个基于事件驱动的计算服务,允许开发者构建无服务器应用程序。Azure Functions让你可以在需要时运行代码,而无需预置或管理...
Generalized Functions in Mathmatics Physics. good book