cancel
Showing results for 
Search instead for 
Did you mean: 

UDF to handle blank value returned from RFC.

Former Member
0 Kudos

Hi Experts,

We have a scenario in SAP PI 7.1 where we give the item as input to RFC. The RFC checks for the item and returns the corresponding material . In case the corresponding material is not found the material value is populated with the source item. The problem we are facing is at times the RFC call fails for some unknown reason and the material code comes as blank. The material belongs to a standard idoc and hence cannot be made mandatory. I have created the below UDF to handle the issue but it seems not to work.

if (inputValue == null || "".equals(inputValue)){

                throw new RuntimeException ("The value cannot be blank .");

}else {

                return inputValue;

}


I am unable to find the flaw in the code. Please help me.

Accepted Solutions (0)

Answers (2)

Answers (2)

iaki_vila
Active Contributor
0 Kudos

HI Shaibayan,

You can also could set a schema validation in the sender adapter. For PI 7.1: , in this way you can set the material mandatory for the sender and they will get an appropriated schema validation exception.

Regards.

Former Member
0 Kudos

Hi ,

What is the problem that you are facing ?.Do you want to fail the mapping when blank value comes from ECC ?

If yes then below code is fine .Hope you are using singlevalues for excecution type

if (inputValue == null || inputValue.trim().length() == 0) {

                throw new StreamTransformationException("The value cannot be blank") ;

}else {

                return inputValue;

}


Regards

Venkat

Former Member
0 Kudos

When the RFC lookup display queue gives error "Cannot perform RFC Lookup" at that time I need to throw the error output. Currently when in display queue we are getting Cannot perform RFC Lookup what happens is that the Material value does not occur in the target IDOC. The problem is when I check the display queue I get Cannot perform RFC Lookup but when I test the same it is successful without Material. What required is at any point if RFC fails due to network failure or any other issue and does not generate any result be it blank[]/null the mapping should fail then and there and not give any output like I am getting without the Material.

Former Member
0 Kudos

Hello,

>>The problem we are facing is at times the RFC call fails for some unknown reason + When the RFC lookup display queue gives error "Cannot perform RFC Lookup" at that time I need to throw the error output

U should know what's the reason and check why ur RFC is returning such messages - This is not a correct nehaviour

Not sure u can do much apart from debugging RFC, may be u can try to check "Use Exception" option in RFC lookup.

https://scn.sap.com/thread/1512208

Thanks

Amit Srivastava