Application Development 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: 

Format MM/YY for date

Former Member
0 Kudos

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

and not dd.mm.yyyy.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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

9 REPLIES 9

Former Member

Hi Mally,

use

concatenate sy-datum+4(2)

'/'

sy-datum+2(2)

into lv_date

Regards

Arun

Former Member
0 Kudos

Z0_CONVERT_DATE

REWARD if HELPFULL.

Former Member
0 Kudos

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

don't forget to reward

Sameer

Former Member
0 Kudos

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

Former Member
0 Kudos

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'....???

0 Kudos

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

Former Member
0 Kudos

use this:

CALL FUNCTION '/BEV4/PLPS__ADD_MONTH_TO_DATE'

reward if useful

anju

Former Member
0 Kudos

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

Former Member
0 Kudos

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.