The normal way to read the keypad is
set pins connected to A,B,C,D as input with internal pull up,
set pins connected to 1,2,3 as output and low state.
then read which one of A,B,C or D is not 1 anymore, a button in this line is pressed, you have found the line pressed
To find the row apply high to row 1 , if the grounded pin is no longer 0 then the row 1 was pressed
if not apply high to row 2 , if the grounded pin is no longer 0 then the row 2 was pressed
if not apply high to row 3 , if the grounded pin is no longer 0 then the row 3 was pressed or you can assume it was that one since it wasn't one of the other two.
You either have a problem with your code or it is a problem with the internal pull ups (i think your chip has open drain outputs).
You can connect 4 pull up resistors (10K) from Vcc to A,B,C and D and try again.
Alex