Skip to Content

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

No records selected - SELECT clause with IN

Hello ABAP Experts

1st CASE:

When I execute program below and leave selection screen for S_VBELN and S_ERDAT blank and leave P_AUART to 'PR00", it returns SY-SUBRC = 4.

I get no lines returned.

2nd CASE:

If I comment out the last 2 lines in my "WHERE" clause of my SELECT, so now my select statement is like this:

select vbeln erdat auart knumv from vbak into table gt_vbak

where vbeln in S_VBELN.

and leave selection screen for S_VBELN and S_ERDAT blank and leave P_AUART to 'PR00",

I get lines. I can even enter a specific order and it will only return that one.

Can someone explain why my SELECT statement in CASE 1 is not working?

REPORT YTEST4.

tables: vbak.

SELECT-OPTIONS: S_VBELN for VBAK-VBELN,

S_ERDAT for VBAK-ERDAT.

PARAMETERS: P_AUART like vbak-auart default 'PR00' obligatory.

data: begin of gt_vbak occurs 0,

vbeln like vbak-vbeln,

erdat like vbak-erdat,

auart like vbak-auart,

knumv like vbak-knumv.

data: end of gt_vbak.

START-OF-SELECTION.

select vbeln erdat auart knumv from vbak into table gt_vbak

where vbeln in S_VBELN

and erdat in S_ERDAT

and auart = P_AUART.

loop at gt_vbak.

write:/ gt_vbak-vbeln, gt_vbak-erdat, gt_vbak-auart, gt_vbak-knumv.

endloop.

Tags:
Former Member
Former Member replied

Hi Leal,

There is no Sales Document Type(VBAK_AUART) with PR00 as standard one. So, you will not get any entries for 1st Case. PR00 is the condition type but not the sales document types. I think it is OR rather than PR00. You can refer V0V8 to find the list of sales document types and refer V/06 to find the list of conidition types.

You are getting records in the 2nd case because you are querying on list of sales orders.If they exist then it will give the list of sales order which exist in the select-option list.

Thanks,

Vinay

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question