Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

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

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

Tags:
replied

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 ).

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question