cancel
Showing results for 
Search instead for 
Did you mean: 

Compare dates coming form Source system & update higher one in target syste

Former Member
0 Kudos

hi all,

Mt reqt is to compare dates coming from source system & update highere one

Ex--) E1EDP01 has been repeated 3 times in Idoc segemnt E1EDP20 , then date with higher one need to be updated in target system

like 14/12/08

15/12/08

16/12/08

Here 16/12/08 need to be updated first & then the other ones one by one.

Anybody guide me in comparing these dates functionality .

Send me the code !

Regards

Chaithanya

Accepted Solutions (0)

Answers (1)

Answers (1)

MichalKrawczyk
Active Contributor
0 Kudos

>Send me the code !

???

you're on the forum and not on your block

please use Proper Language when asking for solutions

if you don't have time to use it then don't post on the forum

thanks,

Regards,

Michal Krawczyk

Former Member
0 Kudos

Hi Michael,

I was unable to trace the exact issue of how to track E1EDP01 Dates & compare it.

I had created UDF to compare dates coming from E1EDP01 Segment

following is my code --->

// This UDF return 1 value for highest date and 0 for not highest date.

DateFormat mydateformat = new SimpleDateFormat("ddMMyyyy");

Date mydate1 = null;

Date heightDt = null;

for (int i=0; i <a.length; i++)

{

if (a<i>.equals(ResultList.CC)) continue;

try{

mydate1 = mydateformat.parse(a<i>);

if (i==0)

{

heightDt = mydateformat.parse(a<i>);

}

if (heightDt .before(mydate1))

{

heightDt = mydate1;

}

}

catch(Exception e){}

//result.addValue( mydateformat.format(heightDt));

}

for (int i=0; i <a.length; i++)

{

try{

mydate1 = mydateformat.parse(a<i>);

if (heightDt .equals(mydate1))

{

result.addValue( "1");

}

else

{

result.addValue( "0");

}

}

catch(Exception e){}

}

My Problem here is in my Idoc if there are Multiple E1EDP20 segments & here date would be repeated 4 times . I have to compare highest date out of 4 & send it to the target system.

which I have done it, but here my problem is the segment E1EDP01 is repeated & iam unable to find highest date individually to the node level.

Sorry I should have explained this before only.

Can Anyone guide me in comparing the date at segment level.

Regards

Chaithanya

prateek
Active Contributor
0 Kudos

Have you tried using the standard date function compareDate?

Regards,

Prateek

Former Member
0 Kudos

Prateek,

I have tried it, but of no use because dates would be coming in EDATU field in E1EDP20 segement which can be repeated n times . But when E1EDP01 is repeated 2 times the comparision should be individual

Ex-) 1.E1EDP01

'

E1EDP20

'

2007/04/01

2007/04/02 -


> here 2007/04/03 is max so this would be populated in target.

2007/04/03

2. E1EDP01

'

E1EDP20

'

2007/04/04

2007/04/05 -


> here 2007/04/06 is max so this would be populated in target.

2007/04/06

now only 2007/04/03 , 2007/04/06 should be populated in E1EDP20 segments.

Regards

Chaithanya