Advertisement
Guest User

Untitled

a guest
Nov 24th, 2014
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. public static Dictionary<string, SapInfoItem> get_sapInfo()
  2. {
  3.  
  4. Dictionary<string, SapInfoItem> sapInfo = new Dictionary<string, SapInfoItem>();
  5. GuiApplication sapGuiApp;
  6.  
  7. SapROTWr.CSapROTWrapper sapROTWrapper = new SapROTWr.CSapROTWrapper();
  8. object SapGuilRot = sapROTWrapper.GetROTEntry("SAPGUI");
  9. object engine = SapGuilRot.GetType().InvokeMember("GetSCriptingEngine", System.Reflection.BindingFlags.InvokeMethod,
  10. null, SapGuilRot, null);
  11.  
  12. sapGuiApp = engine as GuiApplication;
  13. GuiConnection connection = sapGuiApp.Connections.ElementAt(0) as GuiConnection;
  14.  
  15. foreach (GuiSession child_session in connection.Children)
  16. {
  17. GuiSession session = child_session as GuiSession; //connection.Children.ElementAt(0) as GuiSession;
  18. SapInfoItem sii = new SapInfoItem();
  19. sii.system_name = session.Info.SystemName;
  20. sii.client = session.Info.Client;
  21. sii.client = session.Info.Program;
  22. sii.screen_number = session.Info.ScreenNumber;
  23. sii.handle = session.ActiveWindow.Handle;
  24. sii.transaction = session.Info.Transaction;
  25.  
  26. sapInfo.Add(sii.handle.ToString("X"), sii);
  27. }
  28.  
  29. connection.CloseConnection();
  30.  
  31.  
  32. return sapInfo;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement