There are already multiple samples and many documents/guides at scn:
- For the basis part : look at (and perform some search) transactions like SCOT (Cust.) and SOST (Admin)
- For the Abap part: look at (and perform some search) class cl_bcs (or old FMs)
Regards,
Raymond