on 09-28-2013 4:34 PM
Hi Gurus ,
I am Working on webdynpro application . User entering date in formate mmddyyyy . I want to convert it in ddmmyyyy . there is any way to convert it .
I want to mention .
1. I can,t use offset for this .( This is restricted ) .
2. Fm date_convert_to_internal not working for this. i have checked already .
3. Fm date_convert_to_external not working for this. i have checked already .
Thanks in Advance .....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Devesh,
If u dont want to use offset then check with below things.
1)
Use the FM <b>/SAPDMC/LSM_DATE_CONVERT</b>.
Pass DATE_IN = 10/16/2005
DATE_FORMAT_IN = DMDY
TO_OUTPUT_FORMAT = BLANK
TO_INTERNAL_FORMAT = X
OUTPUT
DATE_OUT = 20051016
2)
* Convert date 1/3/9999 into 99990301
CALL FUNCTION 'CONVERSION_EXIT_SDATE_INPUT'
EXPORTING
input = w_inputfile-endda
IMPORTING
output = w_inputfile-endda.
* Convert date 99990301 into 01/03/9999
CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
EXPORTING
input = w_inputfile-endda
IMPORTING
output = w_inputfile-endda.
3)
http://scn.sap.com/thread/1030380
Check above ways, will done.
Regards
Farooq
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
try this code.
DATA:
lv_input TYPE dats, "Input. (yyyymmdd)
lv_output TYPE string, "Output. (DD/MM/YYYY)
lv_date1 TYPE char2,
lv_date2 TYPE char2,
lv_date3 TYPE char4,
lv_len TYPE i.
lv_input = sy-datum.
" Here i am giving today's date means sy-datum
provide today's date. Here you can give input like 20130930 means (30.sept.2013)
lv_len = strlen( lv_input ).
" here we are handling some error. Suppose you gave input less then 8 char.
lv_output = lv_input.
IF lv_input IS NOT INITIAL .
IF lv_len EQ 8.
CLEAR lv_output.
lv_date3 = lv_input+0(4). " Here we are finding year
lv_date2 = lv_input+4(2). " Here we are finding Month
lv_date1 = lv_input+6(2). " Here we are finding day
" Here we are Concatenating all day month and year.
CONCATENATE lv_date1 lv_date2 lv_date3 INTO lv_output SEPARATED BY '/'.
Write: Lv_output.
CLEAR : lv_date3, lv_date2,lv_date1.
ENDIF.
ENDIF.
**************************************************************************************************************
One small concept you need to learn. Rest of all Example you can do by yourself.
Let my LV_date is type dats(Char8). And input is coming like yyyymmdd.
Now make a lv_date_new type string which will keep modified date.
data:
lv_year type char4,
lv_month type char2,
lv_day type char2,
lv_date_new type string.
lv_day = lv_date+6(2).
" In the statement we are fetching data from lv_date start with 6th character and next 2 character.means we will start from M to DD. so now lv_day will carry DD. so now you can fetch month lv_date+4(2) and year lv_date+0(4) with same concept.
"now concatenate your all data day month year separated by . or / or -
lv_month = lv_date+4(2).
lv_year = lv_date+0(4).
concatenate lv_day lv_month lv_year intolv_date_new. ddmmyyyy.
concatenate lv_day lv_month lv_year into lv_date_new separated by '/' . dd/mm/yyyy.
BR
ChanS
p.s.: For more information
FUNCTION MODULE FOR CONVERTING DATE INTO THE GIVEN FORMAT - Code Gallery - SCN Wiki
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.