04-23-2010 3:19 PM
Hi ABAPers,
I had a question and hope you could give me an answer.
Here is it,
select single * into itab from VRMPA where MATNR in S_MATNR
This would return a single record into itab although it is not correct as there would be more than 1 incoming record and so it is not unique.
My question is
a. would the logic skip out when it hit the first record and would not process the second valid selection
OR
b. it would process all valid records and return only the last record processed
i need to know in order to improve the performance of the logic.
Thanks for the answer in advance.
04-23-2010 3:25 PM
When you do a select single, SAP will only retrieve 1 result, the first it encounters. So if you would have multiple material numbers in your select-option S_MATNR, only 1 of them will be in the result. The others are not further selected.
04-23-2010 3:25 PM
When you do a select single, SAP will only retrieve 1 result, the first it encounters. So if you would have multiple material numbers in your select-option S_MATNR, only 1 of them will be in the result. The others are not further selected.
04-23-2010 3:28 PM
The logic skip out when it hits the first record and record was placed in itab, in contrast to select single , select up to 1 rows will fetch all records corresponding to itab based on where clause, but places only first record in itab.
However, make sure that when u use select single *, better use all key fields in where clause as possible and it is not necessary to get data into ITAB, just get data into wa_itab as there is only one record will fetched using select single statement.
Thanks
RK
04-23-2010 3:33 PM
Hi,
Its very basic question lot of information available in Google
Checkout this link
http://www.sap-basis-abap.com/abap/difference-between-select-single-and-up-to-1-row.htm
Regards and Best wishes.
04-23-2010 3:37 PM
Hello Colin,
You would rather hit an F1 on SELECT SINGLE & read the SAP documentation which clearly states:
"If the remaining additions to the SELECT command select more than one line from the database, the first line that is found is entered into the resulting set"
Source: [http://help.sap.com/abapdocu_70/en/ABAPSELECT_CLAUSE_LINES.htm#!ABAP_ALTERNATIVE_1@1@]
04-23-2010 8:51 PM
Select single with an IN operator is simply nonsensical. You would write
. . . .where matnr eq <matnr parameter>.