Tuesday, 8 August 2023

Get the dynamic date's and return using groovy script in SAP CI

Based on the input day from the value mapping this returns, incase if the date's are changing later then it is config change only.

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 propertyMap = message.getProperties()

String date2 = propertyMap.get("ExectutionDate");

String date3 = propertyMap.get("ExectutionDate1");

String date4 = propertyMap.get("ExectutionDate2");

def date1 = new Date()

String day = date1.getDate()

if (day == date2 || day == date3 || day == date4 )


{

Flag = "true"; 

}


else {

Flag = "false" 

}

message.setProperty("Flag1", Flag)

message.setProperty("day1", day)

return message;

}







No comments:

Post a Comment