How to migrate User Define Function to another mapping in other namespace
Hi Everybody
I have define many User Define Functions in mapping
How can i use them in other mapping
Thank you in advance
Hi,
I tried to explain the steps.
1. Take the JAVA code of your User-Defined Functions
2. Go to a JAVA editor (e.g NWDS, Eclipse, etc...)
2.1. create a Java project
2.2. create a Java class
2.3. inside your Java class, put each JAVA code of your User-Defined Function inside a Method
2.4. Export your Java class to a JAR file (e.g my_tools.jar)
3. Go to IR
3.1 create an Imported Archive (IA) and upload your JAR file.
3.2 in this IA, you see your Java class which contains all your methods.
4. inside your mapping,
4.1 create a User-Defined Function <u>and import</u> your class
4.2 use your method.
So, you define in only one place your code (thanks to a IA) and you will be able to use it inside several mappings.
I hope I don't forget steps...
Advantage: if tomorrow, you want to create a new function, just add a new method to your Java class and re-import your JAR file
Oh, I missed: your IA must be created inside a specific Software Component (SC__TOOLS) and this one must be linked with the others by a "Usage dependency", else your IA will be recognise only in one Software Component (and maybe only in one namespace)
Mickael
Similar Messages
-
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 -
How to Developed user defined functions to call function modules in SAP R/3
how to Develope user defined functions to call function modules in SAP R/3 system
Hello Raja,
Go through this V.imp Link...
http://download.oracle.com/docs/cd/B10464_05/integrate.904/b10408/rfc.htm
Steps to crate FM..
Follow these steps..
Go to the T: code SE37
First You Create Function Group
On That u specify
Function Group Name..............
Short Text..............................
save...
Go to SE 37
Specify the Function Module Name: Eg: Z_Bapi_Materialmaster
Short Text.......
Save...
Next Go to Attributes..
Select Radio button : Remote enabled model
Go to Parameters..
Click Import...
Give Parameter Type Associate type S.t
next Click Export...
Give Parameter Type Associate type S.t
Next Click Tables Button..
Specify tables..
Next click source code button..
Write Source code here..
Eg : Select statements Etc..
Finally we should be select the Radio button Enable remorely
https://www.sdn.sap.com/irj/sdn/wiki?path=/pages/viewpage.action?pageId=39728
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/abap/bapi%2bstep%2bby%2bstep
Re: User Defined Functions Tutorials
Hope this information is useful to you..
Thanks ,
Satya Kumar.. -
How 2 Develope user defined functions to call function modules in R/3 syst
How to Develope user defined functions to call function modules in SAP R/3 system....in xi
HIi,
If those function modules are RFC enabled then we can call those function module from user defined functions. Please see below link
/people/alessandro.guarneri/blog/2006/03/27/sap-xi-lookup-api-the-killer
Reward points if helpful.
Thanks,
Vijay Kumar T, -
How to add user defined functions in Menu bar of a Selection Screen?
Hi,
Can anybody please suggest me that how can I add user defined functions in the menu bar of a Selection Screen?
Regards
s@kDear Amit,
I am referring to the standard SAP program: RIEQUI20.
On the initial screen, there are 3 tabs.
Code:
SELECTION-SCREEN BEGIN OF TABBED BLOCK tab FOR 25 LINES.
SELECTION-SCREEN TAB (20) tab1 USER-COMMAND ucomm1
DEFAULT SCREEN 001.
SELECTION-SCREEN TAB (20) tab2 USER-COMMAND ucomm2
DEFAULT SCREEN 002.
SELECTION-SCREEN TAB (20) tab3 USER-COMMAND ucomm2
DEFAULT SCREEN 003.
SELECTION-SCREEN END OF BLOCK tab.
AT SELECTION-SCREEN.
CLEAR gv_okcode.
gv_okcode = sy-ucomm.
CLEAR sy-ucomm.
CASE gv_okcode.
WHEN 'IH08'.
CALL TRANSACTION 'IH08'. "Equipment Selection
WHEN 'IW29'.
CALL TRANSACTION 'IW29'. "Notification Selection
WHEN 'IW39'.
CALL TRANSACTION 'IW39'. "Order List Selection
WHEN OTHERS.
ENDCASE.
* Check date:
IF NOT datuv IS INITIAL
AND NOT datub IS INITIAL.
IF datub >= datuv.
ELSE.
MESSAGE e884(ih) WITH datuv datub.
ENDIF.
ENDIF.
IF variant IS INITIAL AND
dy_vari IS INITIAL.
PERFORM get_default_variant_f14 USING variant.
ENDIF.
PERFORM variant_existence_f14 USING variant.
IF datuv IS INITIAL.
datuv = sy-datum.
ENDIF.
IF datub IS INITIAL.
datub = sy-datum.
ENDIF.
IF sy-ucomm = 'ADDR'.
PERFORM adress_sel_f01 USING 'EQUIR'.
ENDIF.
PERFORM check_parnr_f76.
* AT SELECTION SCREEN OUTPUT
AT SELECTION-SCREEN OUTPUT.
STATICS: l_slset TYPE sy-slset.
*--- Set initial variant
PERFORM variant_init_f14 USING 'INST' 'INST' 'INST' 'RIEQUI20'.
IF variant IS INITIAL AND
dy_vari IS INITIAL AND
gv_variant_flag IS INITIAL.
PERFORM get_default_variant_f14 USING variant.
gv_variant_flag = 'X'.
ENDIF.
*--- Set Icon for adress-button
PERFORM set_icon_f01 USING dy_adrfl ad_icon text-ad0 text-ad1.
*--- get classification data from select option
*--- (if new variant or if called via submit or F3)
IF ( l_slset NE sy-slset ) OR
( s_comw[] IS NOT INITIAL AND gt_clsd_comw[] IS INITIAL ).
l_slset = sy-slset.
gv_class_old = dy_class.
gv_klart_old = dy_klart.
PERFORM copy_selopt_comw_f79 TABLES gt_clsd_comw s_comw.
PERFORM class_search_init_f77 USING 'EQUI'.
ENDIF.
*--- set Icon for classification
LOOP AT gt_clsd_comw TRANSPORTING NO FIELDS
WHERE atcod > '0'.
EXIT.
ENDLOOP.
IF sy-subrc IS INITIAL.
gv_comw_flag = 'X'.
ELSE.
CLEAR gv_comw_flag.
ENDIF.
PERFORM set_icon_f01 USING gv_comw_flag cl_icon text-cl0 text-cl1.
CALL METHOD cl_uid_cust=>selection_screen_output.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR variant.
PERFORM variant_inputhelp_f14 USING variant 'RIEQUI20'.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR dy_parnr.
PERFORM f4_for_parnr_f76.
AT SELECTION-SCREEN ON BLOCK clse.
IF dy_class NE gv_class_old
OR dy_klart NE gv_klart_old.
gv_class_old = dy_class.
gv_klart_old = dy_klart.
CLEAR gv_comw_flag.
REFRESH gt_clsd_comw.
REFRESH s_comw.
ENDIF.
PERFORM class_exist_f77 USING dy_klart dy_class 'DY_CLASS'.
IF sy-ucomm = 'COMW'.
CALL FUNCTION 'IHCLSD_VALUATION_POPUP'
EXPORTING
i_klart = dy_klart
i_class = dy_class
i_language = sy-langu
i_key_date = sy-datum
i_also_subclasses = dy_subcl
TABLES
ct_comw = gt_clsd_comw
EXCEPTIONS
exc_no_class = 1
exc_klart_not_allowed = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*--- fill classification data in select option
PERFORM copy_comw_selopt_f79 TABLES gt_clsd_comw s_comw.
ENDIF.
IF sy-ucomm = 'ONLI'.
sscrfields-ucomm = sy-ucomm.
ENDIF.
Regards
s@k
Edited by: siemens.a.k on Jan 15, 2010 10:10 AM -
How to call User defined functions in Mathscript Node ?
Hi,
I have created a user defined function and saved it to Search path of Labview as an M file. If I run my program in Math script window, the function is recognized and the program works properly. If I do the same with MathScript node , the user defined functions are not identified.
Kindly help me with this problem. Thanks in advance
Cheers
Lenord MelvixThis page may help:
http://zone.ni.com/reference/en-XX/help/373123C-01/lvtextmathmain/caveats_recommendations_ms_search_...
Kevin C. -
How to call User Define Function
Hi,
I need a help....
In my Project I have Login.jspx page in which there is a textbox Username.
I have second success.jspx page which has its success.java bean class in which i have define a method "display()".Now i want to cal display() in my success.jspx page.
can anyone help me out what is the way to do this.
Thanks in advance...
Thanks,
NehalHi Abhijit,
Sure i can give you more details on the same:
I have written a displayVal method in ForgotPassword.java bean class
public String displayVal() {
String txtVal = AdfFacesContext.getCurrentInstance().getPageFlowScope().get("testValue").toString();
nameID.setValue(txtVal);
return txtVal;
Now in ForgotPassword.jspx page i have one input text box named "nameID" in which i want to display some value from the user-define method called displayVal()
now i am trying to call my user-define method in my ForgotPassword.jspx page:
<af:inputText label="Name"
binding="#{backingBeanScope.backing_FrgtPwd.nameID}"
id="nameID"
value="#{backingBeanScope.backing_FrgtPwd.displayVal}">
</af:inputText>
but is is showing an error that: backingBeanScope.backing_FrgtPwd.displayVal is not a property as this a method.
So now my query is : Is there any way by which i can call my user-define method on the jspx page from the bean class of the same page. -
How to use user defined function in select query using Toplink
Hi Friends
I am little bit of new in Toplink stuff... so please help me...
I have to database functions 1. encrypt and 2. decrypt.
I want to exceute the following sql query using toplink
select port, database, user_name, decrypt(encrypt('String which is to be encrypt ','password'),'password') from CONFIGURATION
can anyone tell me , how to write code in toplink which will give the about sql output.
thanks .....The "Specifying a Custom SQL String in a DatabaseQuery" section in the TopLink Developer's Guide may help... http://download-uk.oracle.com/docs/cd/B32110_01/web.1013/b28218/qrybas.htm#BCFHDHBG
-
How to use User defined Function in Update statement
Hi All,
I have written below update statement to update column based on value return by function. but it is not working. Could any one help me on this. This function will return only one value for each project.
thanks in advance.
UPDATE dg2.OD_PROJ_LOOKUP_TEMP o
SET Months_In_Stage_Cnt = select Months_In_Stage_Cnt_ret(o.project_id) from dual;
thanks
debhi,
CREATE FUNCTION fn_emp_ename (p_empno IN emp.empno%TYPE)
RETURN VARCHAR2
IS
v_ename emp.ename%TYPE;
BEGIN
SELECT ename
INTO v_ename
FROM emp
WHERE empno = p_empno;
RETURN v_ename;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
RETURN NULL;
WHEN OTHERS
THEN
RETURN NULL;
END fn_emp_ename;
SQL>
SQL> select * from emp;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 17-DEC-80 800 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7788 SCOTT ANALYST 7566 19-APR-87 3000 20
7839 KING PRESIDENT 17-NOV-81 5000 10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7876 ADAMS CLERK 7788 23-MAY-87 1100 20
7900 JAMES CLERK 7698 03-DEC-81 950 30
7902 FORD ANALYST 7566 03-DEC-81 3000 20
7934 MILLER CLERK 7782 23-JAN-82 1300 10
14 rows selected.
SQL> select fn_emp_ename (empno) as emp_name from emp;
EMP_NAME
SMITH
ALLEN
WARD
JONES
MARTIN
BLAKE
CLARK
SCOTT
KING
TURNER
ADAMS
JAMES
FORD
MILLER
14 rows selected.
SQL> update emp
2 set ename= fn_emp_ename (7936)
3 where empno=7934;
1 row updated.
SQL> commit;
Commit complete.
SQL> select * from emp where empno=7934;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTN
7934 CLERK 7782 23-JAN-82 1300 1
SQL> i hope this helps .........
Thanks,
P Prakash
Edited by: prakash on Nov 17, 2011 11:52 PM -
Defing user defined function in message mapping
hi experts of xi.
i want to create UDF for counting no of records in body and checking with trailer countinfo and adding all contract account amounts in file body and checking with trailer sum.
if these 2 comparings r not matched then we have to set flag field 'N' else we have to set as Y'.
waiting for ur answer.
regards.
seeta ram.Hi,
pretty easy if you want to count number of lines (records)
two inputs (trailer and line segment)
and you can just compare it inside
then you can just return Y or N
Regards,
michal
<a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a> -
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 -
Making a User Defined Function for Mapping in XI
Hi folks..
I knw how to make User defined Function in XI,
i was wondering about can we have any room for making a function for Initializing Purpose, which intializes few fields in source Message to some Global variables, and later we can use these Global Variables to set the the Target field
My Doubt is this...
i have Source & target Structure like this Structure like this....
SOURCE TEST DATA IS...
Parentsrc
child1src a
child2src b
child3src c
child4src hi
child4src hello
child4src hey
(On the basis of instances of child4src the istance of the Parentdst will be generated)
TARGET DATA SHUD BE LIKE THIS....
Parentdst
child1dst a
child2dst b
child3dst c
child4dst hi
Parentdst
child1dst a
child2dst b
child3dst c
child4dst hello
Parentdst
child1dst a
child2dst b
child3dst c
child4dst heyHi
You have to modify your target structure:
<b>Source</b>
Parentsrc
child1src a
child2src b
child3src c
child4src hi
child4src hello
child4src hey
<b>Target</b>
<b>root</b>
Parentdst
child1dst a
child2dst b
child3dst c
child4dst hi
Parentdst
child1dst a
child2dst b
child3dst c
child4dst hello
Parentdst
child1dst a
child2dst b
child3dst c
child4dst hey
<b></root></b>
Now map like this:
child4src -
Parentdst
child1src--|
child4src--| UseOneAsMany -- Splitbyvalue --- child1dst
child4src--|
child2src--|
child4src--|UseOneAsMany --Splitbyvalue --- child2dst
child4src--|
child3src--|
child4src--| UseOneAsMany -- Splitbyvalue --- child3dst
child4src--|
child4src -- SplitbyValue -- child4src.
Regards
Suraj -
Acces to XI R/3 table into user-defined function. Is possible?
Hi experts.
We want to do a user defined function in message mapping that reads a value in R/3 table. R/3 table is created in XI r/3.
It´s possible?. How i can do it?.
Thanks for all.HI Julian
For your scenario, u need to create an rfc in the R/3 system and call that RFC from a user-defined function in XI by using the RFC Lookup facility..
Check out this following code...
com.sap.mw.jco.*;
public String Get_Customerl(String a,String b,Container container){
//write your code here
JCO.Repository mRepository;
// Change the logon information to your own system/user
JCO.Client mConnection = JCO.createClient(
"300", // SAP client
"XYZ" , // userid
"XYZ", // password
"EN", // language
"66.248.225.116", // host name
"00" ); // system number
// connect to SAP
mConnection.connect();
// create repository
mRepository = new JCO.Repository( "SAPLookup", mConnection );
// Create function
JCO.Function function = null;
IFunctionTemplate ft = mRepository.getFunctionTemplate("ZGET_MATERIAL");
function = ft.getFunction();
// Obtain parameter list for function
JCO.ParameterList input = function.getImportParameterList();
// Pass function parameters
input.setValue( a , "CUSTOMER" );
input.setValue( b , "NAME" );
mConnection.execute( function );
String ret = function.getExportParameterList().getString( "CUST");
mConnection.disconnect();
return ret;
This takes the customer number and name as input and the rfc maps these values in the table and returns the customer number if it exists in the database...
Hope u find it useful
Regards,
Hari -
Hi all,
I need to add 3 nodes in an user-defined function in message mapping using java code.The nodes r like EmpFirstName,EmpMiddleName,EmpLastName.I am writing one user-defined function like "ADD".How can i call these field names into "ADD" Function.
Thanks,
Gopi.Hi,
If you want to add the nodes to the input , then just add import parameters to the UDF.
If you want to create the multiple diff target nodes along with the values , then this would not be possible using an UDF.
it is possible to pass multiple values out of your UDF by writing an Advanced UDF , but, it would not be poissible to create multiple target nodes using an UDF.
Regards,
Bhavesh -
User define Function at Mapping Time
Hello Everyone,
My requirement is I input the one value to the user define function (at mapping time). That function calls the RFC to R/3 system and return the 3 output values. Now my question is how can I return 3-output value from the user define function.
What is the other possibility to solve this type of problem?
Where we have one input parameter and more than one output parameter.
If any one did this kind of job. Please give me the idea how can I solve this.
Regards,
Gaurav JainHello Richard,
Are you talking about <b>copy head to line</b> example given in MappingFunctionality.pdf.
In my scenario:
Input - NULL
Output - OP1, OP2, RESULT
And I write my Advance user define function as
import com.sap.mw.jco.*;
public void Lookupfunction(ResultList result, Container container){
JCO.Repository mRepository;
// Change the logon information to your own system/user
JCO.Client mConnection = JCO.createClient(
"100", // SAP client
"user", // userid
"pass", // password
"EN", // language
"hostid", // host name
"00" ); // system number
// connect to SAP
mConnection.connect();
// create repository
mRepository = new JCO.Repository( "SAPLookup", mConnection );
// Create function
JCO.Function function = null;
IFunctionTemplate ft = mRepository.getFunctionTemplate("ZTEST2");
function = ft.getFunction();
mConnection.execute( function );
result.addValue( function.getExportParameterList().getString( "OP1" ) );
result.addValue(function.getExportParameterList().getString( "OP2" ) );
result.addValue(function.getExportParameterList().getString( "RESULT" ) );
mConnection.disconnect();
But it shows me only one field as output in mapping icon.
so as per the mapping document i attach splitbyvalue over that but in the example only one field at the output side where i have three field.
How can i solve the problem?
Even i check in XI 2.0 System it doesn't show output at all.
Thanks & Regards,
Gaurav Jain
Message was edited by: Gaurav Jain
Maybe you are looking for
-
Error while OSB Building on UNIX Machine
Hi All, I am building OSB Projects on OSB Server on UNIX Machine using ant scripts. The script runs properly on Windows. OSB Version being used is 11.1.1.4. I am getting the following error while creating sbconfig.jar: !SESSION 2011-09-05 11:26:40.42
-
SPA 525G[2]: monitor mjpeg video RTSP , remove PATH constraint
Having read the forum's guide on the topic , https://supportforums.cisco.com/docs/DOC-9806 , and related errata it's clear the phone can render MJPEG via RTSP. The defect is the expectation of a needlessly specific URI PATH rtsp://10.20.30.40/img/jp
-
I bought a second hand LED display a few months back, and it didn't come with one of the Apple power cables. Now I know they're just regular leads that look nice but does anyone know where I can pick one up? I need a UK one but can't seem to find one
-
Optimum screen resolution?
I'm a newbie to using CS4 and I'm experimenting with the screen resolution on my 24" monitor. Dell recommends 1900x1200 but the text is too small to read comfortably at that resolution. I've read that 1024x768 is the minimum resolution suggested by
-
Can't print to CD using Epson Print CD with iMac and Mavricks
I just got a new iMac to replace my older MacBook. Both systems have the latest version of Mavericks 10.9.5. and the latest Epson printer driver for my Artisan 730. On the iMac when I try to print to a CD using Epson Print CD I am unable to select th