09-09-2020 5:06 PM
Hi Experts,
So I am using FM_REUSE_ALV_GRID_DISPLAY to display the ALV data into my report output. The internal table that contains data to be displayed is not initial which means it actually has data(per debugging). However, 'No Data' is displayed in the ALV output. Sy-subrc after going through the FM is 0, so also no program error there.
Can you please point out what's wrong with my code? I have also tried using cl_salv_table but still 'No Data' is shown. Also, I have tried manually adding data by passing strings to lt_final and passed it to the FM instead of lt_results and it worked but if data is real data obtained from program processing, 'No Data' is displayed.
ls_final-hyper_team = 'LOGISTICS'.
ls_final-hyper_task = 'DDL'.
ls_final-results = 'THIS IS ONLY A TEST PLS'.
APPEND ls_final TO lt_final.
Below is only a snippet of my code I didn't show how lt_results was populated because it was only an exporting parameter from a class I also made but here's a screenshot from the debugger.
TYPES:
BEGIN OF ty_data,
hyper_team TYPE /txn/t_hyper_cls-hyper_team,
hyper_task TYPE /txn/t_hyper_cls-hyper_task,
results(300),
END OF ty_data.
DATA:
lt_results TYPE STANDARD TABLE OF ty_data
lt_final TYPE STANDARD TABLE OF ty_data,
ls_final TYPE ty_data,
DATA: lt_field_catalog TYPE slis_t_fieldcat_alv.
DATA: ls_field_catalog TYPE slis_fieldcat_alv.
ls_field_catalog-fieldname = 'HYPER_TEAM'.
ls_field_catalog-seltext_l = 'Team'.
APPEND ls_field_catalog TO lt_field_catalog.
ls_field_catalog-fieldname = 'HYPER_TASK'.
ls_field_catalog-seltext_l = 'Class'.
APPEND ls_field_catalog TO lt_field_catalog.
ls_field_catalog-fieldname = 'RESULTS'.
ls_field_catalog-seltext_l = 'Result'.
APPEND ls_field_catalog TO lt_field_catalog.
CALL FUNCTION 'FM_REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = lt_field_catalog
TABLES
t_outtab = lt_results
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc EQ 0.
"Do Nothing
ENDIF.
09-09-2020 8:22 PM
Hi Katherine,
Try to pass also the parameter below also:
i_callback_program = sy-repid
is_layout = s_layout (optional)
09-09-2020 8:43 PM
Why do you use this unsupported function module?
Instead, use REUSE_ALV_GRID_DISPLAY !
Anyway, you'd see that the following little program outputs something so the issue is a bug in your program:
REPORT.
SELECT * FROM t000 INTO TABLE @DATA(itab).
cl_salv_table=>factory(
IMPORTING r_salv_table = DATA(salv)
CHANGING t_table = itab ).
salv->display( ).
Or please explain in which context you obtain "no data".
(NB: you have maybe a default ALV layout variant with filter of rows which excludes all rows)
09-10-2020 6:08 AM
kdarunday,
Can you please explain how this No data error message is being displayed?
Check if there is any default layout assigned for the report and inspect the attributes of the layout if any.
As rightly suggested by Sandra, considering this is your test program kindly avoid using this FM.
Regards!
09-10-2020 7:02 AM
Hey, Katherine!
Have you tried populating the field "tabname" in the "ls_field_catalog"?
ls_field_catalog-tabname = 'LT_RESULTS'.
09-10-2020 10:28 AM
Hi Guilherme,
Already did but still same output 'No Data'.
Regards,
Kath
09-10-2020 8:45 AM
09-10-2020 10:33 AM
Hello kdarunday
I just tried, and the code works on my system. If the LT_RESULTS has records.
Are you 100% sure that the table you're providing for ALV has records?
Kind regards,
Mateusz
Edit: the image with "No data" message shows a Spool resulting page. How are you executing the report? In the background?
09-10-2020 11:23 AM
Hi Mateusz,
Yes, lt_results has records as can be seen in below screenshot.
I am actually executing it in background.09-10-2020 11:25 AM
09-10-2020 11:29 AM
Okay, and what happens if you run the report in foreground? Do you still get the "No data" message?
09-10-2020 7:03 PM
Yeah, according to mateuszadamus the code is fine. I also tried and it works.
Maybe the table isn't being filled when you execute it in background. As you said, the data comes in a exporting parameter from a class. The class maybe is returning no data in this case.
Are you debugging the report while executing in background?
I don't think the problem is the report, but the class that fetchs the data.
Regards,
09-10-2020 7:23 PM