Application Development and Automation 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: 
Read only

How to split a string?

Former Member
0 Likes
978

Hi,

I have a variable to type string whose value is 20080328. Now i want display the output in the format 28032008?

Regards,

Asha

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
951

hi Asha,

Do this way ...


data :v_date(10) type c value '20080328',
v_date1(10) .

Concatenate v_date+6(2) v_date+4(2) _date+0(4) into v_date1.


write : v_date1. 

8 REPLIES 8
Read only

Former Member
0 Likes
951

hi,

Please find the below example .....

DATA:   v_date TYPE c LENGTH 10.

WRITE sy-datum TO v_date.

This will do ur job simple... no need to split string....

All the very best....

Regards,

Sreenivasa sarma K.

Edited by: sharmashree kashi on Mar 28, 2008 5:13 PM

Read only

Former Member
0 Likes
951

concatenate v_date6(2) v_date4(2) v_date+0(4) into

v_date1.

Read only

Former Member
0 Likes
951

CONCATENATE DATE+2

DATE+2(2)

DATE+(4)

INTO FN_DATE.

Read only

Former Member
0 Likes
951

z1 = lz_string(4).

z2 = lz_string+4(2).

z3 = lz_string+6(2).

concatenate z3 z2 z1 into lz_string2.

Read only

Former Member
0 Likes
952

hi Asha,

Do this way ...


data :v_date(10) type c value '20080328',
v_date1(10) .

Concatenate v_date+6(2) v_date+4(2) _date+0(4) into v_date1.


write : v_date1. 

Read only

former_member210123
Active Participant
0 Likes
951

write sydatum to g_date mm/dd/yyyy.

This should work.

If u want to know how to split then here it is

SPLIT wa_data-data AT tab

INTO:

wa_item-ind2

wa_item-posnr

wa_item-matnr

wa_item-kwmeng

wa_item-pstyv

wa_item-werks.

Here tab is tab operator.

if u want you can do offset also. like this g_date+2(2).Which will give u the months.

Read only

Former Member
0 Likes
951

Hi,

Check this piece of code.


data: v_var type string value '20080328'.

concatenate v_var+6(2) v_var+4(2) v_var(4) into v_var.

write: v_var.

Reward points if it helps.

Reagrds.

Abhisek.

Read only

Former Member
0 Likes
951

hi,

20080328.

WRITE: w_str+6(2).

w_str+4(2).

w_str+0(4).

or u can also store into a string

wstr0(2) = w_str6(2).

wstr2(4) =w_str4(2).

wstr4(4)=w_str0(4).

it will do

regards,

priya