RFC Connection Error

Logon Connection Error
Error Details Error when opening an RFC connection (CPIC-CALL: 'ThSAPOCMINIT' : cmRc=27 thRc=2
Error Details ERROR: timeout during allocate
Error Details LOCATION: SAP-Gateway on host xxxxxxxxxx/xxx02
Error Details DETAIL: no connect of TP sapdp04 from host xxxxxxxxxx.xxxx.xxx after 20 s
Error Details COMPONENT: SAP-Gateway
Error Details COUNTER: 144

Error Details MODULE: D:/depot/bas/741_REL/src/krn/si/gw/gwr3cpic.c
Error Details LINE: 2161
Error Details RETURN CODE: 242
Error Details SUBRC: 0
Error Details RELEASE: 741
Error Details TIME: Thu Jan 14 12:28:21 2016
Error Details VERSION: 2



Check the port number is open in the Both system

you have to open the port 33xx in windows firewall and if your are having external firewall you should open there also

check for the open gateway use T-code SMGW

you problem ill be solved 

Error when opening an RFC connection (CPIC-CALL: 'ThSAPOCMINIT' : cmRc=27 thRc=2

ERROR: timeout during allocate