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

read first 4 characters

Former Member
65,660

Hi All,

I have to read first 4 characters one variable

into other variable .

How to do this?

Thanks and Regards,

Amit.

1 ACCEPTED SOLUTION
Read only

varma_narayana
Active Contributor
18,605

Hi

Data : var(10) value 'AMERICA'.

WRITE:/ VAR(4). "this will give the first 4 chars

<b>Reward if helpful</b>

7 REPLIES 7
Read only

Former Member
18,605

Hi amit,

var2 = var1(4).

regards, Dieter

Read only

varma_narayana
Active Contributor
18,606

Hi

Data : var(10) value 'AMERICA'.

WRITE:/ VAR(4). "this will give the first 4 chars

<b>Reward if helpful</b>

Read only

former_member188827
Active Contributor
18,605

if its a type c vaariable den use:

suppose var2 is ur variable

var2 = var1+0(4).

if its not a type c variable den move it to a type c var

zvar(10) type c.

move var1 to zvar.

zvar = zvar+0(4).

plz reward points if dis helps

Message was edited by:

abapuser

Read only

Former Member
18,605

data var2(4) TYPE c.

Var2 = var1+0(4).

Where 0 is the offset and 4 is the length.

Reward if helpful.

Kartavya

Read only

0 Likes
18,605

Var2 = var1+0(4).

Can we set Var2 = var1+0(n).

n is any number or can we set it into dynamic number?

Read only

18,605

The guy was here 12 years ago, maybe he'll come back in 12 years...

Can't you read the ABAP documentation, or just try yourself?

Read only

Former Member
0 Likes
18,605

HI,

see this code.

data:var(10) type c value 'welcome'.

data:var1(4).

var1 = var.

write:/ var1.

rgds,

bharat.