Skip to Content
0
Jan 13, 2017 at 08:24 PM

cl_salv_table display failing Strangely Based Upon Data source.

1517 Views

Hi All,

I'm running into an oddity where depending on how the table I'm passing to cl_salv_table=>factory is populated with data, the following call to the alv->display( ) method fails to display an alv table with no error thrown.

Here's a condensed sample, in one method the internal table ct_com_stock is filled via a local class (yes, I know that editing a global table with a local class is not ideal). when go_alv->display() is called no alv is displayed with this method. If I populate the structure manually and not with the class the go_alv->display() method will display the manually added entries in alv. I do not believe this is data related as the data populated from the class is pulled directly from the mska table.

TYPES: BEGIN OF t_com_stock,
         matnr TYPE mska-matnr,
         werks TYPE mska-werks,
         vbeln TYPE mska-vbeln,
         posnr TYPE mska-posnr,
         lgort TYPE mska-lgort,
         kalab TYPE mska-kalab,
       END OF t_com_stock.
DATA: ct_com_stock    TYPE STANDARD TABLE OF t_com_stock.

  DATA cl_excess_com_list TYPE REF TO excess_com_list.
  CREATE OBJECT cl_excess_com_list. "local class which populates ct_com_stock, using this will cause the alv to not display

"populate ct_com_stock manually using only this to populate works for being displayed on the alv.
  DATA(wa_com_stock) = value t_com_stock( matnr = 'H' vbeln = '15544' posnr = '10' lgort = '4' kalab = '5' werks = '0500' ).
  APPEND wa_com_stock TO ct_com_stock.
  wa_com_stock = value t_com_stock( matnr = 'WIP-CONFIG-80-2' vbeln = '0000001894' posnr = '000010' lgort = 'ZTRL' kalab = '1.000' werks = '0500' ).
  APPEND wa_com_stock TO ct_com_stock.

  TRY.
      CALL METHOD cl_salv_table=>factory
        IMPORTING
          r_salv_table = go_alv
        CHANGING
          t_table      = ct_com_stock.
    CATCH cx_salv_msg.
      MESSAGE `Unable to build Field Catalog` TYPE 'E'.
  ENDTRY.

  go_alv->display( ).

In both scenarios ct_com_stock is populated with data that looks correctly formatted. Can give me any suggestions on why this might be occurring? No error is thrown by the display method or the underlying REUSE_ALV function.