on 02-03-2006 4:43 PM
Hi,
Created a userdefined function and i'm trying to do a direct jco call to R/3 & XI to access bapi.Can any one help me in pointing me to an API or(Sample java code ,for connecting the system,calling RFC and retrieving the export parameters ...)
Thanks in advance,
Dan
Hi Dan,
here is an example how to call R/3-BAPI or RFC via JCo:
public String genIDOCSerial2(String a,String b,String c,String d,String e,String f,String g,String h,Container container){
// a - hostname
// b - sysid
// c - client
// d - sysnr
// e - language
// f - user
// g - password
// h - ESA Nummer / Kannallnummer
String RCVPRN;
String RCVPRT;
String RCVPFC;
String MESTYP;
String OBJ_TYPE;
String CHNUM;
if (b.equals("XC1"))
{
RCVPRN = "DAVIS";
}
else if (b.equals("XK1"))
{
RCVPRN = "QAVIS";
}
else if (b.equals("XP1"))
{
RCVPRN = "PAVIS";
}
else
{
RCVPRN = "DAVIS";
}
RCVPRT = "LS";
RCVPFC = "";
MESTYP = "BANK_CHANGE";
OBJ_TYPE = "BUS1011";
CHNUM = h;
JCO.Repository mRepository;
// Change the logon information to your own system/user
JCO.Client mConnection = JCO.createClient( c, // SAP client
f, // userid
g, // password
e, // language
a, // host name
d ); // 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("/MAN/BC_ALE_001_GET_SERIAL");
function = ft.getFunction();
// Obtain parameter list for function
JCO.ParameterList input = function.getImportParameterList();
// Pass function parameters
input.setValue( RCVPRN , "IV_RCVPRN" );
input.setValue( RCVPRT , "IV_RCVPRT" );
input.setValue( RCVPFC , "IV_RCVPFC" );
input.setValue( MESTYP , "IV_MESTYP" );
input.setValue( OBJ_TYPE , "IV_OBJ_TYPE" );
input.setValue( CHNUM , "IV_CHNUM" );
mConnection.execute( function );
String ret = function.getExportParameterList().getString( "EV_SERIAL" );
mConnection.disconnect();
//ret = "ANTWORT";
return ret;
}
Specify these parameters with the right value in your system environement.
// a - hostname
// b - sysid
// c - client
// d - sysnr
// e - language
// f - user
// g - password
Another solution is also to use ABAP-Mapping. In the ABAP-Mapping you can jump easyily to the other R/3-System with classic RFC-Technique e.g. via RFC-Destination in transaction SM59 with call function ... Destination ...
Hope it will help you.
regards,
Ly-Na Phu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Anand and Ly-Na Phu for your replies.
Ly-Na Phu
In ABAP mapping,where should i code this RFC call to R/3 .Is that dealing with ABAP proxies.
Also my requirement is after getting the look up values from R/3 ,format it and need to send email to users.Is there a java API for emailing from here.pl help.
Thanks again !
Dan.
Hi Dan,
>>In ABAP mapping,where should i code this RFC call to R/3 .Is that dealing with ABAP proxies.
Within your ABAP mapping along with the mapping code you can invoke a RFC. This has nothing to do with proxies, instead of message or java mapping you can write ABAP mapping programs.
>>Also my requirement is after getting the look up values from R/3 ,format it and need to send email to users.Is there a java API for emailing from here.pl help.
You can use mail adpter to send e-mails..
/people/prasad.ulagappan2/blog/2005/06/07/mail-adapter-scenarios-150-sap-exchange-infrastructure
http://help.sap.com/saphelp_nw04/helpdata/en/6b/4493404f673028e10000000a1550b0/content.htm
Regards
Anand
Hi Dan,
Check this...
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/xi-how-to-guide... to perform sap data lookups within xi mappings
If you have >=SP13, you can use RFC lookups
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/xi-code-samples... mapping lookups rfc api.pdf
Regards
Anand
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.