We can write a BDC program is couple of ways...
1) Convert the legacy data to a flat file to internal table called "conversion".
2) Transfering the flat file into sap system called "sap data transfer".
3)Depending upon the BDC type
i) call transaction (Write the program explicitly)ii) create sessions (sessions are created and processed. if success data will transfer).