on 06-26-2008 8:32 AM
Hello,
we have the following problem. We have an inputField connected to a context attribute with the date type. When you use the datepicker, and when default dates are shown, the date is in the format DD.MM.YYYY (which is the correct format for our locale).
However, the user can also enter a date without using the datepicker. When he/she enters a date in the format DD-MM-YYYY, SAP automatically thinks this is a date in a different locale, and switches the DD values with the MM values. So, in reality, when a user enters the date with '-', SAP turns it into MM.DD.YYYY. How can I make sure that doesn't happen? I only want the user to be able to enter in DD.MM.YYYY, or not enter anything at all, and only use the datepicker.
To give you specific examples: The correct date would be 12.06.2008 (12th of june 2008). When a user enters 12-06-2008 SAP changes the date to 06.12.2008 (6th of december 2008).
Gr,
Jaron
Well I assume that the problem is with the fact that DD-MM-YYYY is not a date format supported by ABAP. We have DD.MM.YYYY, MM/DD/YYYY, MM-DD-YYYY. Therefore there is no way for ABAP to differentiate between DD-MM-YYYY and MM-DD-YYYY - hence the situation you have occuring.
You could beat your end users into submission to get them to use the "correct" date format. Short of floggings, a programatic approach might be to create your own custom Date domain in the ABAP Data Dictionary. This would still be a date data type, but you can supply a custom Conversion Routine.
[http://help.sap.com/saphelp_nw70/helpdata/EN/cf/21ee19446011d189700000e8322d00/frameset.htm|http://help.sap.com/saphelp_nw70/helpdata/EN/cf/21ee19446011d189700000e8322d00/frameset.htm]
That is kind of drastic and will require some effort on your part - but it should be possible. Personally I prefer the idea of just torturing the end users.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi..
Internally SAP maintain the date as MM-DD-YYYY format. so considering this as a base format, you change all of your input, and handel the format internally.
in your case please write a fn to convert the date into mm-dd-yyyy, if you use date picker, you will automatically get the same format. you can use standred date cinversion procedure function for make it easy.
Kind regards
Satrajit.
Please allocate reward point if its helpful for you.
>
> Well I assume that the problem is with the fact that DD-MM-YYYY is not a date format supported by ABAP. We have DD.MM.YYYY, MM/DD/YYYY, MM-DD-YYYY. Therefore there is no way for ABAP to differentiate between DD-MM-YYYY and MM-DD-YYYY - hence the situation you have occuring.
>
> You could beat your end users into submission to get them to use the "correct" date format. Short of floggings, a programatic approach might be to create your own custom Date domain in the ABAP Data Dictionary. This would still be a date data type, but you can supply a custom Conversion Routine.
> [http://help.sap.com/saphelp_nw70/helpdata/EN/cf/21ee19446011d189700000e8322d00/frameset.htm|http://help.sap.com/saphelp_nw70/helpdata/EN/cf/21ee19446011d189700000e8322d00/frameset.htm]
>
> That is kind of drastic and will require some effort on your part - but it should be possible. Personally I prefer the idea of just torturing the end users.
I realise this is the problem I am having, but I would have thought SAP would throw me an error message, just like it does in the backend. I would suggest that whether it's in a web dynpro or in the backend, SAP would handle it the same way. That's the problem I have. So basically, based on the userprofile throw an error message if the date is in the wrong format, instead of trying to convert it to the right format.
>
> Yes.. I am sorry. I have mixed up with something else. it should be yyyy-mm-dd.
>
> regards
> Satrajit.
No the internal format isn't yyyy-mm-dd, it is as I said yyyymmdd. That's a pretty important distinction when you are telling someone to manually parse the data themselves from the internal format. Dates are stored as char 8 with no separation between the data segments.
Hi Frenk,
If the user is accessing WebDynpro application from portal then change in user admin of the portal change language from english US to english UK. In english UK date format is dd.mm.yyyy
If user has corresponding ECC login (generally in case of ESS)
then from user admin at ECC changes its default date format using transaction SU01
Thanks
Sameer
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
have you checked [this documentation|http://help.sap.com/saphelp_nw70/helpdata/en/46/f7bb3bde4369b5e10000000a114a6b/content.htm] for information on the different time formats?
Regards, Heidi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.