Tuesday, 30 July 2024

Set flag on particular dates in month in sap cpi groovy

 Requirementis to send the report on particular date's on the month in groovy script. 


Groovy script:

import com.sap.gateway.ip.core.customdev.util.Message;

import java.util.HashMap;

import groovy.json.JsonSlurper

import groovy.json.JsonException

import groovy.json.JsonOutput

import javax.xml.*;

import groovy.xml.*

 

def Message processData(Message message) {

    def body = message.getBody(java.lang.String) as String;

    def date = new Date()

    def day = date.getDate()

    def Flag = ""

    if(day == 20 || day == 21 || day == 22 || day == 23){

    Flag = "true"

    }

    else {

        Flag = "false"

    }

    message.setProperty("Flag",Flag)

    return message;

}




No comments:

Post a Comment