on 01-08-2009 5:07 PM
hi
i have to remove the leading 'S' in the target field, can some on help me with this reqmnt.
regards
manoj
Why not use UDF to remove the leading S:
String input = 'SSSSSSSSSS test';
String result = input;
int len = input.length();
for (int i=0; i<len; i++)
if (input.charAt(i) == 'S')
result = input.substring(i+1);
else break;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Manoj,
Check out : http://help.sap.com/saphelp_nw04/helpdata/en/d9/3033f96c79674f90e3ab8d101a595b/frameset.htm
Activities
1. To create a new user-defined function, choose Create New Function (This graphic is explained in the accompanying text) in the data-flow editor at the bottom of the screen, on the left-hand side.
2. Specify the attributes of the new function in the subsequent window:
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).
Arguments:
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 subsequent window, 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.
Thanks,
Pooja
Hi Manoj,
On the bottom leftside corner of MM, you will find a button for "Create New Function"
Click on that , which will pop-up a new screen.
In the new screen , provide the function name
IN you case, keep the cache as : "Value" only ( default one)
Change the default argument "a" to "input".* Click on "Create Function"
Copy and paste the code given by Jayson in here. ( remove top one line and add a line for the function return )
String result = input;
int len = input.length();
for (int i=0; i<len; i++)
if (input.charAt(i) == 'S')
result = input.substring(i+1);
else break;
return result;
*_Save and close_ your function screen
===============================
Your UDF is ready.
Use it as :
Input field -> UDF--> target field
Thanks,
Pooja Pandey
User | Count |
---|---|
78 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.