Skip to Content

SCPI CompoundEmployee Groovy Script (Query)

Hi,

Can anyone perhaps help with a blog or an example on how to write a groovy script for a custom iFlow to limit the amount of employees extracted by the CompoundEmployee component by something like payroll area (pay-group)?

Kind Regards

Deon

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Jan 22 at 01:29 PM

    Hello Deon,

    Please find below the script. I am setting a query as a property and later in the channel you can use same parameter to fetch the query.

    Script:
    
    def query = "SELECT person,employment_information,job_information FROM CompoundEmployee WHERE COMPENSATION_PAY_GROUP ='ABC' " 
    message.setProperty("customQuery",query );
    
    
    

    so you could use same property customQuery property as query string.

    Hope this helps.

    regards,

    Praveen T

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Deon,

      Seems there is an issue with the script.

      it should look like below:

      import com.sap.gateway.ip.core.customdev.util.Message;
      import java.util.HashMap;
      import java.text.SimpleDateFormat;
      import java.util.Date;
      
      def Message processData(Message message) {
      //def query = "SELECT person,employment_information,job_information FROM CompoundEmployee WHERE pay_group ='MM' ";
      String query = "SELECT person,employment_information,job_information FROM CompoundEmployee WHERE pay_group ='MM' ";
      message.setProperty("customQuery",query);
      return message;
      }