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 - OPTIONS?

Former Member
0 Likes
815

Hi Experts,

I hv code like,

Code 1:

SELECT SINGLE MATNR ARKTX INTO (VBAP-MATNR, VBAP-ARKTX) FROM VBAP WHERE VSTEL = P_VSTEL.

So,

I hv to change the selection criteria from Parameters(single value) to Select-options(range)!

Code 2:

SELECT SINGLE MATNR ARKTX INTO (VBAP-MATNR, VBAP-ARKTX) FROM VBAP WHERE VSTEL = S_VSTEL.

As I hv to put the heading as ''The Shipping Point is'' WA_S_VSTEL_NAME

I will sort by VSTEL.

So, pls. clarify that,

1- If I change simply the code from 1 to 2, Does it works? I mean, Is the SAP automatically, pulls the all selected shipping points MATNRS?

2 - Or I need to go for SELECT-OPTIONS table and there by, loading down all values from select options table to my_select_options_table and then writing the code/looping based one the values I moved from select-options table? like,

S_VSTEL( ) = my_select_options_table( ).

(S_VSTEL-LOW

S_VSTEL-HIGH

SIGN etc.)

ThanQ.

Message was edited by:

Sridhar

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
768

Hi,

So, Does SAP pulls all the records?

NO. SELECT SINGLE statement selects the first row in the database that it finds that fulfils the 'WHERE' clause.

If this results in multiple records then only the first one will be returned and therefore may not be unique.

Regards,

Ferry Lianto

6 REPLIES 6
Read only

Former Member
0 Likes
768

Hi,

Code 2:


SELECT SINGLE MATNR ARKTX INTO (VBAP-MATNR, VBAP-ARKTX) FROM VBAP WHERE VBELN = ITVBAK-VBELN AND POSNR = ITVBFA-POSNV
AND VSTEL = S_VSTEL.   " <-- Change here    

Please replace AND VSTEL = S_VSTEL with AND VSTEL IN S_VSTEL.

Regards,

Ferry Lianto

Read only

0 Likes
768

Ooops, sorry, in copying, this mistake happened!

yes, its IN operator.

So, Does SAP pulls all the records?

Read only

Former Member
0 Likes
768

Hi sridhar,

You have to change your code to:

SELECT MATNR ARKTX INTO table itab FROM VBAP WHERE VSTEL  in S_VSTEL.

itab must be declare as follows:

data: begin of itab occurs 0,

matnr type vbap-matnr,

arktx type VBAP-ARKTX,

end of itab.

Regards,

Ravi

Read only

Former Member
0 Likes
768

Hi Sridhar,

can you give us a bigger picture,

YOu are selection from VBAP table, which are actually sales order items, there will be many records for vbap for a single shipping point,.

You should pass the Sales Order number and Item nnumber to get unique records for each item.

Regards,

ravi

Read only

Former Member
0 Likes
769

Hi,

So, Does SAP pulls all the records?

NO. SELECT SINGLE statement selects the first row in the database that it finds that fulfils the 'WHERE' clause.

If this results in multiple records then only the first one will be returned and therefore may not be unique.

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
768

i am using select - option statement in dis way : -

SELECT-OPTIONS : PO_DATE FOR AUFK-ERDAT,

PO_TYPE FOR AUFK-AUART,

PO_CO_M FOR RESB-MATNR.

but i want to write po_date as PRODUCTION ORDER DATE , as i know d default value is 8 characters,i want to know the solution problem.plz help me its urgent.