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

offset as an arithematic expression

Former Member
0 Likes
734

Can anybody tell me whether i can use arithmetic expression in the place of offset of string.

Example:

SELECT rfltempl FROM TBANK_RFL_TEMPLT

INTO v_flowidext

WHERE

langu = 'E'

AND

descr+<b>( strlen( descr )- 4 )(4)</b> = v_bpa.

It is throwing a syntax error.

My intention is to get the last 4 characters as a char string so that i can compare this aganist another character string in a where clause of a select statement.

In the above example last 4 characters of descr char string should be compared agaist v_bpa char string.

Please help me it's urgent .

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
698

Hi

Dont do like this. This will affect system performance. Instead of this why dont u do it in internal table.

Select the values from internal table and put it in a internal table and do the offset process... that will be good for performance.

Reward me if its helpful.

Ravi.

6 REPLIES 6
Read only

Former Member
0 Likes
699

Hi

Dont do like this. This will affect system performance. Instead of this why dont u do it in internal table.

Select the values from internal table and put it in a internal table and do the offset process... that will be good for performance.

Reward me if its helpful.

Ravi.

Read only

0 Likes
698

hi thanks for ur reply.I have that solution with me. But i want to simplify the entire logic into a single select statement. Can you explain how the select statement causes performance issue? I think populating the data into internal table first and then processing the strings in a loop and then reading the internal table for the match will consume more time to execute. What do you say?

I am new to ABAP developement so please confirm me on using a arithmetic expression as an offset is permissible or not in ABAP.

Read only

Former Member
0 Likes
698

Hi Ashok,

Welcome to SDN

Use another variable as:

X = strlen( descr ).
X = X-4.
descr = descr+X(4)
SELECT rfltempl FROM TBANK_RFL_TEMPLT
INTO v_flowidext
WHERE
langu = 'E'
AND
descr = v_bpa.

Hope it solves your problem.

Reward if useful.

Thanks

Aneesh.

Read only

0 Likes
698

hi aneesh

You have not observed one thing descr is also a field of the table which is being queried in the select statement. I want to get the solution by using a single select statement. Thanks for your anticipation. Tell me can we do it using a single select statement.

Read only

0 Likes
698

Hi Ashok,

No Idea what so ever.

Regards

Aneesh.

Read only

Former Member
0 Likes
698

do like this...

data : pat(5).

concatenate '%' v_bpa into pat.

SELECT rfltempl FROM TBANK_RFL_TEMPLT

INTO v_flowidext

WHERE

langu = 'E'

AND

descr like pat.

regards

shiba dutta