In this paper, we investigate properties, characterizations and compactifications of almost periodic functions with values in a topological vector space. The techniques applied are based essentially on an analogue of a representation in Pettis-integration. Applications of the results to flows are indicated