Tuesday, April 9, 2013

SELECT AND DISPLAY SAP TABLE CONTENTS

Program to SELECT AND DISPLAY SAP TABLE CONTENTS

Example 1

REPORT  ZG15.

"Internal table declaration
DATA: it TYPE EKPO.

WRITE:/1 'Item' color 5,9 'Short Text' color 5,17 'Order Quantity' color 5,
      27 'Price Unit' color 5,39 'Price Date' color 5.

"Data retrieval
SELECT * FROM EKPO INTO it UP TO 10 ROWS.

  WRITE:/1 it-ebelp, 9 it-txz01,
        17 it-menge,27 it-peinh,
        39 it-prdat.
ENDSELECT.


Example 2


REPORT  ZGO1.
DATA:
  gs_saplane TYPE MSEG,
  gt_saplane TYPE TABLE OF MSEG.

SELECT * FROM MSEG INTO TABLE gt_saplane.

LOOP AT gt_saplane INTO gs_saplane.
  WRITE: /
    gs_saplane-MATNR,
    gs_saplane-DMBTR,
    gs_saplane-WAERS.
ENDLOOP.
EXIT.

No comments:

Post a Comment