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

Selection help

Former Member
0 Likes
397

Dear Experts,

I have made a select statement as follows :

In selection Parameter so_coken - is values L1,j1,j2,j3,j4,j5,j6..

SELECT cobk~belnr cobk~kokrs cobk~gjahr cobk~perab cobk~perbi cobk~vrgng coep~sgtxt
  INTO CORRESPONDING FIELDS OF TABLE gt_cobk
  FROM cobk INNER JOIN coep
  ON cobk~kokrs = coep~kokrs AND cobk~belnr = coep~belnr
  WHERE cobk~kokrs IN so_kokrs
  AND cobk~vrgng IN so_vrg  AND cobk~gjahr = p_gjahr
  AND cobk~perab = p_period AND cobk~perbi = p_period
  AND cobk~stflg = '' AND cobk~stokz = ''
  AND coep~sgtxt+0(2) IN so_coken.


But now there is a change so that the entries in the field COEP~Sgtxt looks like

L1testsegment
J1testsegment
J2testsegment and so on.

So I need only the first 2 letters from this field.How can i modify my select statement.
I tried to change it like in the select statement coep~sgtxt+0(2) IN so_coken.But its not working.

Thanks
K

1 ACCEPTED SOLUTION
Read only

former_member209818
Active Contributor
0 Likes
348

Fathima,

I believe Offset in the Select Query is not possible. You will need to select the data from the table and then apply a loop to filter-out the records based on your need. Maximum, you can tweak the last cond a below

AND coep~sgtxt IN so_coken

And Contents of  so_coken as below

L1*

J1*

J2* .. and on..

This will redude the number of entries but still Loop is needed

1 REPLY 1
Read only

former_member209818
Active Contributor
0 Likes
349

Fathima,

I believe Offset in the Select Query is not possible. You will need to select the data from the table and then apply a loop to filter-out the records based on your need. Maximum, you can tweak the last cond a below

AND coep~sgtxt IN so_coken

And Contents of  so_coken as below

L1*

J1*

J2* .. and on..

This will redude the number of entries but still Loop is needed