Advertisement
Guest User

Untitled

a guest
Mar 30th, 2017
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. import com.sap.conn.jco.ext.DestinationDataProvider;
  2. import com.sap.conn.jco.JCoDestination;
  3. import com.sap.conn.jco.JCoException;
  4. import com.sap.conn.jco.JCoDestinationManager;
  5.  
  6. import java.util.Properties;
  7.  
  8. public class TestMySAP {
  9.  
  10. public static void main(String[] args) {
  11.  
  12. // This will create a file called mySAPSystem.jcoDestination
  13. String DESTINATION_NAME1 = "mySAPSystem";
  14. Properties connectProperties = new Properties();
  15. connectProperties.setProperty(DestinationDataProvider.JCO_ASHOST, "yoursaphost.yourdomain.com");
  16. connectProperties.setProperty(DestinationDataProvider.JCO_SYSNR, "00");
  17. connectProperties.setProperty(DestinationDataProvider.JCO_CLIENT, "100");
  18. connectProperties.setProperty(DestinationDataProvider.JCO_USER, "youruser");
  19. connectProperties.setProperty(DestinationDataProvider.JCO_PASSWD, "******");
  20. connectProperties.setProperty(DestinationDataProvider.JCO_LANG, "en");
  21. sap2.createDestinationDataFile(DESTINATION_NAME1, connectProperties);
  22.  
  23. // This will use that destination file to connect to SAP
  24. try {
  25. JCoDestination destination = JCoDestinationManager.getDestination("mySAPSystem");
  26. System.out.println("Attributes:");
  27. System.out.println(destination.getAttributes());
  28. System.out.println();
  29. destination.ping();
  30. } catch (JCoException e) {
  31. e.printStackTrace();
  32. }
  33.  
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement