2007 Feb 19 2:41 AM
Hi All,
I need to create Date field (From and To) in the selection screen. The Date format should appear as YYYY-MM-DD.
I have defined this requirement as below.
select-options: s_date for sy-datum no-extension default sy-datum.
Due to above line, date is appearing in DD.MM.YYYY format.
How to code, so that date should appear in YYYY-MM-DD in the selection screen...????
Please Help me....
Regards
Pavan
Hi All,
I need to create Date field (From and To) in the selection screen. The Date format should appear as YYYY-MM-DD.
I have defined this requirement as below.
select-options: s_date for sy-datum no-extension default sy-datum.
Due to above line, date is appearing in DD.MM.YYYY format.
How to code, so that date should appear in YYYY-MM-DD in the selection screen...????
Please Help me....
Regards
Pavan
2007 Feb 19 2:49 AM
Hi,
Date format depends on the user settings so vary from user to user unless they are predefined by the Basis team and are blocked for user changes.
So as an alternative you may change the date after user enter it to your desired format, by that you can save your program against user profile changes.
You can smple do that by using WRITE statement with masking.
Regards,
Amit
Reward all helpful replies.
2007 Feb 19 2:50 AM
Pavan,
write below code.
DATA : WS_DATE like sy-datum.
select-options: s_date for sy-datum.
AT SELECTION SCREEN OUTPUT.
call function 'CONVERT_DATE_TO_INTERN_FORMAT'
exporting
datum = sy-datum
dtype = 'DATS'
IMPORTING
ERROR =
IDATE = ws_date.
MESSG =
MSGLN =
.
s_date-low = ws_date.
Pls. reward if useful
2007 Feb 19 3:15 AM
2007 Feb 19 3:17 AM
Pavan,
DATA : WS_DATE(10),
ws_day(2),
ws_mon(2),
ws_year(4).
tables : ADAA.
select-options: s_date FOR ADAA-ACTION.
INITIALIZATION.
ws_year = sy-datum+0(4).
ws_mon = sy-datum+4(2).
ws_day = sy-datum+6(2).
concatenate ws_year ws_mon ws_day into ws_date separated by '.'.
s_date-low = ws_date.
append s_date.
This is working fine.
Pls reward.
2007 Feb 19 3:21 AM
Hi Pavan,
You have to specify this in the user settings only.
Initialization u cant specify this.
Other than that if u want the same format to be used in the program u can convert that using the belwo code
v_month = fromdate-low+4(2).
v_year = fromdate-low+0(4).
v_days = fromdate-low+6(2).
CONCATENATE v_year '-' v_month '-' v_days INTO fromdate-low.And use whereevr needed but cant be shown in the screen.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |