How do I set a value in an SAP table on a screen?

Use Set command

Set cell[Table name, Column name (or index), row name (or index)] "Value"

Example:
Set cell[Table, 1,1] "ABC" //Set 1st column and 1st row in the Table named as Table with Value ABC

Similarly,
Set cell[Table, Material,&[idx]] "&[row_val]"
Set value of GuiXT variable row_val in a Table row represented by index "idx" column with Title Material