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

URGENT

Former Member
0 Likes
784

hi experts,

m fetching awkey from table rbkp..in which length of awkey is longer n i have to fetch only first 10 characters of this field..how can i fetch 1st 10 characters out of them...

regards,

raman

hi experts,

m fetching awkey from table rbkp..in which length of awkey is longer n i have to fetch only first 10 characters of this field..how can i fetch 1st 10 characters out of them...

regards,

raman

5 REPLIES 5
Read only

former_member404244
Active Contributor
0 Likes
750

Hi,

First fetch the awkey field and then do like this

data : v_hawkey(10) type c.

now suppose u get the result in awkey.

v_hawkey = awkey+0(10)..

it will move 10 characters to v_hawkey..

Regards,

Nagaraj

Read only

Former Member
0 Likes
750

Use string operation for this type of issue..

First u retrieve the value from the DB..Then copy tht value in a string or char variable..

Then u can get first ten digits by using the technique given above..

REWARD IFUSEFUL

Read only

Former Member
0 Likes
750

Hi,

You can use the offset functionality for ur requirement, i.e extract the data from the database table and then remove the unwanted data frm that field by using offset.

Cheers,

Chaitanya.

Read only

Former Member
0 Likes
750

Hi,

There is no direct way to get first 10 characters of a field from database, which means when at the time of extrancting data from data base we can't retrieve offset values.

We can directly extract the actual data what reside in the database then need to do some process to get the required format of data.

Check the below code...

Loop at i_rbkp.

v_char10 = i_rbkp-awkey(10).

modify i_rbkp. "based on v_char10

endloop.

Rgds,

Bujji.

Read only

Former Member
0 Likes
750

hi,

here is the solution for ur Q.

data: lv_awkey type awkey.

lv_awkey = awkey + 0(10).

here 0 mean truncate length

10 mean display length

suppose awkey = "sapmodulepool".

so, lv_awkey = sapmodulep.

lv_awkey = awkey + 2(5).

the value of lv_awkey becomes "pmodu".

reward if helpful.

Regards

venkat