Tuesday, February 22, 2022

UDFs Groovy Script in Message Mapping

 The execution mode for functions are supported by two types

Single value -

Here, the Function Return type can only be String

Template:

-----------------------------------------------------------------------------------------------------------------

import com.sap.it.api.mapping.* 

def String extParam(String P1,String P2,MappingContext context) 

 String value1 = context.getHeader(P1); 

 String value2 = context.getProperty(P2); 

 return value1+value2; 

-----------------------------------------------------------------------------------------------------------------

All values of context -

  • No return statement to be used here.
  • Argument 'output' is to which we can add values
  • All the String inputs should be of Type Array.
Template:

-----------------------------------------------------------------------------------------------------------------

import com.sap.it.api.mapping.* 

def void extParam(String[] P1,String[] P2, Output output, MappingContext context) 

String value1 = context.getHeader(P1);

String value2 = context.getProperty(P2); 

 output.addValue(value1); 

 output.addValue(value2); 

-----------------------------------------------------------------------------------------------------------------


No comments:

Post a Comment