OOPS ABAP ALV PROGRAM USING CL_DD_DOCUMENT CLASS FOR TOP OF PAGE

*&---------------------------------------------------------------------*
*& Report  ZOOPS_LOGO
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

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

" CL_DD_DOCUMENT CLASS IS USED TO DISPLAY TOP OF PAGE AND LOGO"
************************************************************************REPORT zoops_logo.
INCLUDE zoops_logo_top.    " FOR DECLARATION
*&---------------------------------------------------------------------*
*&  Include           ZOOPS_LOGO_TOP
*&---------------------------------------------------------------------*
DATACONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
      DISPLAY 
TYPE REF TO CL_GUI_ALV_GRID.

DATAI_BSEG TYPE TABLE OF BSEG,
      W_BSEG 
TYPE BSEG
            " INTERNAL TABLE AND WORK AREA DECLARATION
DATALOGO TYPE REF TO CL_DD_DOCUMENT.
 " CL_DD_DOCUMENT IS THE CLASS USED TO DISPLAY LOGO'S AND TOP OF PAGE.

START-OF-SELECTION.

  
CALL SCREEN 200.     
 " CALL THE SCREEN AND CREATE A CONTAINER FOR BSEG AND LOGO CONTAINER

*&---------------------------------------------------------------------*
*&      Module  STATUS_0200  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE status_0200 OUTPUT.
*  SET PF-STATUS 'xxxxxxxx'.
*  SET TITLEBAR 'xxx'.
  
PERFORM create_objects.
  
PERFORM get_bseg.
  
PERFORM logo.
  
PERFORM display_bseg.
ENDMODULE.                 " STATUS_0200  OUTPUT
*&---------------------------------------------------------------------*
*&      Form  CREATE_OBJECTS
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM create_objects .
  
CREATE OBJECT logo 
 *  EXPORTING
*    style  =
*    background_color =
*    bds_stylesheet =
*    no_margins =
    
.

  
CREATE OBJECT container
    
EXPORTING
*     parent         =
      container_name 
'CONTAINER'
*     style          =
*     lifetime       = lifetime_default
*     repid          =
*     dynnr          =
*     no_autodef_progid_dynnr     =
*  EXCEPTIONS
*     cntl_error     = 1
*     cntl_system_error           = 2
*     create_error   = 3
*     lifetime_error = 4
*     lifetime_dynpro_dynpro_link = 5
*     others         = 6
    
.
  
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  
ENDIF.

  
CREATE OBJECT display
    
EXPORTING
*     i_shellstyle      = 0
*     i_lifetime        =
      i_parent         
= container   "GIVE CONTAINER NAME
*     i_appl_events     = space
*     i_parentdbg       =
*     i_applogparent    =
*     i_graphicsparent  =
*     i_name   =
*     i_fcat_complete   = SPACE
*  EXCEPTIONS
*     error_cntl_create = 1
*     error_cntl_init   = 2
*     error_cntl_link   = 3
*     error_dp_create   = 4
*     others   = 5
    
.
  
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  
ENDIF.
ENDFORM.                    " CREATE_OBJECTS
*&---------------------------------------------------------------------*
*&      Form  GET_BSEG
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM get_bseg .
  
SELECT FROM bseg
    
INTO TABLE i_bseg up to 300 rows .
ENDFORM.                    " GET_BSEG
*&---------------------------------------------------------------------*
*&      Form  LOGO
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM logo .
  
CALL METHOD logo->add_picture
    
EXPORTING
      picture_id 
'MY'" HERE THE CLASS IS CL_DD_DOCUMENT AND METHOD IS ADD_PICTURE
*     width      =
*     alternative_text =
*     tabindex   =
    
.
  
CALL METHOD logo->add_gap
    
EXPORTING
      width 
20   " HERE THE CLASS IS CL_DD_DOCUMENT AND METHOD IS ADD_GAP
*     width_like =
    
.
CALL METHOD logo->add_text
  
EXPORTING
    
text          'ACCOUNTING DOCUMENT SEGMENT'
*    text_table    =
*    fix_lines     =
*    sap_style     = cl_dd_document=>key
    sap_color       
=  cl_dd_document=>list_positive
*    sap_fontsize  =  "CLASS IS CL_DD_DOCUMENT AND METHOD IS ADD_TEXT
*    sap_fontstyle =
    sap_emphasis  
cl_dd_document=>strong*    
    style_class   =
*    a11y_tooltip  =
*  CHANGING
*    document      =
    
.
CALL METHOD logo->display_document
  
EXPORTING
*    reuse_control      =
*    reuse_registration =
    container          
'LOGO'"CLASS IS CL_DD_DOCUMENT AND METHOD IS DISPLAY_DOCUMENT*    parent             =
*  EXCEPTIONS
*    html_display_error = 1
*    others             = 2
        
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
ENDFORM.                    " LOGO
*&---------------------------------------------------------------------*
*&      Form  DISPLAY_BSEG
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM display_bseg .
CALL METHOD display->set_table_for_first_display
 
EXPORTING
*    i_buffer_active               =
*    i_bypassing_buffer            =
*    i_consistency_check           =
    i_structure_name              
'BSEG'
*    is_variant                    =
*    i_save                        =
*    i_default                     = 'X'
*    is_layout                     =
*    is_print                      =
*    it_special_groups             =
*    it_toolbar_excluding          =
*    it_hyperlink                  =
*    it_alv_graphics               =
*    it_except_qinfo               =
*    ir_salv_adapter               =
  
CHANGING
    it_outtab                     
I_BSEG
*    it_fieldcatalog               =
*    it_sort                       =
*    it_filter                     =
*  EXCEPTIONS
*    invalid_parameter_combination = 1
*    program_error                 = 2
*    too_many_lines                = 3
*    others                        = 4
        
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
ENDFORM.                    " DISPLAY_BSEG

output: