alv custom control oop button

https://www.youtube.com/watch?v=mSoLu2lNGtY&list=PLmajIBPiks10AfFiWB-w_xXoTcDFTqKtN&index=4


*&---------------------------------------------------------------------*
*& Report ZJI_OO_ALV
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ZJI_OO_ALV.

dataobj_ccont type ref to cl_gui_custom_container,
      obj_alv type ref to cl_gui_alv_grid.

call screen 200.
*&---------------------------------------------------------------------*
*& Module STATUS_0200 OUTPUT
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
MODULE status_0200 OUTPUT.
 SET PF-STATUS 'MENU'.
* SET TITLEBAR 'xxx'.

datait_alv type lvc_t_fcat,
  wa_alv type LINE OF lvc_t_fcat.


data it_mara type table of sflights.




    select from sflights into TABLE it_mara.

wa_alv-tabname 'it_mara'.
wa_alv-fieldname 'carrid'.

APPEND wa_alv to it_alv.
clear wa_alv.

wa_alv-tabname 'it_mara'.
wa_alv-fieldname 'CITYFROM'.

APPEND wa_alv to it_alv.
clear wa_alv.

  " create ref for cust cont
  CREATE OBJECT obj_ccont
    EXPORTING
      container_name              'CUSTCONT'.

  " create ref for cl gui alv grid
CREATE OBJECT obj_alv
  EXPORTING
    i_parent          =  obj_ccont.

"display alv
CALL METHOD obj_alv->set_table_for_first_display
 EXPORTING
    i_structure_name              'SFLIGHTS'
  CHANGING
    it_outtab                     it_mara
*   it_fieldcatalog               = it_alv
*    it_sort                       =
*    it_filter                     =
.

ENDMODULE.


*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0200  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_0200 INPUT.
data okcode_200 type sy-ucomm.
IF  okcode_200 'EXIT'.
  LEAVE PROGRAM.
ENDIF.

ENDMODULE.

Comments

Popular posts from this blog

sap abap import from excell to table (transparent table)

sap abap Import from excell to internal table that works 100%