Tuesday 8 August 2023

Pick the certain date's of the month as output in mapping in SAP CI


There is a requirement where the report should run on certain date on every month, so this below logic is implement in mapping to achieve this.


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