on 2007 Dec 27 8:39 PM
Hello Everybody
I need a java Code To validate the value exist in system
For an user Defined Function.
System A value Need to Compare in System B.
IF the value exist in System B Then need to sent to System C.
early answer would be great
Regds
Raj
Hi,
what do you mean with "system"? Is a tag in your message or you mean an environment variable (operating system variable)?
regards.
roberti
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Experts,
I need a sample Java Code with logic to check like
<Field exits in R/3 >
I have to check for the following conditions.
If the Po exists, then I need to Pass these to IDOC IF not returns Error
If the PO exists send the Po to Target field.
FlatFIle has PO------Checking in ---R/3 Before sending to IDOC
Its it Exist in R/3 Sends to IDOC .
For doing the validations, instead of looking for any code, u can directly use the graphical mapping.
Use lookups to check whether the PO alreasy exists in R3. Then u ll have the response in XI mapping. There u can use the "Exist" function to check whether the field exists or not.
Regards,
Prateek
HI,
Lookup has to be use in this case.
Steps to be done:
1) Get the value from the file and pass that value to R3 system using JAVA lookup.
2) In R3 end under the function module write a code which checked the PO with the PO which is present in R3.
3) Return the value of the comparision to UDF and then pouplate the value in IDOC.
I hope this is what u want.
Lookup links are below:
Some use cases:
Look up material number from table MARA.
Look up cost center budget.
Look up employee information.
Look up unit-of-measure (UOM) information from table t006a.
Lookup for raising an alert.
There are two ways in which we can do lookup:
Call lookup method from GUI mapping.
Call lookup method from XSLT mapping.
Lookup method from GUI mapping can be called using any of the following ways.
RFC lookup using JCO (without communication channel)
/people/sravya.talanki2/blog/2005/12/21/use-this-crazy-piece-for-any-rfc-mapping-lookups
RFC lookup with communication channel.
/people/alessandro.guarneri/blog/2006/03/27/sap-xi-lookup-api-the-killer
Lookup using JDBC adapter.
/people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler
/people/sap.user72/blog/2005/12/06/optimizing-lookups-in-xi
CSV file lookup.
/people/sundararamaprasad.subbaraman/blog/2005/12/09/making-csv-file-lookup-possible-in-sap-xi
Call lookup method from GUI mapping: Use this for ur scenario:
The steps are as follows:
Develop and test ABAP function module.
Develop and test Java method within Integration Repository/message mapping tool.
Check this weblogs with some screenshots on how to achieve this:
/people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler
/people/sravya.talanki2/blog/2005/12/21/use-this-crazy-piece-for-any-rfc-mapping-lookups
/people/alessandro.guarneri/blog/2006/03/27/sap-xi-lookup-api-the-killer
/people/sap.user72/blog/2005/12/06/optimizing-lookups-in-xi
/people/morten.wittrock/blog/2006/03/30/wrapping-your-mapping-lookup-api-code-in-easy-to-use-java-classes
Thnx
Chirag
For lookup u have to write a UDF. Now this UDF can be used in mapping and the result of the lookup can be obtained in any field just as we use standard functions.
It would be good to keep ur query posted on SDN. That way u will be able to get views of experts across the world.
U may find my contact details on my Business Card.
Regards,
Prateek
Hi,
You can refer to these links.
Use first one for RFC lookups and also for Java Code/
/people/alessandro.guarneri/blog/2006/03/27/sap-xi-lookup-api-the-killer Absolute stealer.
/people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler
For Java APIs and also here you can map that how many types of lookups are possible in XI.
http://help.sap.com/javadocs/NW04/current/pi/com/sap/aii/mapping/lookup/package-summary.html
Regards
Aashish Sinha
PS : reward points if helpful
HI,
Here is the code which will help u:
JCO.Repository mRepository;
// Change the logon information to your own system/user
JCO.Client mConnection = JCO.createClient(
"800", // SAP client
"sam", // userid
"sap", // password
"EN", // language
"ntbomsap15", // 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("BAPI_COMPANY_GETDETAIL");
function = ft.getFunction();
// Obtain parameter list for function
JCO.ParameterList input = function.getImportParameterList();
// Pass function parameters
input.setValue(a[0] , "COMPANYID");
Note: BAPI_COMPANY_GETDETAIL is the function module in R3 which will hav the import value as company coe and export parameter as company detail.
mConnection.execute( function );
mConnection.setAbapDebug(true);
//String ret = function.getExportParameterList().getString( "COMPANY_DETAIL" );
Note: (a[0] , "COMPANYID"); a is the input which is passed to UDF and COMPANYID is the inport parameter of FM.
/*
JCO.Table valueSet = function.getExportParameterList().getTable("COMPANY_DETAIL");
for (int i = 0; i < valueSet.getNumRows(); i++)
{
valueSet.setRow(i);
String result1 = valueSet.getString("NAME1");
result.addValue(result1);
}
*/
//valueSet.getNumRows()
Note: result1 is the output which is send back to UDF and mapped to target field in the mapping.
result.addValue(function.getExportParameterList().getStructure("COMPANY_DETAIL").getString("NAME1"));
mConnection.disconnect();
Hope now u can understand the logic and the java code and close the thread if ur requirement is fulfil.
Thnx
Chirag
User | Count |
---|---|
70 | |
10 | |
8 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.