02-18-2014 6:13 AM
Hi All, Here in Write Statement I only need to chage DDMMYY with DD/MM/YYYY, but one question, as BLDAT taking 8 char and DD/MM/YYYY will take 10 char so in internal table data declaration while declaring bldat need to put like: DATA: t_dat(10) LIKE BSID-BLDAT. Pls suggest me as code is alo attached. Thanks and Regards Sankil
02-18-2014 6:26 AM
Hi Sankil,
Write a code like below.
PARAMETERS: P_DATE TYPE MKPF-BUDAT.
DATA: DATE1(8) TYPE C.
WRITE P_DATE TO DATE1 DDMMYY.
WRITE DATE1.
Arivazhagan S
02-18-2014 6:31 AM
Date separators depend upon the user parameters maintained in transaction SU3.
However if you want to display date always as DD/MM/YYYY, than you can try something like this
DATA : LV_DATE TYPE CHAR10.
CONCATENATE sy-datum+6(2) sy-datum+4(2) sy-datum+0(4) into LV_DATE
SEPARATED BY '/'
Thanks, Abhinab
02-18-2014 6:37 AM
HI sankil,
You just want to write the date right ??
Try writing the write statement as this ,
data: date type BSID-BLDAT.
WRITE: date USING EDIT MASK '__/__/____'.
Regards,
Sivaganesh.
02-18-2014 6:38 AM
Check this example...
DATA : v_date(10) TYPE c,
i_date(8) TYPE c,
day(2) TYPE c,
month(2) TYPE c,
year(4) TYPE c,
result(12) TYPE c.
i_date = 201213.
day = i_date+1(2).
month = i_date+3(2).
year = i_date+5(2).
year = year + 2000.
concatenate day '/' month '/' year into v_date.
WRITE v_date.
02-18-2014 6:39 AM
Hi Sankil Pandiya,
SAP standard format is DDMMYYYY like this only.. while printing or writing it will become DD.MM.YYYY . if you need to print as your desired format mean you have to code little bit.
Consider:
DATA: date TYPE sy-datum .
data: date_new(10).
date = sy-datum.
CONCATENATE date+6(2) '/' date+4(2) '/' date+0(4) INTO date_new.
WRITE : DATE_NEW .
let me know after facing the same problem.
Regards,
Thangam.P
02-18-2014 6:51 AM
hi sankil
BSID-BLDAT is a DATS type variable.
for DATS the input length is 8 but the output length is 10. so you dont have to make any changes in the declaration. it will automatically print in DD/MM/YYYY format.
for test purpose you can try this piece of code.
TABLES:
BSID.
PARAMETERS:
p_date TYPE BSID-BLDAT.
write:/ p_date.