Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Its a calulation -- Number of Hours to Unload

HI Gurus,

i have requirement i need to write a UDF for caliculation Time .. through graphical mapping i done..its a perfomance issue///. it is necessary to go for UDFs.

Its a calulation -- Number of Hours to Unload

((NTANZ) where QUALF=006) - ((NTANZ)where QUALF=007)

result is this Format

HHMM

Its a calulation -- Number of Hours to Unload

let me know any related links and related UDFs ...

thanks in advance

Edited by: mahesh1331 on Jun 27, 2010 11:37 AM

Former Member
Former Member replied

Hi Mahesh i think this udf is use full your requirement

String ret=null;

try{

DateFormat sdf1=new SimpleDateFormat("hhmmss");

Date p=sdf1.parse(var1);

Date p2=sdf1.parse(var2);

long h=Math.abs(p.getHours()-p2.getHours());

long m=Math.abs(p.getMinutes()-p2.getMinutes());

long s=p2.getSeconds()-p.getSeconds();

String hh=String.valueOf(h);

String ss=String.valueOf(s);

String mm=String.valueOf(m);

if(hh.length()==1)

hh="0"+hh;

if(mm.length()==1)

mm="0"+mm;

if(ss.length()==1)

ss="0"+ss;

String con=hh.concat(mm).concat(ss);

ret=con;

}catch(ParseException pe){

}

return ret;

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question