Application Development 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: 

Select the data from table which inbteween as well as one field if satisfy

Former Member
0 Kudos

Tab1. entries are below

MANDT SLRNO BUKRS ORDNR FANLKL TANLKL

111 Ger 2 00110000 00110030

111 000013 Ger 1 00110000 00130000

111 000054 Ger 1 00110000 00130000

111 000055 Ger 2 00110000 00110030

111 000072 Ger 1 00110000 00130000

111 000073 Ger 1 00110000 00130000

111 000074 Ger 2 00110000 00110030

111 000075 Ger 2 00110000 00110030

111 000126 Ger 2 00160000 00160000

lv-assetclass = u201800110020u2019 this is and company code is the only values which I have.

which is inbetween 00110000 and 00110030

So my below select statement should always give me sy-subrc = 0.

select single FANLKL TANLKL

from Tab1

into (lv_var1, lv_var2)

where BUKRS = Lv_companycode

and ( FANLKL GE lv-assetclass and TANLKL LE lv-assetclass ).

if sy-subrc <> 0.

Codes are there.

Endif.

But it is giving sy-subrc = 4.So it satisfies the if statement and what ever the code part is there in ifu2026endif that is executed.

My requirement is if lv-assetclass is 00110000 or 00110030 or inbetween these two values 00110020 for all the sy-subrc = 0.Even 00120000 should also give me sy-subrc 0 as 6th line is having entry 00110000 00130000 and 00120000 is coming under this.it should give me Sy-subrc = 0 when I put lv-assetclass as 00110000 also.

Can any one help me out in his select statement.

Regards,

Partha

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Change your Select Query as:

select single FANLKL TANLKL

from Tab1

into (lv_var1, lv_var2)

where BUKRS = Lv_companycode

and ( FANLKL LE lv-assetclass and TANLKL GE lv-assetclass ).

1 REPLY 1

Former Member
0 Kudos

Hi,

Change your Select Query as:

select single FANLKL TANLKL

from Tab1

into (lv_var1, lv_var2)

where BUKRS = Lv_companycode

and ( FANLKL LE lv-assetclass and TANLKL GE lv-assetclass ).