cancel
Showing results for 
Search instead for 
Did you mean: 

*****RFC lookups

Former Member
0 Kudos

Hi all,

is it possible to retrieve values from multiple fields from the R/3 Table.

Like I need to retrieve the field values Matnr(material number),Storage location and plant .The source is a file which sends these details,the values from the table are retrieved and these are compared with source data,if it is the same then transaction 201k else 201 needs to be send.

can we perform s lookups using a single UDF.

Please let me know.

Thanks,

Srinivasa

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Srinivas,

To retrieves the value from the R/3 system, develop the FM in R/3 system.

The importing paramter/ table mention will take the input from the JCO lookup from XI system and Exporting parameters/ Tables will return the values to the XI system.

Develop a UDF to perform the JCO lookup.

JCO.Repository mRepository;

JCO.Client mConnection = JCO.createClient("<Client>", // SAP client

"<USERID>", // userid

"<PASSWORD>", // password

"<LNG>", // language

"<HOSTNAME>", // host name

"<SYSNO>"); // system number

try {

mConnection.connect();

} catch (Exception e) {

// e.printStackTrace();

}

mRepository = new JCO.Repository("SAPLookup", mConnection);

IFunctionTemplate ft =

mRepository.getFunctionTemplate("<FM NAME>");

JCO.Function function = ft.getFunction();

JCO.ParameterList allTables = function.getTableParameterList();

JCO.Table tabMatnrUsed = allTables.getTable("MATNR");

tabMatnrUsed.setValue(Matnr, "MATNR");

mConnection.execute(function);

allTables = function.getTableParameterList();

tabBnkUsed = allTables.getTable("tabMatnrUsed");

for (int i = 0; i < tabMatnrUsed.getNumRows(); i++) {

tabBnkUsed.setRow(i);

String storageLocation =

(String) tabBnkUsed.getValue("Storage_Location");

}

mConnection.disconnect();

In this case i used the Internal Table "MATNR" for both input and output and

"MATNR" and "Storage_Location" are the fields

appreciate if helpful

Edited by: chandra shekhar on Jun 25, 2009 8:01 AM

Answers (3)

Answers (3)

former_member193376
Active Contributor
0 Kudos

Hi

i had a similar situation, and someone else asked the same thing, i have already answered it, please go through these threads.

https://www.sdn.sap.com/irj/scn/profile?editmode=true&userid=3747674

in both these threads check out my answers.

in short write a UDF with a JCO call and this will call an RFC which in turn will call ur tables

Hope this helps

Thanks

SG

rajasekhar_reddy14
Active Contributor
0 Kudos

Hi Srinivas,

Which version of XI are you using,if it is PI7.1 its very easy to perform RFC LookUp,no need to write any code.

We can retrieve multiple values using RFC lookup.Retrieve three values and store in to 3 variables and compare RFC values with Source Values.

cheers,

Raj

Former Member
0 Kudos

i am using PI7.0.The RFC look up must be done from 3 fields of the idoc under same seggment.

could any send me a sample cod to achaeve this.

Thanks,

Srinivasa.

Former Member
Former Member
0 Kudos

Srinvasa,

You can retrieve multiple values from sap. Once retreived you can compare with a udf or with graphical mapping. You can pass as an array and retreive as an array.

Regards,

---Satish