Dear Kapil
your topic is very old and has been discussed often here. Check e.g.
http://scn.sap.com/docs/DOC-41109
In a lot of other threads I have entered the link to some SAP examples (delivered by SAP and which are part of EHS); by checking how they do it is should be easy to use thies functionality
Check therefore the threads available There are lots of hints
C.B .
PS: Check e.g start EHS expert using JCo
PPS: the thread you have mentioned refers as well to the SAP examples; these SAP examples are a good starting point to learn