SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software
Development resources, articles, tutorials, code samples, tools and downloads for SAP HANA and ABAP, HANA Database, SQLScript, SAP UI5, Screen Personas, Web Dynpro, Workflow

ABAP Code to Display SAP Table Contents


Here is a simple sample ABAP code and ABAP program source code which displays the contents of an SAP table on screen.

REPORT ZTEST_SAPLANE.

DATA:
  gs_saplane TYPE saplane,
  gt_saplane TYPE TABLE OF saplane.

SELECT * FROM saplane INTO TABLE gt_saplane.

LOOP AT gt_saplane INTO gs_saplane.
  WRITE: /
    gs_saplane-PLANETYPE,
    gs_saplane-SEATSMAX,
    gs_saplane-PRODUCER.
ENDLOOP.
EXIT.
Code

In the above ABAP code the SAP table SAPLANE is being used.
The ABAP code is making a selection using SELECT command in order to select table contents.
In the ABAP LOOP AT command, using the ABAP WRITE statement we display table contents one row at a time.
Table display in ABAP can be managed by similar codes in small SAP tables where table data is not causing too much LOOP.

abap-code-to-display-sap-table-contents-output





You can also limit the number of rows or number of SAP table lines by using the UP TO n ROWS syntax within SELECT ABAP code.
This is equal to SELECT TOP n syntax in T-SQL on SQL Server.

SELECT * FROM saplane
  INTO TABLE gt_saplane UP TO 3 ROWS.
Code


SAP HANA and ABAP

Install SAP Free
CRM Companies List
Web Based CRM Software


Copyright © 2004 - 2021 Eralper YILMAZ. All rights reserved.