2
votes

I am trying to create an ALV report with list display but some of the contents are not displaying in the output list. I created a classical report and an ALV report with grid display and I was successful. But this list display is creating a problem.

I've included the REUSE_ALV_LIST_DISPLAY function, with the right internal table name. I've debugged and all my data is coming in the final internal table correctly but it is not displaying in output list:

enter image description here

Here is my code (note that the flight demo data is to be generated via the program SAPBC_DATA_GENERATOR, once):

REPORT ztest.

SELECT scarr~carrid, spfli~connid
  FROM scarr INNER JOIN spfli ON scarr~carrid = spfli~carrid
  INTO TABLE @DATA(it_f).

DATA(it_fcat) = VALUE slis_t_fieldcat_alv(
  ( tabname   = 'SCARR'
    fieldname = 'CARRID'
    seltext_l = 'Carrier code'
    col_pos   = 1
    outputlen = 20 )
  ( tabname   = 'SPFLI'
    fieldname = 'CONNID'
    seltext_l = 'Connection ID'
    col_pos   = 2
    outputlen = 20 ) ).

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
  EXPORTING
    it_fieldcat = it_fcat
  TABLES
    t_outtab    = it_f.
2
It seems that all columns with TABNAME = 'ZINT_PRS_MST' have the issue, even "First name" which displays a weird value (maybe it's because it appears like a key ALV column). Did you try to change it? By the way, why don't you use the class CL_SALV_TABLE in List mode, so that to avoid defining the ALV catalog?Sandra Rossi
Thank you sandra. The situation is I am a complete noob in abap and I dont know how to do it. Could you please guide me. Thank you.Rupali Singh
There are many examples in the web, including references to SAP demo programs.Sandra Rossi
I used the class CL_SALV_TABLE in list mode and it worked. Thank you so much. But my question is why REUSE_ALV_LIST_DISPLAY function module not working.Rupali Singh
Apart CL_SALV_TABLE, I also gave a big clue that you didn't see, I guess. I could move it to an answer though.Sandra Rossi

2 Answers

2
votes

In a simple ALV table, you don't have to fill the component TABNAME of the field catalog. TABNAME is only needed for the hierarchical-sequential lists (function module REUSE_ALV_HIERSEQ_LIST_DISPLAY for instance) which are an output of two tables.

If you omit it, or if you give the same value (any value) for all columns, you will get a correct output:

enter image description here

Code with the correction:

SELECT scarr~carrid, spfli~connid
  FROM scarr INNER JOIN spfli ON scarr~carrid = spfli~carrid
  INTO TABLE @DATA(it_f).

DATA(it_fcat) = VALUE slis_t_fieldcat_alv(
  ( " do not fill TABNAME // tabname   = 'SCARR'
    fieldname = 'CARRID'
    seltext_l = 'Carrier code'
    col_pos   = 1
    outputlen = 20 )
  ( " do not fill TABNAME // tabname   = 'SPFLI'
    fieldname = 'CONNID'
    seltext_l = 'Connection ID'
    col_pos   = 2
    outputlen = 20 ) ).

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
  EXPORTING
    it_fieldcat = it_fcat
  TABLES
    t_outtab    = it_f.
-2
votes

EDIT: I see that you two already solved the problem in comments.

As Sandra wrote, you could try using cl_salv_table. It should look like this:

  cl_salv_table=>factory(
*  EXPORTING
*    list_display   = if_salv_c_bool_sap=>true
*    r_container    =
*    container_name =
    IMPORTING
      r_salv_table   = DATA(lr_alv)
   CHANGING
      t_table        = it_f
  ).

  lr_alv->display( ).