cancel
Showing results for 
Search instead for 
Did you mean: 

I need udf

praveenreddy_bk
Participant
0 Kudos

1) This is structure

YYYY-MM-DDTHH:MM:SS+HH:MM to DDMMYY

Here T stands for Time Begin

Plz I need UDF for this .

Accepted Solutions (1)

Accepted Solutions (1)

former_member181962
Active Contributor
0 Kudos

NO need of UDF .

Use standard text functions.

use substring function 3 times to get DD , MM and YY

like this

substring : first parameter is the source string

second parameter is 8 (Starting position if Date)

third parameter is 2 (Length if Date)

substring : first parameter is the source string

second parameter is 5 (Starting position of month)

third parameter is 2 (Length if month)

substring : first parameter is the source string

second parameter is 2 (Starting position if Date)

third parameter is 2 (Length of year)

use concatenate function two times.

First concatenate the output of first two substrings.

Then use concatenate function to club the output of the first concatenate function to the output of third substring function.

Regards,

Ravi

praveenreddy_bk
Participant
0 Kudos

Hi , Ravi,

CAN u explain in Detail

Shabarish_Nair
Active Contributor
0 Kudos

what ravi meant is instead of going for a code using UDF you can use the standard functions available in XI like substring and concat to acheive the same logic.

http://help.sap.com/saphelp_nw04/helpdata/en/43/c4cdfc334824478090739c04c4a249/content.htm - see the Function Category: Text

Former Member
0 Kudos

Hi,

Using substring function get DD, MM, and YY . For this you need to use substring function three times.

Then you need to concatenate them to get the target string. As the concatenate function takes only two input. You need to use this function twice.

Regards,

Shweta.

Former Member
0 Kudos

Hi Praveen,

Pls close the thread if you got resolution and provide points for helpful ones.

Thanks

Hamja

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi,

You can do it as simple as follows using standard date transformation.

source pattern: give yyyy-dd-MM ..ignore T and rest of that..though it is coming from source.

Target pattern: give ddMMyy manually ..thats it..no need to use any other functions.

Thanks

Hamja

former_member200962
Active Contributor
0 Kudos

if i am not wrong praveen is searching for an UDF becoz the format YYYY-MM-DDTHH:MM:SS+HH:MM is not a static and he will be getting varying format....so with standard functions will cause problem..

Shabarish_Nair
Active Contributor
0 Kudos

>

> 1) This is structure

> YYYY-MM-DDTHH:MM:SS+HH:MM to DDMMYY

> Here T stands for Time Begin

>

> Plz I need UDF for this .

if you input is a

then your UDF will be something like,

return (a.substring(8,9) + a.substring(5,6) + a.substring(2,3));

these are easily handles by the java string class... you can always refer that for your further developments - http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html#substring(int,%20int)

Former Member
0 Kudos

HI,

Use substring and concatenate standard function to get the target string.

No need for UDF.

Regards,

Shweta.

madanmohan_agrawal
Contributor
0 Kudos

Praveen Says..

YYYY-MM-DDTHH:MM:SS+HH:MM to DDMMYY

You do not need any UDF for this.

Use standard function "TransformDate" and create your own pattern in source strcuture and the target structure is a simple one.

Regards,

Madan Agrawal