select SINGLE prodid name from ztabprod INTO TABLEZTABPROD where prodid= ztabprod-prodid.
Loop at ztabprod.
ztabprod-prodid =ztabprod-prodid.
ztabprod-name = ztabprod-name
IF You are using table with header lines then no need to pass values again into same work area.
write : / ztabprod-prodid, ztabprod-name.
Endloop.
Get rid of programming practice of using table with header lines and confusing yourself.
If you use table and Work area declared separately then SAP compiler judge code error properly.
And please always use pretty printer and allow Indentation in pretty print settings.
That way code is more readable.