cancel
Showing results for 
Search instead for 
Did you mean: 

Graphical RFC Lookup & Validating Numeric Value

Former Member
0 Kudos

Hi everyone,

I have an file - PI - IDOC scenario where i need to do graphical FRC Lookup in mapping (using BAPI_COMPANYCODE_GETLIST)to collect company codes and map it to DEBMAS06 IDOC.

I want to send all company codes within the intervall 1000 < company code < 2000. the result from the lookup contains also non-numeric data such as BD01 and so on;

I create an user defined function to do this jub but the result is <null>:

/*****************/

public void rfcLookupII(String[] cc, ResultList result, Container container) throws StreamTransformationException{

String code = "";

for (int i = 0; i < cc.length; i++) {

code = cc<i>;

if (code.matches("
d+")) {

int intCode = new Integer(code).intValue();

if (intCode >= 1000 && intCode <= 2000)

result.addValue(code); }

} }

/******************/

can anyone help me Please to fix this problem.....

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I create an user defined function to do this jub but the result is <null>:

but where are you calling your RFC in this code?

Former Member
0 Kudos

As I wrote, I am using the graphical RFC-LOOKUP function from message mapping in PI 7.1

Former Member
0 Kudos

Did you got any error for this?

Just try for getting one compnay code instead for bulk and let me know the result

Rajesh

Former Member
0 Kudos

Hi again and thanks for responsing.

No, i don't got any error. But the case is, my lookup works fine.

I did the lookup and the result from lookup is the comany codes i have registered on the table T001 in R3 system. But IDOC expects just the numeric value/numeric company codes which are between 1000 and 2000. thats why i am trying to 1) validate numeric values which comes from lookup. 2) filter out the values that are not within the value range i am interested in.

thats why i am trying to create a UDF to do this job for me...

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Naser,

I saw the code implemented by you, and I see few fundamental mistakes done in it.

The working code for the UDF should be as:

for (int i = 0; i < cc.length; i++) {
	code = cc<i>; 
//You have Assigned String array to String, if you do a check on the Message Mapping 
//the above line should be shown in error
	if(code.matches("\\d+")) // Change the regular expression
	{
		int comp = Integer.parseInt(code); // getInteger() is used for system properties
		if(comp >=1000 && comp <= 2000)
		{
			result.add(comp);
		}
	}			
}

Hope this helps.

Regards,

Alka Panday.

Former Member
0 Kudos

Hi guys and thanks for responses.

but my code works fine now for validating numeric value returned from RFC Lookup;

String code = "";

for (int i = 0; i < cc.length; i++) {

code = cc<i>;

if (code.matches("
d+")) {

int intCode = new Integer(code).intValue();

// if (intCode >= 1000 && intCode <= 2000) result.addValue(code);

if ((intCode > 999 && intCode <= 1000) || (intCode >= 1299 && intCode <=1999)) result.addValue(code);

}

}

the problem was in graphical message mapping. I did send an constant as in parameter, thats why the returned output was just the first element from the ResultList. Now I am sending root node (0:n) as in parameter for the RFC Lookup and the result is just what i was looking for.

but thanks anyway...