04-10-2008 5:09 PM
If some ABAP expert here give a sample code on how to convert a date type of BUDAT value (like 01/01/2006) to a YYYYMM (200601) NUMC 6 value, that would be great <REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Apr 10, 2008 12:14 PM
04-10-2008 5:15 PM
data: date type sy-datum,
new_date(6) type c.
date = sy-datum.
concatenate date+0(4) date+4(2)
into new_date.
write:/ new_date.
Greetings,
Blag.
04-10-2008 5:15 PM
data: date type sy-datum,
new_date(6) type c.
date = sy-datum.
concatenate date+0(4) date+4(2)
into new_date.
write:/ new_date.
Greetings,
Blag.
04-10-2008 5:16 PM
Hi!
Try FM DATUMSAUFBEREITUNG; I think it'll meet your needs.
Best!
Jim
04-10-2008 5:18 PM
hi jim runkle,
Could you give the example code on how to run the function you suggested?
Thanks alot!
04-10-2008 5:18 PM
Hi Kevin,
Try this
REPORT ychatest MESSAGE-ID zz.
DATA : v_date TYPE budat,
v_numc(6) TYPE n.
v_date = '20060101'.
v_numc = v_date+0(4).
WRITE : / v_date , v_numc.
04-10-2008 5:19 PM
do something like this
data: ydate(10) type c,
fdate(6) type c.
ydate = pdate.
CONCATENATE ydate6(4) ydate3(2) into fdate.
write: fdate.
04-10-2008 5:27 PM
Here ya go ....
report sdn.
data: l_tdat6(08) type c.
call function 'DATUMSAUFBEREITUNG'
exporting
idate = sy-datum
importing
tdat6 = l_tdat6
exceptions
datfm_ungueltig = 1
datum_ungueltig = 2
others = 3.
if sy-subrc <> 0.
break-point.
endif."subrc
break-point.
04-10-2008 5:53 PM
Hello Kevin-
Below is the piece of code.
data:v_m(2) type c, "**Month
v_y(4) type c, "** Year
v_str type string." ** new string.
v_m = sy-datum+4(2).
v_y = sy-datum+0(4).
concatenate v_y v_m into v_str.
Cheers,
~Srini...