2008 Feb 08 7:56 AM
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
2008 Feb 08 8:07 AM
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
2008 Feb 08 8:09 AM
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
2008 Feb 08 8:10 AM
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.
2008 Feb 08 8:11 AM
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.
2008 Feb 08 8:18 AM
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