Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Format MM/YY for date

Former Member
0 Likes
3,833

hi, i need to convert date format in screen field to be - MM/YY

and not dd.mm.yyyy.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,247

Check the following code... It may help u...


parameters:  w_date type d.

data:  w_my(5) type c.

write w_date to w_my using edit mask '__/__'.

write:/ w_my. 

Reward if helpful

Regards

Prax

hi, i need to convert date format in screen field to be - MM/YY

and not dd.mm.yyyy.

9 REPLIES 9
Read only

Former Member
2,247

Hi Mally,

use

concatenate sy-datum+4(2)

'/'

sy-datum+2(2)

into lv_date

Regards

Arun

Read only

Former Member
0 Likes
2,247

Z0_CONVERT_DATE

REWARD if HELPFULL.

Read only

Former Member
0 Likes
2,247

use 'write to .......... with edit mask' statement.

don't forget to reward

Sameer

Read only

Former Member
0 Likes
2,247

Hi,

u can check out this code.

data : yy(2) type c,

mm(2) type c.

data : c(8) type c.

parameters : p_date type sy-datum.

yy = p_date+2(2).

mm = p_date+4(2).

concatenate mm '/' yy into c.

write : / c.

Reward points if useful.

Thanks

Sudha

Read only

Former Member
0 Likes
2,247

first, thank u all for your answers...

i realize now that i wasn't so clear about my question..

i have a control table in the screen - in that table there's a date field

i found the appropriate data element of type MM/YYYY

but when i try to insert a string composed of this format - i get a message error that this format is worng...

i think that i need to change , in the attributes of the date field , the format (corrent format - DATS' - i also tried 'CHAR' and 'ACCP')

or to insert a value or text in the date field ... maybe something like '____,MM/YYY'....???

Read only

0 Likes
2,247

Hi,

please follow this procedure..

Go to screen->layout.

Get for dictionary PTDW_QUOT_DB-Kmonth.

This field will work the way you want

Reward if useful

Read only

Former Member
0 Likes
2,247

use this:

CALL FUNCTION '/BEV4/PLPS__ADD_MONTH_TO_DATE'

reward if useful

anju

Read only

Former Member
0 Likes
2,248

Check the following code... It may help u...


parameters:  w_date type d.

data:  w_my(5) type c.

write w_date to w_my using edit mask '__/__'.

write:/ w_my. 

Reward if helpful

Regards

Prax

Read only

Former Member
0 Likes
2,247

thank u for all your answer..

i "solved" the problem by checking the content of the field my self

IF p_start CA '/' AND p_end CA '/'.

SPLIT p_start AT '/' INTO lv_start_month lv_start_year.

SPLIT p_end AT '/' INTO lv_end_month lv_end_year.

IF lv_start_month BETWEEN 1 AND 12

AND lv_end_month BETWEEN 1 AND 12.

IF STRLEN( lv_start_year ) <> 4

OR STRLEN( lv_end_year ) <> 4.

MESSAGE w031(zpm_notif) .

  • Format Date needs to be - MM/YYYY

ENDIF.