Skip to Content
author's profile photo
Former Member

Regarding oop's in ALV

hi

i've created a program using oop's in alv, but by taking only a single table.

just check this

REPORT ZMS_OOPS_ALV1.

tables: mara.

include <icon>.

***********CLASS DEFINITION***********

class i_mara definition.

public section.

data: itab type standard table of mara.

data: itab_final like line of itab.

methods: get_header,

get_mara.

endclass.

class i_mara implementation.

METHOD GET_HEADER.

WRITE:/1 SY-VLINE,

2'MATERIAL NUMBER' COLOR 6 inverse,

22 SY-VLINE,

23 'CREATED BY PERSON' COLOR 3 inverse,

41 SY-VLINE,

42 'CREATION DATE' COLOR 6 inverse,

56 SY-VLINE,

57 'DATE CHANGED' COLOR 3 inverse,

70 SY-VLINE,

71 'MODIFIED BY PERSON' COLOR 3 inverse,

90 SY-VLINE.

ULINE (90).

ENDMETHOD.

method get_mara.

select * from mara into table itab up to 10 rows.

*

*sort itab by matnr.

*

loop at itab into itab_final.

WRITE:/1 SY-VLINE,

2 ITAB_FINAL-MATNR COLOR 4 inverse,

22 SY-VLINE,

23 ITAB_FINAL-ERNAM COLOR 5 inverse,

41 SY-VLINE,

42 ITAB_FINAL-ERSDA COLOR 4 inverse,

56 SY-VLINE,

57 ITAB_FINAL-LAEDA COLOR 5 inverse,

70 SY-VLINE,

71 ITAB_FINAL-AENAM COLOR 4 inverse,

90 SY-VLINE.

endloop.

if sy-subrc = 0.

write: (5) icon_green_light.

endif.

uline.

endmethod.

endclass.

selection-screen begin of block b1 with frame.

select-options: s_matnr for mara-matnr.

selection-screen end of block b1.

data: ms_mara type ref to i_mara.

start-of-selection.

create object ms_mara.

call method: ms_mara->get_header,

ms_mara->get_mara.

************************************************************

but how can i create a report by using more than two tables

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • author's profile photo
    Former Member
    Posted on Aug 20, 2007 at 01:31 PM

    Hi,

    ya its a good practice.

    you can use more than one table also.

    in get data method u can write the code for getting the data from more than one table in the same way u did.

    <b>here u are just using oops concepts,u are not using OOALV.</b>

    rgds,

    bharat.

    Add comment
    10|10000 characters needed characters exceeded