Quantcast
Channel: SCN : Discussion List - SAP Sourcing
Viewing all articles
Browse latest Browse all 1416

Unable to extend expiration date of contract by 6 years via script

$
0
0

Hi,

We have a requirement to populate Retention Date of MA with Expiration Date + 6 years.

 

I have written an explicit script but it is throwing the following exception. Could you please let me know how to fix this.

 

Target exception: java.lang.ClassCastException: Illegal cast. Cannot cast java.util.Date to com.sap.odp.api.common.types.SysDateIfc

 

Here I am giving the code for your reference

 

SysDateIfc expirationDateIfc=contractobj.getExpirationDate();

Date expirationDate = contractobj.getExpirationDate().getDate();

  Calendar c = Calendar.getInstance();

  c.setTime(expirationDate);

  c.add(Calendar.YEAR, 6);

  Date newexpirationDate = c.getTime(); // it is working fine till this point

 

SysDateIfc retensionDateIfc= (SysDateIfc) newexpirationDate;// This part of code is throwing the ClassCastException

 

Any inputs are greatly appreciated.

 

Many Thanks,

Srini


Viewing all articles
Browse latest Browse all 1416

Trending Articles