cancel
Showing results for 
Search instead for 
Did you mean: 

How to extract values from SAP PI to graphical mapping in PI7.1

Former Member
0 Kudos

Hi All,

I want to do lookup fro SAP PI table in the graphical mapping.how to do that one.

My table is with two columnd like EMPID EMPNAME

There is one table in SAP PI.In graphocal mapping from source i will get EMPID i want to get the corresponding EMPNAME from the table and send it to target filed.

Is there any easy way to do it in SAP PI 7.1 by usinf RFC lookup conversion?

please tell me easy way to achive this one

Thanks

rams

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

In PI 7.1 RFC Lookup is much easier, you need not to write UDF for RFC, JDBC an SOAP Lookup

1. First you need to create a RFC Communication Channel as a receiver to be used for Lookup

2. Create a message mapping where input will be passed to RFC Lookup.

A) Go to Signature Tab and Define a Channel Parameter under parameters section

Parameter: Name, Category and Type.

B) Go back to design tab, click on RFC Lookup and select the channel defined in signature tab.

Click on white box Icon below channel to select the RFC structure. (This will show the RFCs under

imported objects).

C) Going ahead, select and add fields in the request and response sections to define lookup import and

export parameters.

D) Go to test Tab to test this scenario. Under Parameters section specify the actual communication

channel name defined in Integration Builder.

E) Go back to Document tab, provide any input string and execute the mapping. And here we can see

the target field u201Cresultu201D populated with RFC response

Cheers! Hope It hepls you

Sameer!

Answers (4)

Answers (4)

Former Member
0 Kudos

thanks

Former Member
0 Kudos

Hi,

Instead of thanks pls rewards the point

Sameer

former_member581827
Participant
0 Kudos

Hi,

You can use RFC look up and build UDF with below code.

//write your code here

//write your code here

//String DBTABLE = a[0];

String lookUpField =a;// d[0];

String returnVal = "";

//String WHERE_CLAUSE = b[0]" = ""'"c[0]"'" ;

String sapClient = "200";

String hostName = "10.215.134.107";

String systemNumber = "00";

String userName = "username";

String password = "pwd";

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("RFC_READ_TABLE");

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( "QUERY_TABLE", "Table Name");

input.setValue("DELIMITER", ";");

//Fill the where clause of the table

//JCO.ParameterList tabInput = function.getTableParameterList();

//JCO.Table inputTable = tabInput.getTable("FIELDS");

//inputTable.appendRow();

//inputTable.setValue(WHERE_CLAUSE,"TEXT");

mConnection.execute( function );

//Find the position of the field that has to be lookedUp

JCO.Table lookupFieldPos = function.getTableParameterList().getTable("FIELDS");

int pos = -1;

int landPos = -1;

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

{

lookupFieldPos.setRow(i);

if (lookupFieldPos.getString("FIELDNAME").equals("EMPID"))

pos = i;

if (lookupFieldPos.getString("FIELDNAME").equals("EMPNAME"))

landPos = 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(";"); //valueSet.getString("WA").split(",(?=(?:[\"]*\"[\"]\")(?![^\"]*\"))");

if(resultSet[pos].equals(a))

{

returnVal = resultSet[landPos];

}

}

mConnection.disconnect();

return returnVal;

Regards,

Chandra

former_member181962
Active Contributor
0 Kudos
former_member181985
Active Contributor
0 Kudos

Yes you can go ahead with RFC lookups.......

I think in PI7.1 there is standard fucntion for this.