Hi Suwandi,
there is also a third way: HTTP. If you choose a port of type "XML-HTTP" in the partner profile, the SAP system will send the IDoc to the third party via HTTP. The opposite direction (third party to SAP) is also possible. However, the external system needs to understand the IDoc-XML format.
A solution that I like most, especially if the external system cannot be modified easily and neither talks RFC nor HTTP, is to use the SAP Business Connector. This is a light-weigth middleware tool that can be registered at an RFC destination and then receives the IDocs. In the Business Connector with just a few clicks you can define a data mapping to map the IDoc data into any format that the external system understands and then send the data to the external system using a variety of protocols. For example HTTP, FTP, Email, MIME messages, SOAP and JDBC are supported out of the box, other protocols can easily be added with a bit of Java development.
The other direction (external to SAP) then works quite analogously: the external system passes its data to the Business Connector in any format and via any channel it likes, the BC then converts the data into correct IDoc format and sends it into the SAP system via RFC.
SAP BC is available free of charge, only a one-time registration of your S-User is necessary: https://service.sap.com/sbc-download
On the same site you will also find a lot of documentation. If you want to get an overview of whether the Business Connector is the right choice for your scenario, I recommend chapter 7 of the SAPBCSapAdapterGuide.pdf. It describes the first basic ways of how IDocs can be processed in the SAP BC. (And possibly a few other chapters that are referenced by chapter 7 for basic understanding of how the BC works.)
The SAP BC is a small component that doesn't need much resources and can for example be installed on the SAP system host, or on the host where the external program runs. (Only if you expect high load, you should probably give it its own machine to avoid negative performance impact on the SAP system.)
If the external system is written in Java and can easily be extended, then using SAP JCo combined with the JCo IDoc Library might be another option for you. See https://service.sap.com/connectors
Best Regards, Ulrich