Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

cl_gui_alv_grid - I get a blank screen

I seem to be having a problem with my screen. The issue is that I am using cl_gui_alv_grid to display an ALV. However, I call set_table_for_first_display, I get a blank screen. I have verified that I have data in the field cat, outtab, and sort tables. Any ideas?

SCREEN 2000

PROCESS BEFORE OUTPUT.
MODULE status_2000.
MODULE create_fieldcat.
MODULE create_obj.
MODULE call_alv.
*

PROCESS AFTER INPUT.
module user_command_2000.
 module exit at exit-command.

MODULE STATUS_2000 OUTPUT.
  SET pf-status '2000'.
  SET TITLEBAR '2000'.

ENDMODULE.                 " STATUS_2000  OUTPUT

*&---------------------------------------------------------------------*
*&      Module  CREATE_FIELDCAT  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE CREATE_FIELDCAT OUTPUT.

    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'PSPID'.
    wa_fieldcat-tabname = 'IT_CONTRACT'.
    wa_fieldcat-ref_field = 'PSPID'.
    wa_fieldcat-ref_Table = 'PROJ'.
    wa_fieldcat-KEY       = 'X'.
    APPEND wa_fieldcat TO it_fieldcat.

    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'POST1'.
    wa_fieldcat-tabname = 'IT_CONTRACT'.
    wa_fieldcat-ref_field = 'POST1'.
    wa_fieldcat-ref_Table = 'PROJ'.
    wa_fieldcat-KEY       = 'X'.
    APPEND wa_fieldcat TO it_fieldcat.

    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'SO_VALUE'.
    wa_fieldcat-coltext   = 'Sales Order Value'.
    wa_fieldcat-do_sum    = 'X'.
    APPEND wa_fieldcat TO it_fieldcat.

    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'BILLED'.
    wa_fieldcat-coltext   = 'Amount Billed'.
    wa_fieldcat-do_sum    = 'X'.
    APPEND wa_fieldcat TO it_fieldcat.

    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'NEBTR'.
    wa_fieldcat-coltext   = 'Cash Received'.
    wa_fieldcat-do_sum    = 'X'.
    APPEND wa_fieldcat TO it_fieldcat.

    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'DMBTR'.
    wa_fieldcat-coltext   = 'Retention'.
    wa_fieldcat-do_sum    = 'X'.
    APPEND wa_fieldcat TO it_fieldcat.

    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'PERCENT_BILLED'.
    wa_fieldcat-coltext   = 'Percent Billed'.
    wa_fieldcat-no_sum    = 'X'.
    APPEND wa_fieldcat TO it_fieldcat.

    CLEAR wa_sort.
    wa_sort-spos = '1'.
    wa_sort-fieldname = 'PSPID'.
    wa_sort-SUBTOT = 'X'.
    APPEND wa_sort TO it_sort.
ENDMODULE.                 " CREATE_FIELDCAT  OUTPUT

MODULE CREATE_OBJ OUTPUT.
  IF g_custom_container IS INITIAL.
    CREATE object g_custom_container
    EXPORTING
      container_name = 'CCONTAINER'.

    CREATE object grid
    EXPORTING
      i_parent = g_custom_container.

    CREATE object g_handler.

    SET HANDLER g_handler->top_of_page FOR grid.

  ENDIF.
ENDMODULE.                 " CREATE_OBJ  OUTPUT

MODULE CALL_ALV OUTPUT.

    CALL METHOD grid->set_table_for_first_display
    EXPORTING
*    i_buffer_active               =
*    i_bypassing_buffer            =
*    i_consistency_check           =
*    i_structure_name              =
*    is_variant                    =
*    i_save                        =
*    i_default                     = 'X'
*    is_layout                     =
      is_print                      = wa_print
*    it_special_groups             =
*    it_toolbar_excluding          =
*    it_hyperlink                  =
*    it_alv_graphics               =
*    it_except_qinfo               =
*    ir_salv_adapter               =
    CHANGING
      it_outtab                     = it_contract
      it_fieldcatalog               = it_fieldcat
      it_sort                       = it_sort
*    it_filter                     =
    EXCEPTIONS
      invalid_parameter_combination = 1
      program_error                 = 2
      too_many_lines                = 3
      OTHERS                        = 4
      .
    IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

Regards,

Davis

I believe the problem may be that I don't have the container in the attributes list of the screen. I am not sure why it isn't there.

Tags:
Former Member replied

Please check whether you created the custom container in screen 2000 as CCONTAINER?

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question