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

Select Query Problem

Former Member
0 Likes
593

Hi All,

I am having the following select query in the report

SELECT *

FROM zexc_rec INTO TABLE lt_docno

WHERE lifnr IN s_lifnr AND

docno IN s_docno AND

doctyp IN ('CT1','CT1C').

when the value of s_docno is blank , the query is not selecting any rows, I want in the case of blank s_docno ,it should select all the rows with that s_lifnr and any document no..

Please suggest what should be changed for that.

Thanks.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
567

Hi,

the query is correct but some times we may face some problem like this.

IF s_docno[] IS INITIAL.
SELECT *
FROM zexc_rec 
INTO TABLE lt_docno
WHERE lifnr IN s_lifnr AND
doctyp IN ( 'CT1', 'CT1C' ).
ELSE.
SELECT *
FROM zexc_rec 
INTO TABLE lt_docno
WHERE lifnr IN s_lifnr AND
docno IN s_docno AND
doctyp IN ( 'CT1', 'CT1C' ).

5 REPLIES 5
Read only

Former Member
0 Likes
567

hi,

Your query is correct. Check the DB table if there are entries for your selection criteria.

Regards

Subramanian

Read only

former_member404244
Active Contributor
0 Likes
567

Hi,

I don't see anything wrong in ur query.plz check if u have the table entries correctly..ur query is fine...as s_docno is a selectoption so thre shouldn't be

any problem...

Regards,

Nagaraj

Read only

Former Member
0 Likes
567

I dont see anything wrong in the query . please check there may be problem with the condition "<b>doctyp IN ('CT1','CT1C')</b> " .

Read only

Former Member
0 Likes
568

Hi,

the query is correct but some times we may face some problem like this.

IF s_docno[] IS INITIAL.
SELECT *
FROM zexc_rec 
INTO TABLE lt_docno
WHERE lifnr IN s_lifnr AND
doctyp IN ( 'CT1', 'CT1C' ).
ELSE.
SELECT *
FROM zexc_rec 
INTO TABLE lt_docno
WHERE lifnr IN s_lifnr AND
docno IN s_docno AND
doctyp IN ( 'CT1', 'CT1C' ).

Read only

Former Member
0 Likes
567

Rahul,

there might b no records in the table for this selection criteria. check it in se11.

..MB