cancel
Showing results for 
Search instead for 
Did you mean: 

Conversion for String to Date?

Former Member
0 Kudos

Hi

I need to convert string to date in message mapping.. i have used function datetransform..but doesn't work?

my sourse string format yyyy-MM-dd

target date format is: yyyyMMdd

2. how do i map following exammple in message mapping?

i need to map two (soruce) fields to target 1 filed..

while i'm doing this 2nd mapping only happening..

Source :

-


ReceivedDate(string)

LastDate (string)

Target

-


BUDAT (date)

Regardss..rambarki

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi rambarki,

for coverting a string to date i think this link may help you

http://www.experts-exchange.com/Programming/Programming_Languages/Java/Q_20946815.html

regards

jithesh

Former Member
0 Kudos

Thanks for your suggestions.

I'm just hang on my server reboot, while i'm trying to implemenet all your ideas..!

right now my requirement like this only ..two source string fileds mapping traget date fieild, while coming to production we may change to fileds datatypes..

and i tried initially using datetrans function, in properties i have changed format accroding to my req. but while i'm testing its gave me error date not convertble..also let me know length sould be same for source and target fields..because i haven't mentioned length..!

and SAP date field generally containing date only, but in my source filed having date and time also ..should i truncate the time while i'm mapping the field..?

Thanks once again..

Regards..rambarki

Former Member
0 Kudos

Hi,

<b>let me know length sould be same for source and target fields</b>

Yes i guess, i wrote for the length also in my post

<b>in my source filed having date and time also ..should i truncate the time while i'm mapping the field..?

</b>

Yes, Source -->Trim DateFunction -->Target

But make sure the length are correct before and after trim,

The Trip function that is standard Trip's white space, here i guess you can use this logic:

1.Take the input as date and time.

2.Use substring to get the date only.

3.Map to the target.

User defined functions:

http://help.sap.com/saphelp_erp2005/helpdata/en/2c/2d8c4024d26e1de10000000a1550b0/frameset.htm

Regards,

Anirban.

Former Member
0 Kudos

Thanks guys got solved my problem..

Its really appreciate for sharing your ideas.

DateTrans form function resolved my problem.

Regards..rambarki

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi Rambarki,

You can still use the DateTrans funciton. click on the date and time format. There are two boxes. In the second box you can get the time format also. Similarly you can go for the receiver side also. Hope this will solve your problem.

Thanks and Regards

Vishal Kumar

bhavesh_kantilal
Active Contributor
0 Kudos
Former Member
0 Kudos

Hi

for converting we have to write userdefined function and Transform date

in the mapping

source->userdefinedfunction->TransFormDate->Target

go to the properties of the TransFormdate and change the target format

in the userdefined function use the following code

String x="";

x = a.substring(0,4)"/"a.substring(5,7)"/"a.substring(8,10);

return x;

Regards

Jayaraman

Former Member
0 Kudos

Hi Umashankar,

Are both the source fields are received date,last date goin to contain the same date?.

If yes, then you can compare dates using compare date function and then DateTransform it into target.

Is there any condition applied on the date i.e the earlier of both or vice versa should go into target?????

otherwise you can always go for user defined function.

Regards,

Rashmi.

Former Member
0 Kudos

hi,

use DateTrans :-

Converts date format I to another date format O.use in message mapping and from context menu --properties do:

source format :yyyy-mm-dd

destination format:yyyymmdd.

with the correct length,

http://help.sap.com/saphelp_erp2005/helpdata/en/43/c4cdfc334824478090739c04c4a249/frameset.htm

Regards,

Anirban.

Former Member
0 Kudos

Hi Rambarki,

Try using standard DateTrans function.

Have a look at this thread..

Regards

Anand

Former Member
0 Kudos

Hi Rambarki,

I think you need to duplicate the target date field.

Just right click on that and say duplicate.

Then you can go for mapping.

ReceivedDate ---> DateTrans ---> BUDAT

LastDate ---> DateTrans ---> BUDAT (duplicated)

In the DateTrans you can specify the required transformation.

Hope this solves your problem.

regards,

Raju