Documente Academic
Documente Profesional
Documente Cultură
com
SAP Courses
SAP Tutorials
FAQ
Docs
My Account
SAPNuts
Tutorials
The below example code is used to get data based on a condition with all fields(columns) from
MARA table.
**Declare internal table
DATA : IT_MARA TYPE TABLE OF MARA.
* read data
SELECT * FROM MARA INTO TABLE IT_MARA WHERE MTART = 'FERT' .
Get specific number of rows (records) from a database table in SAP ABAP.
data : it_mara type TABLE OF mara.
**Get 50 rows form starting
select * FROM mara INTO TABLE it_mara UP TO 50 rows.
The below example is used to get distinct material type values from MARA table.
REPORT ZSAPN_SELECT_DISTINCT .
TYPES: BEGIN OF TY_MARA,
MTART TYPE MARA-MTART,
END OF TY_MARA.
DATA : IT_MARA TYPE TABLE OF TY_MARA.
DATA : WA_MARA TYPE TY_MARA.
The below is the example program of using orderby with select in SAP ABAP.
The above statement is educational purpose only, in your real-time projects don`t use SELECT
ORDERBY, it decreases performance of a program, instead use SORT after fetching data.SORT
<ITAB> ASCENDING/DESCENDING.
The below example will get all records from MARA where MATNR ends with 11.
REPORT ZSAPN_WILDCARDS.
The below example will get all records from MARA where MATNR starts 11.
REPORT ZSAPN_WILDCARDS.
DATA : IT_MARA TYPE TABLE OF MARA.
DATA : WA_MARA TYPE MARA.
SELECT * FROM MARA INTO TABLE IT_MARA WHERE matnr LIKE '11%'.
LOOP AT IT_MARA INTO WA_MARA.
WRITE:/ WA_MARA-MATNR.
ENDLOOP.
Previous Tutorial
Next Tutorial
Tutorial Comments
Total Comments: Add your Comment
Aabid
30 Apr 2014
Quite informative... Thanks for the tutorial.
suresh
06 May 2014
Hi , Can I get some full ALV Grid reports in SD , MM
Mir Nusrath ALi
15 May 2014
Cool examples, thanks for your effort.
kanaga
30 Jun 2014
Very useful to learn...thank you....:)
Aditya
14 Jul 2014
Hi Good examples. select statements should very carefully also. through secondary index
fetching should be also added here.
Leave a Comment
Your Name:
Your Email :
Comment Text :