sexta-feira, 15 de setembro de 2023

CL_GUI_ALV_GRID - TOP_OF_PAGE - CL_DD_DOCUMENT - METHOD ADD_TABLE

== GLOBAL VARIABLE
 DATA: o_split_dev       TYPE REF TO cl_gui_splitter_container,
           o_dyndoc_id       TYPE REF TO cl_dd_document,
           o_cont_dev_top    TYPE REF TO cl_gui_container,
           o_cont_dev_list   TYPE REF TO cl_gui_container.


=================================
=== > CREATE ALV
    o_alv_dev->set_table_for_first_display(
         EXPORTING
          "i_save =
             is_layout = ls_layout
             it_toolbar_excluding = lt_exc_toolbar
         CHANGING
             it_outtab  = t_dev
             it_fieldcatalog = lt_fcat
         EXCEPTIONS
             invalid_parameter_combination = 1
             program_error  = 2
             too_many_lines = 3 ).

    DATA(lo_alv_event) = NEW lcl_handle_events( ).
    SET HANDLER lo_alv_event->top_of_page FOR o_alv_dev.

    CREATE OBJECT o_dyndoc_id
      EXPORTING
        style = 'ALV_GRID'.
*
* Initializing document
    CALL METHOD o_dyndoc_id->initialize_document.
*
* Processing events
    CALL METHOD o_alv_dev->list_processing_events
      EXPORTING
        i_event_name = 'TOP_OF_PAGE'
        i_dyndoc_id  = o_dyndoc_id.

==================================================
==== > HANDLE METHOD TOP OF PAGE
  METHOD top_of_page.

    DATA lt_element TYPE sdydo_object_table.
    DATA lv_qtd_c TYPE sdydo_text_element .

    o_dyndoc_id->add_table(
    EXPORTING
    no_of_columns = 2
    IMPORTING
    table = DATA(lo_table)
    tablearea = DATA(lo_table_area) ).

    lo_table->add_column( EXPORTING width = '40%' IMPORTING column = DATA(lo_col1) ).
    lo_table->add_column( EXPORTING width = '60%' IMPORTING column = DATA(lo_col2) ).

    me->get_saldo_dev( ).

    lo_col1->add_text( text = 'Saldo do estoque'
                      sap_fontsize = cl_dd_document=>large ).

    WRITE gs_dev_cab-saldo_est TO lv_qtd_c.
    lo_col2->add_text( text = |{ lv_qtd_c ALIGN = RIGHT }| sap_fontsize = cl_dd_document=>large ).

    lo_table->new_row( ).

    lo_col1->add_text( text = 'Total Planejado'
                      sap_fontsize = cl_dd_document=>large ).

    WRITE gs_dev_cab-total_plan TO lv_qtd_c.
    lo_col2->add_text( text = |{ lv_qtd_c ALIGN = RIGHT }| sap_fontsize = cl_dd_document=>large ).

    o_dyndoc_id->merge_document( ).

    CALL METHOD o_dyndoc_id->display_document
      EXPORTING
        reuse_control = abap_true
        parent        = o_cont_dev_top.

  ENDMETHOD.

=========== OUTPUT 




Nenhum comentário:

Postar um comentário