Hello Nazih,
I found this info in the documentation How to Customize your Ajax Framework Page with SAP NetWeaver Portal 7.30 (which should in this case be good for your 7.31, too):
The SAP logo image has internal transparent spacing. If the new image does not have this kind of spacing, add about 8 pixels (4 pixels for bottom padding and 4 pixels for top padding) for spacing. If your image has transparent spacing, change the height of the logo bar to the height of your image plus a few more pixels (about 4 pixels should be enough).
Maybe this is your problem, too?
Also I remember reading somewhere, that you can work with css-code in the theme editor, too. Try giving your margin in the "Repetition of Background Image"-property.
I never tried this myself, so I don't know if this works.
Regards,
Steffi.