For S7-400, three possible reasons:
1. like "L D[AR2,P#0.0]" says, you have to compress the memory.
You do this when you are online with the PLC and display the Module Information.
2. On some versions of S7-400, you have to plug a RAM memory card to utilise all the memory that the CPU can address.
3. Your program is too big to fit on the CPU. In the offline project, go to "blocks" in the project tree, right-click and open up the properties. You can see how much memory code and data take up. Add 20% to allow for HW Configuration and comms jobs.