on 01-28-2009 9:04 PM
Hi All,
I am working the File to File Scenario.
In Source file i am sending the Company Number, In target file i need to be place the company Details. Company name, Name and Address from ECC System.
For that I am planning to use the RFC lookup.
RFC : BAPI_COMPANY_GETDETAIL
Inout Parameter : Company ID
Outoput Paramer : Company Number, Name, Address.
Could you please guide me how to write the lookup RFC.
I check the below code....
//write your code here
String sapClient = SAP CLIENT;
String hostName = hostname of SAP system;
String systemNumber = system number;
String userName = SAP Logon UserName;
String password = SAP Logon password;
String language = "EN";
JCO.Repository mRepository;
JCO.Client mConnection = JCO.createClient(
sapClient,
userName,
password,
language,
hostName,
systemNumber );
// connect to SAP
mConnection.connect();
// create repository
mRepository = new JCO.Repository( "GenericRFCMappingLookup", mConnection );
// create function template to select data from any table
JCO.Function function = null;
IFunctionTemplate ft = mRepository.getFunctionTemplate("BAPI_COMPANY_GETDETAIL");
function = ft.getFunction();
// Obtain parameter list for function
JCO.ParameterList input = function.getImportParameterList();
// Pass function parameters
// set import parameters table name and RFC
input.setValue( DBTABLE, "COMPANYID");
//Fill the where clause of the table
JCO.ParameterList tabInput = function.getTableParameterList();
inputTable.appendRow();
mConnection.execute( function );
//Find the position of the field that has to be lookedUp
JCO.Table lookupFieldPos = function.getTableParameterList().getTable("FIELDS");
int pos = -1;
for (int i = 0; i < lookupFieldPos.getNumRows(); i++)
{
lookupFieldPos.setRow(i);
if (lookupFieldPos.getString("FIELDNAME").equals(lookUpField))
pos = i;
}
//Get the exact lookupvalue from the position obtained above
JCO.Table valueSet = function.getTableParameterList().getTable("DATA");
for (int i = 0; i < valueSet.getNumRows(); i++)
{
valueSet.setRow(i);
String resultSet [] = valueSet.getString("WA").split(",(?=(?:[\"]*\"[\"]\")(?![^\"]*\"))");
result.addValue(resultSet[pos]);
}
mConnection.disconnect();
Any one correct my code based on the requirment, I am poor in JAVA Code.
Thanks for your help,
ANU
check out : https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a03e7b02-eea4-2910-089f-8214c6d1...
Thanks,
Pooja Pandey
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
just to mention one thing
what you specified it not an XI RFC lookup
it's a standard jco call
for real XI RFC lookups have a look at my article:
this way you can specify the details of the RFC channel in directory
and not as in your case hardcoded in the code - that's the main advantage
Regards,
Michal Krawczyk
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
in RFC lookup you use XI communication channel - defined in directory
with jco you need to hardcode configuration in the call (so difficult to change
when you move from dev to test to prd)
rfc lookups are XI specific standard
jco is java standard and you can use it from any java program
use RFC lookups
Regards,
Michal Krawczyk
Thanks Mike,
Can any one Send me the JCo Call UDF Code...
I am working the File to File Scenario.
In Source file i am sending the Company Number, In target file i need to be place the company Details. Company name, Name and Address from ECC System.
For that I am planning to use the RFC lookup.
RFC : BAPI_COMPANY_GETDETAIL
Input Parameter : Company ID
Outoput Paramer : Company Number, Name, Address.
Any one correct my code based on the requirment, I am poor in JAVA Code.
Thanks for your help,
ANU
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
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.