Application Development 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: 

how to seperate a word

Former Member
0 Kudos

hi gurus

i am new to abap . i am writing a functional module for our req. In that importing element value is 'USRAMAN' , i need to seperate 'US' and 'RAMAN' and to store in different data fields .

8 REPLIES 8

Former Member
0 Kudos

Please refer this....

data : a(2) type c,

b(5) type c,

c(6) type c. "imported parameter in ur case.....

c = 'USRAMAN'.

a = c+0(2).

b = c+2(5).

Former Member
0 Kudos

Use SPLIT or

data: data(2),

obj(8).

data = element(2). -


it will have US

obj = element+2(8). -


it will have RAMAN

reward if useful

Former Member
0 Kudos

Hi Arumugam,

Use offset to separate words.

Take two variabels V1 and V2,and, do as follows.

DATA: V1(2) TYPE C,

V2(5) TYPE C.

V_DATA = 'USRAMAN'.

V1 = V_DATA+0(2).

V2 = V_DATA+2(5).

Thanks,

Vinay

Former Member
0 Kudos

HI arumugam,

As for as i have understood.

create 2 char like

lets say variable (doubt) having value 'USRAMAN'.

data: country(2),

name(5).

country = doubt+0(2).

name = doubt+2(5).

like this you can sseperate a word into two diffrent variables.

reward if usefull.....

former_member404244
Active Contributor
0 Kudos

Hi,

try like this

data : name(10) type c,

name1(10) type c,

name2(10) type c.

name = 'USRAMAN'.

v_name1 = name+0(2).

v_name2 = name+2(5).

REGARDS,

Nagaraj

0 Kudos

hi guys

thanks for a immediate response.

i my case first 'US' will remain static for all the cases . but next user name is a dynamic one . it can be like this

USRAMAN

USRAJAGOPAL

USRANGANATH

0 Kudos

then do like this...

data : text1(2),

text2(20),

text3(25) value 'USRANGANATH'.

text1 = text3+0(2).

text2 = text3+2.

write : / text1, text2.

regards

shiba dutta

Former Member
0 Kudos

u can split usraman as following:

data: v_name(7) type c value 'USRAMAN',

v_first(2) type c,

v_second(5) type c.

v_first = v_name+0(2).

v_second = v_name+2(5).

write: v_first,

v_second.

pls reward points if useful.