on 05-03-2007 11:58 AM
Hi all,
I m using look up through JCO and calling a RFC on backend R/3 for the particular validation.I m using UDF for that.In the UDF i have specified imports as:-
imports :-java.util.;java.lang.obj.;com.sap.aii.mapping.lookup.;com.sap.mw.jco.;java.io.*;
source code --
//write your code here
JCO.Repository myRepository;
// Change the logon information to your own system/user
JCO.Client myConnection = JCO.createClient(
// all the client information namely client ,user id pwd etc
myConnection.connect();
// create repository
myRepository = new JCO.Repository( "SAPLookup", myConnection );
// Create function
JCO.Function function = null;
IFunctionTemplate ft = mRepository.getFunctionTemplate("xxxxx"); //Name of RFC
function = ft.getFunction();
// Obtain parameter list for function
JCO.ParameterList input = function.getImportParameterList();
// Pass function parameters
input.setValue( a , "xxxxx" ); //import parameter of RFC, a is input argument.
myConnection.execute( function );
String ret = function.getExportParameterList().getString( "XXXX" ); //export param
myConnection.disconnect();
return ret;
}
however on test i m getting follwing error:
Source code has syntax error: D:/usr/sap/XID/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map6df266d0f96411dbb2a4000bcd3f5f3d/source/com/sap/xi/tf/_MM_Source_To_Target_.java:157: 'class' or 'interface' expected public static void main(String[] args) throws Exception{/!_$ClNRep_/_MM_Source_To_Target_ st = new /!_$ClNRep_/_MM_Source_To_Target_(); st.testExecute(); }
Can anybody help me out in rectifying this Syntax errror.
Regards,
AshwinM
Ashwin,
Why dont you use the standard RFC Look up API for this?
Have you see this article by Michal already.
Regards,
Jai Shankar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi bhavesh,
Thanks for the reply...
Now consider for scneario..
1.file to file
2.ZRFC to be lookd up in the backend
3.sender1 field >UDF>receiver field...
what will be the value of variable "m" mentiond in blog recommended for RFC API Mapping LookUp..ie" String m =......" // payload to be filled through RFC XML
Regards,
Ashwin M
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ashwin,
This will be your Request RFC in XML format.
Import the RFC in XI, use it in some dummy mapping, fillin the request parameters in the TEST tab of your mappinga nd you will get the XML of the RFC request. Now use this in your UDF. Ofcourse the parameters need to be passed as inputs to the UDF and need to be appeneded to the RFC request XML string.
Regards
Bhavesh
hi all,
Thanks for the quick reply...
However whats the error with the source code of UDF through the JCO ...also when u use RFC API u need use RFC adapter which i dont want...I would prefer to use JCO unless there is ne Performance issue...
Kindly correct me on Syntax error..."what interface or Class is expected"
Regards,
AshwinM
Message was edited by:
Ashwin M
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You are hardcoding the user id , password etc in your UDF. This is something will cause issues asyou move your objects across environments from Dev to Qaulity and production.
You cannot change the user id and passwordi n your mapping code in your Quality and Prodction. Use of RFC Lookup is strongly recommended with the RFC adapter.
I dont think using RFC Lookup API causes any perfromance degradations. We have used this feature multiple times in and have never faced performance constraints as a result of this.
Regards
Bhavesh
hi,
don't use this way as you will have to hardcode
pass client, user etc...
use RFC API instead
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>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
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.