You will need to enable dev console for Dragon Age 2 before you can use any cheat code in game.
How to Enable Dragon Age 2 (PC) Dev Console
To enable dev console, open “KeyBindings.ini” file in the “Users\[your name]\Documents\BioWare\Dragon Age 2\Settings” directory. Change the “OpenConsole_0=” line to “OpenConsole_0=Keyboard::Button_`”.
Right click on Dragon Age 2 shortcut, and click on “Properties”, and then add the “-enabledeveloperconsole” command line at end of the “Target” field. Make sure you add space before the command line.
Now, while playing Dragon Age 2, press ~ to open the console window. Once Dev Console is open, type any of these cheat codes and press enter for the desired effect.
Note. You will not see what is being typed and may need to press [Backspace] to remove the “`” character if it is present in the console window.
For Steam version of the game, Right-click the “Dragon Age 2″ option, and select “Properties” under the “My Games” Steam tab. In the “General” tab, select “Set Launch Options”, enter “-enabledeveloperconsole” in that field, and accept it.
While playing the game, press ~ to display the console window. Then, type one of the following codes and press [Enter] to activate the corresponding cheat function.
runscript addxp [number]
Add indicated amount of experience points
runscript addmoney [number]
Add indicated amount of copper
Heal player or party
Kill all enemies in area
Character animates a random finishing blow based on current weapon