In my script I address a table
  T[Product hierarchy positions sorted ascending by name]
When you change the sorting order the table name is
  T[Product hierarchy positions sorted descending by name]
How can I handle this in my script?

You can use an abbreviated table name:
T[Product hierarchy positions.]
or you can use the technical table name instead.