Retrieve the data from the SAP database using the select statement and the where clause.
For database programming writing queries to retrieve the data from SAP database is essential. This is achieved with the help of the SELECT statement. There are various ways of writing the SELECT statement and we have given you a few examples below. The most essential part of the SELECT statement apart from the syntax is that the data should be selected as per the desired result. There should not be any redundancy also the efficiency of the query should be taken care of, that means the report should run quickly in the most efficient way without overloading the system.
Some examples of SAP - ABAP SELECT Statement.
SELECT * INTO wa FROM (name) CLIENT SPECIFIED WHERE mandt = '000'. WRITE: / wa-carrid, wa-carrname. ENDSELECT.
SELECT * INTO wa FROM scarr UP TO 4 ROWS. WRITE: / wa-carrid, wa-carrname. ENDSELECT.
For more examples pleas refer to SAP help click on the links given below.
Always use Pretty Printer and Extended Program Check before releasing the code.
Do not leave unused code in the program. Comment the code thoroughly. Align the comments and the Code. Follow the SAP Standards and SAP Best Practices guidelines. It’s a good practice to take a dump of the code on your local drive.