2009 Jan 13 3:47 AM
Hello Experts,
I have a date format of lets say DDMMYY and the value is 051208 and I want to be shown as
0 5 1 2 0 8. How can I do this?
Thank you guys and take care!
2009 Jan 13 4:16 AM
Hi... Iu2019m again here with code what I explained in my previous reply.
data: v1 type c,
v2 type c,
v3 type c,
v4 type c,
v5 type c,
v6 type c,
v7 type c,
v8 type c,
v_final(16) type c.
v1 = sy-datum+0(1).
v2 = sy-datum+1(1).
v3 = sy-datum+2(1).
v4 = sy-datum+3(1).
v5 = sy-datum+4(1).
v6 = sy-datum+5(1).
v7 = sy-datum+6(1).
v8 = sy-datum+7(1).
concatenate v1 v2 v3 v4 v5 v6 v7 v8
into v_final
separated by space.
write:/30 v_final.
hope this is useful to u.
have a good day.
regards,
KP.
Hello Experts,
I have a date format of lets say DDMMYY and the value is 051208 and I want to be shown as
0 5 1 2 0 8. How can I do this?
Thank you guys and take care!
2009 Jan 13 4:09 AM
Hi...
First move that whole 8 digits into 8 character variables of length 1.
Then concatenate all 8 character separated by space.
2009 Jan 13 4:16 AM
Hi... Iu2019m again here with code what I explained in my previous reply.
data: v1 type c,
v2 type c,
v3 type c,
v4 type c,
v5 type c,
v6 type c,
v7 type c,
v8 type c,
v_final(16) type c.
v1 = sy-datum+0(1).
v2 = sy-datum+1(1).
v3 = sy-datum+2(1).
v4 = sy-datum+3(1).
v5 = sy-datum+4(1).
v6 = sy-datum+5(1).
v7 = sy-datum+6(1).
v8 = sy-datum+7(1).
concatenate v1 v2 v3 v4 v5 v6 v7 v8
into v_final
separated by space.
write:/30 v_final.
hope this is useful to u.
have a good day.
regards,
KP.
2009 Jan 13 5:01 AM
hi,
try this code..
data: v_dat(8) type c,
v_dat1(8) type c,
v_dat2(8) type c,
v_date(20) type c.
data : n type i.
v_dat = '051208'.
n = 0.
do 6 times.
v_dat1 = v_dat+n(1).
concatenate v_date v_dat1 into v_date separated by space.
n = n + 1.
enddo.
write : v_date.
regards
vijay
2009 Jan 13 4:17 AM
Hi,
[https://forums.sdn.sap.com/click.jspa?searchID=20867683&messageID=6630591]
[https://forums.sdn.sap.com/click.jspa?searchID=20867683&messageID=6764114]
Edited by: Neha Thukral on Jan 13, 2009 5:18 AM
2009 Jan 13 5:11 AM
Hi,
use concatenate in your code this will create a space
for ex:
concatenate v_date6(2) v_date3(2) v_date+0(2) into v_date1.
Regards,
Anand
2009 Jan 13 5:34 AM
Hi,
You can use shift for that.
DATA: w_dat TYPE sy-datum.
DATA: w_txt TYPE char16.
DATA: w_len TYPE i,
w_ind TYPE i VALUE 1.
w_dat = sy-datum.
w_txt = w_dat.
w_len = strlen( w_txt ).
DO w_len TIMES.
SHIFT w_txt+w_ind RIGHT. "This will give you the space required
ADD 2 TO w_ind.
ENDDO.
WRITE: w_txt.Hope this helps you.
Regards,
Manoj Kumar P
2009 Jan 13 7:42 AM
Hi just check this code snippet also.
DATA date TYPE d.
DATA a TYPE string.
DATA c TYPE i.
DATA d TYPE c.
DATA e TYPE i VALUE 0.
DATA str TYPE string.
date = sy-datum.
a = date.
c = STRLEN( a ).
DO c TIMES.
d = a+e(1).
e = e + 1.
WRITE d.
ENDDO.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |