SELECT DISTINCT in SAP ABAP 7.4


Using Select Distinct to query distinct values from database with SAP ABAP 7.4


Example logic of using Select Distinct with ABAP 7.4

Select Distinct Before ABAP 7.4

TYPES: BEGIN OF ty_mtart,
           mtart TYPE mara-mtart,
         END OF ty_mtart.
  DATA: it_mtart TYPE TABLE OF ty_mtart,
        wa_mtart TYPE          ty_mtart.
START-OF-SELECTION.
  SELECT DISTINCT mtart FROM mara INTO TABLE it_mtart UP TO 5 ROWS.

  LOOP AT it_mtart INTO wa_mtart.
    WRITE:/ wa_mtart-mtart.
  ENDLOOP.

Select Distinct After ABAP 7.4

START-OF-SELECTION.
  SELECT DISTINCT mtart FROM mara INTO TABLE @DATA(it_mtart) UP TO 5 ROWS.

  LOOP AT it_mtart INTO DATA(wa_mtart).
    WRITE:/ wa_mtart-mtart.
  ENDLOOP.


Learner Questions

No Questions by learners, be first one to ask ..!!

    Please Sign in to ask a question


    Was this lesson helpful to you? Yes No 0 People out of 0 think this lesson helpful

    Lesson Navigation

    ←Previous Chapter
    Next Chapter →