On a more philosophical level, some developers say the former is better, because then if you, or a later developer needs a field, it is available. I disagree. In my view, the developer should always know what data he is dealing with, and should only specify that which he is actually using. To do otherwise, can lead to unexpected results. For example, a table with two fields whose names are very similar. E.g. txtln and txtnl. Perhaps you are only interested in txtln, and you define only that in your DATA statements, and specify the field in your SELECT. If you accidentally type txtnl, you will get a syntax error. However, if you use SELECT SINGLE *, you won't know, until your program starts behaving oddly. Many SAP field names are abbreviations of German words. Many are very similar to each other. This kind of error does happen!
The only times I would use SELECT SINGLE * are:
1. If I really do need all the fields
2. I need many fields from the table, and the danger of un-clear coding is greater than that of specifying unused fields.
3. You need the structure to work with SAP defined structures -- e.g. when using SAP function modules.
Dig Deeper on SAP Basis
Related Q&A from Matthew Billingham
An SAP user is trying to run a report in an SAP ALV Grid online and wants to know how to get the data in the report to appear along with the header. Continue Reading
An SAP user needs to transfer customer purchase order spreadsheet data to SAP VA01 to create a new sales order. Continue Reading
An SAP user needs information on how to change the password on several SAP user accounts from a central location. Continue Reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.