Wednesday, December 28, 2011

USING OOABAP FETCHING DATAS FROM DB TABLE


*&---------------------------------------------------------------------*
*& Report  YSAP_CLASS_INTERNAL_TABLES
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  YSAP_CLASS_INTERNAL_TABLES.

tables: pa0002.

PARAMETERS: pernr type pa0002-pernr.

types: begin of stru,
       pernr type pa0002-pernr,
       vorna type pa0002-vorna,
       nachn type pa0002-nachn,
       end of stru.

class parentclass definition.
  PUBLIC SECTION.
  methods: display.
  data: itab type table of stru,
        wtab type stru.
  endclass.

  class parentclass implementation.
    method display.
      SELECT * from pa0002 into CORRESPONDING FIELDS OF TABLE itab where pernr eq pernr.
        loop at itab into wtab.
          write: / wtab-pernr,
                 / wtab-vorna,
                 / wtab-nachn.
          endloop.
          endmethod.
          endclass.

     start-of-selection.

     data: parent type REF TO parentclass.

     create OBJECT: parent.

     call method parent->display. 


 


 

No comments:

Post a Comment