Dear Friends,
Hurrreeey......
I have found the solution for the BAD VARIANT TYPE issue...
The SAP system is single thread where as when we call it we have to take care of this important requirement, when we try to connect SAP using Window application it will work cause of Single Thread created on each event but when we create Window Service it is not single threaded so we have to change the event to single thread which could be possible by explicitly make call to this method as single thread, frankly speaking i got this code after search on google (find the below url for your reference), in this url the scenario is difference but this give me direction how to explicitly do single thread.
My Code :
var staThread = new System.Threading.Thread(() => MyMethod());
staThread.SetApartmentState(System.Threading.ApartmentState.STA);
staThread.Start();
staThread.Join();
This above code help the method to work as single thread and the connection is establish without any error.
Thanks
Romoku for your answer in below url which help me lot.
Google URL for the example :
http://stackoverflow.com/questions/16146022/windows-service-the-calling-thread-cannot-access-this-object-because-a-differen[
^]