As far as I know these part numbers do not exist -- PIC16F877A 20/P and PIC16F877A 4/P
All PIC16F877A chips have an internal 20MHz clock. The I/P or E/P variants designate Industrial or Extended temperature range PDIP chips only.
The PIC16F877 (note no 'A') do have more options as far as clock rate, specifically those you mentioned above at 4MHz or 20MHz.
Are you trying to use an 877A in the place of an 877 or vice versa?
PS: The datasheet has all of this information listed as well as being a convenient place to sort out potential problems.