Skip to Content

cl_salv_table display failing Strangely Based Upon Data source.

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Jan 16, 2017 at 01:58 PM

    That's what I assumed too, but bizarrely doesn't seem to be the case. In the debugger I deleted all the rows but 1 in the return from cl_excess_com_list and exported that row to excel. I then continued with the single row and per usual the display call did not create an alv. I then removed the call to cl_excess_com_list and manually inserted the same row via append and it worked just fine.

    EDIT - So I believe I've solved the issue. I apologize for not including this, but the class was calling another program via submit and return and retrieved the alv output from that program to compare and remove data from my existing data set. I guess there were some residual alv calls/data that prevented my alv from displaying. I ended up doing a

    CALL METHOD cl_salv_bs_runtime_info=>clear_all which resolved the issue.

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 14, 2017 at 09:46 AM

    If the data object is declared identically in both scenarios, then it's obvious only its content can explain the different behavior. You should compare the content of the internal table in both scenarios to see what is different. I think the easiest way is to create a second internal table, fill both of them using the two scenarios and compare them via the debugger compare tool; change the manual filling until you get the exact same content as the one you get from cl_excess_com_list (so, you should better get the smallest data set from this class, otherwise that would be exhausting!)

    Add comment
    10|10000 characters needed characters exceeded