Hi Shkelqim,
Please make sure you have declared
DATA: grid1 TYPE REF TO CL_GUI_ALV_GRID
and Create an object corresponding to this object reference by,
CREATE OBJECT grid1.
then call the method grid1->set_table_for_first_display then it should work fine.
Please try this and let me know. If you are fine with this please mark the thread as answered and close it.
Happy Coding,
Santhosh Yadav