‎2008 Feb 06 8:29 PM
Hi Experts,
I have a variable 'var_date1' in which I am passing the current date , and sending the same to a file.
data : begin of itab occurs 0,
var_date1 type sy-datum,
end of itab.
itab-var_date1 = sy-datum.
append itab.
clear itab.
itab-var_date1 = sy-datum - 1.
append itab.
clear itab.
My question is I want the date in internal table in the format MM/DD/YYYY.How to achieve this.What is the synax.
Regards,
Vishnu.
Edited by: Alvaro Tejada Galindo on Feb 6, 2008 4:03 PM
‎2008 Feb 06 8:33 PM
data : date(10),
date = sy-datum.
year = sy-datum(4).
month = sy-datum+4(2).
day = sy-datum+6(2).
concatenate month day year into lv_date seperated by '/'.
condense lv_date.
‎2008 Feb 06 8:38 PM
Hi Jay,
Is there any direct way to do this instead of hard coding.( Like edit mask or something?
Vishnu
‎2008 Feb 06 8:41 PM
‎2008 Feb 06 9:56 PM
edit mask wont work for ur requirement..
check the documentation F1 of mask.... it might help you.. for future..
‎2008 Feb 06 8:38 PM
Your date variables are all of type sy-datum which is 8 bytes. You cannot squeeze 10 bytes into an 8 byte field.
Rob
‎2008 Feb 06 8:39 PM
Ur input is DD.MM.YYYY.format .Then check this..
Ex.
DATA: V_INPUT(10) VALUE '06.02.2008'.
DATA: V_OUTPUT(10).
CONCATENATE V_INPUT3(2) '/' V_INPUT(2) '/' V_INPUT6(4)
INTO V_OUTPUT.
WRITE: / V_OUTPUT.
‎2008 Feb 06 8:46 PM
Hi Vishnu,
data : v_date(10).
write sy-datum to v_date dd/mm/yyyy.
add your required date format,
like dd/mm/yyyy or mm/dd/yyyy or any other.
Regards,
Ali
‎2008 Feb 07 4:00 AM
Hi,
Use like:
DATA : BEGIN OF itab OCCURS 0,
var_date1 TYPE dats,
END OF itab.
itab-var_date1 = sy-datum.
APPEND itab.
CLEAR itab.
itab-var_date1 = sy-datum - 1.
APPEND itab.
CLEAR itab.
LOOP AT itab.
WRITE:/ itab-var_date16(2), ' / ' , itab-var_date14(2), ' / ' , itab-var_date1+0(4) .
ENDLOOP.
Regards,
Renjith Michael.