Thursday, 17 January 2019
SAP ABAP - ALV Grid WIth Simple OOP Implementation
Define Internal table, work area & Selection screen :
tables : mara.
data: it_mara type table of mara,
wa_mara type mara.
select-options:
s_matnr for mara-matnr,
s_mtart for mara-mtart.
Define class & class implementation :
class mara_class definition.
public section.
methods: getmara.
methods: showalv.
endclass.
class mara_class implementation.
method getmara.
refresh it_mara.
select * from mara into table it_mara where matnr in s_matnr and mtart in s_mtart.
endmethod.
method showalv.
call function 'REUSE_ALV_GRID_DISPLAY_LVC'
exporting
i_callback_program = sy-repid
i_structure_name = 'MARA'
i_save = 'X'
tables
t_outtab = it_mara
exceptions
program_error = 1
others = 2.
endmethod.
endclass.
call class & method :
start-of-selection.
data: mara_class type ref to mara_class.
create object: mara_class.
call method: mara_class->getmara, mara_class->showalv.
Full source code :
report zoop01.
tables : mara.
data: it_mara type table of mara,
wa_mara type mara.
select-options:
s_matnr for mara-matnr,
s_mtart for mara-mtart.
class mara_class definition.
public section.
methods: getmara.
methods: showalv.
endclass.
class mara_class implementation.
method getmara.
refresh it_mara.
select * from mara into table it_mara where matnr in s_matnr and mtart in s_mtart.
endmethod.
method showalv.
call function 'REUSE_ALV_GRID_DISPLAY_LVC'
exporting
i_callback_program = sy-repid
i_structure_name = 'MARA'
i_save = 'X'
tables
t_outtab = it_mara
exceptions
program_error = 1
others = 2.
endmethod.
endclass.
start-of-selection.
data: mara_class type ref to mara_class.
create object: mara_class.
call method: mara_class->getmara, mara_class->showalv.
Run program :D
Subscribe to:
Post Comments (Atom)
ABAP CDS View Part 10 : Authorization & DCL untuk ABAP CDS
Authorization & DCL di ABAP CDS | Panduan Lengkap (PFCG, @AccessControl, DCL) Authorization & DCL untuk ABAP CDS — Pandua...
-
Pada postingan kali saya akan share sebuah aplikasi IT Asset management yang fungsinya untuk memonitoring semua Asset khusus IT, contohnya ...
-
How to Create a REST API in SAP ABAP — Step-by-step Guide Summary: This tutorial shows how to build a REST API in SAP ABAP by creating ...
-
CDS View dengan Join di SAP ABAP | Tutorial SAP S/4HANA CDS View dengan Join (Multi Table) Kalau di Episode 4 kita main di sing...
No comments:
Post a Comment