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

problem in select statement

Former Member
0 Likes
1,650

Hi,

Could u pls tell me what is the error here

select * from lfa1 into table lt_lfa1 where lifnr in s_lifnr.

if sy-subrc = 0.

*processing

endif.

Here my sy-subrc is 4 while debugging.

could u suggest me pls.

15 REPLIES 15
Read only

Former Member
0 Likes
1,611

hi Salil,

Checkc out whether there exists any record for the selection screen entry in LFA1 table using SE11 or SE16 T-Code ..

Regards,

Santosh

Read only

Former Member
0 Likes
1,611

Can you check via transaction SE16 if you have any entries for the Vendors in the selection criteria???

Kind Regards

Eswar

Read only

Former Member
0 Likes
1,611

Hi Salil,

Instead of using *,select the necessary fields.

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
1,611

Hi,

Check in db table(use SE16),the value you are providing for s_lifnr in selection screen exists in table.

Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
1,611

Hi,

If sy-subrc is 4 then there is no data for the condition you are checkiing for.

That can only be the problem with your query. As it seems ok with syntax.

Regards,

Sesh

Read only

Former Member
0 Likes
1,611

Hi Salil ,

I feel there must be no data for your set of input.

Regards

Arun

Read only

anversha_s
Active Contributor
0 Likes
1,611

hi salil,

1 ) check ur data base , that any data is avialable.

2) check ur where condition.

your statement is syntactically correct

rgds

anver

Read only

Former Member
0 Likes
1,611

Hi salil

Is the given LIFNR is valid? i mean ur ilfnr number is stored in the database? pls check and run, no problem in ur query, just check ur input

Read only

0 Likes
1,611

in db table there is record.

i don't know why it is happened. While debugging I found the value of sy-subrc = 4.

In se16 while executing the db table for same criteria (as mentioned in where clause) there is some value.

Could u pls suggest me.

Read only

0 Likes
1,611

Hi Salil ,

Could you please tell how you have declared s_lifnr.

Regards

Arun

Read only

0 Likes
1,611

Salil

Have u declare like below?

SELECTION-SCREEN BEGIN OF BLOCK Pur_Blk WITH FRAME.

SELECT-OPTIONS: s_lifnr FOR ekko-lifnr,

SELECTION-SCREEN END OF BLOCK Pur_blk.

select single name1 into vennam from lfa1

where lifnr = s_lifnr and

spras = 'EN'.

write 😕 vennam.

Try this, may eb a small problem in that. What is the value passed in ur s_lifnr field while debugging?

Read only

anversha_s
Active Contributor
0 Likes
1,611

hi,

try this.

Loop at s_lifnr. " Selection Filed

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = s_lifnr-LOW
IMPORTING
output = s_lifnr-LOW.


CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = s_lifnr-HIGH
IMPORTING
output = s_lifnr-HIGH.
Modify s_lifnr index sy-TABIX.


ENDLOOP.

select * from lfa1 into table lt_lfa1 where lifnr in s_lifnr.

if sy-subrc = 0.

*processing

endif.

rgds

Anver

Read only

Former Member
0 Likes
1,611

Hello,

The SELECT statement sets sy-subrc to 4 if the result set is empty, that is, if no data was found in the database.

Regards,

Shehryar Dahar

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
1,611

Hi,

Try to enter the same lifnr value in both the selection screen and SE16.

If it has zero's before numeric value,enter as it is in database.

If you are entering 16 and if db table contains 00..16,then sy-subrc eq 4.

Read only

Former Member
0 Likes
1,611

Hi,

check your database table.

just send the complete code...s

Thanks

Vikranth Khimavath