SHANGHAI'S foreign exchange division has announced that non-financial institutions will not be allowed to handle foreign exchange transactions in the city. A spokesman for the division said the decision was prompted by investigations which showed Hongkong-based companies in Shanghai had carried out foreign-exchange transactions in the city. He said the companies had not registered with either the industrial and commerce department or the forex and tax department in Shanghai. By paying a deposit in Hongkong, customers of these companies would have their transactions carried out and executed in the Shanghai offices of the Hongkong companies. The spokesman pointed out that the Hongkong companies' ''illegal'' forex activities in Shanghai had seriously affected the normal practices of the financial market of the city. The foreign exchange division in Shanghai has called for a halt to the activities, saying they would be stopped.