Advertisement
Guest User

Untitled

a guest
Dec 19th, 2014
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.93 KB | None | 0 0
  1. public class SAPsystemconnect:IDestinationConfiguration
  2. {
  3. public RfcConfigParameters GetParameters(string destinationName)
  4. {
  5. RfcConfigParameters parms = new RfcConfigParameters();
  6. if ("DEV".Equals(destinationName))
  7. {
  8.  
  9. parms.Add(RfcConfigParameters.AppServerHost, "ECC6");
  10. parms.Add(RfcConfigParameters.SystemNumber, "04");
  11. parms.Add(RfcConfigParameters.User, "sapuser");
  12. parms.Add(RfcConfigParameters.Password, "newmaars1");
  13. parms.Add(RfcConfigParameters.Client, "800");
  14. parms.Add(RfcConfigParameters.Language, "EN");
  15. parms.Add(RfcConfigParameters.PoolSize, "5");
  16. parms.Add(RfcConfigParameters.MaxPoolSize, "10");
  17. parms.Add(RfcConfigParameters.IdleTimeout, "600");
  18.  
  19. }
  20. return parms;
  21. }
  22.  
  23. public bool ChangeEventsSupported()
  24. {
  25. //throw new NotImplementedException();
  26. return false;
  27. }
  28.  
  29. public event RfcDestinationManager.ConfigurationChangeHandler ConfigurationChanged;
  30.  
  31.  
  32.  
  33. }
  34.  
  35. protected void logon_Click(object sender, EventArgs e)
  36. {
  37.  
  38. SAPsystemconnect sapconn = new SAPsystemconnect();
  39. RfcDestinationManager.RegisterDestinationConfiguration(sapconn);
  40. RfcDestination rfcDest = null;
  41. rfcDest = RfcDestinationManager.GetDestination("DEV");
  42.  
  43. RequestDetails reqobj = new RequestDetails();
  44. reqobj.GetRequestDetails(rfcDest);
  45.  
  46.  
  47. // RfcDestinationManager.UnregisterDestinationConfiguration(sapconn);
  48. Response.Redirect("request.aspx");
  49.  
  50.  
  51. System.Environment.Exit(0);
  52. }
  53.  
  54. public class RequestDetails
  55. {
  56. public string empid; //personnel numner
  57. public string name; //name of the employee
  58. public string department; //department of employee
  59. public string descr; //description of help
  60. public string problem; //problem
  61. public string solution; //solution for the problem
  62. public string status; //status of help
  63. public string findings; //proble found during verification ;
  64. public string resolution; //resolutions for problem detected ;
  65. public string recommend; //recommended action
  66. public string remarks; //remarks for work done;
  67. public string feedback; //user feedback for work done;
  68. public int dococde; //description of document code
  69. public int auth1; //personnel number;
  70. public int auth2; //personnel numnber;
  71. public string sapcheck; //checkbox
  72. public string othercheck;//checkbox
  73. public string priority; //priority of request(HIGH,MED,LOW)
  74. public string saptrans; //transaction drop down
  75. public string tranreq; //request/task
  76. public string followtrans; //follow transaction type
  77. public string followdoc; //follow transaction doc number
  78.  
  79.  
  80.  
  81. public void GetRequestDetails(RfcDestination destination)
  82. {
  83. try
  84. {
  85.  
  86. RfcRepository repo = destination.Repository;
  87. IRfcFunction createRequest = repo.CreateFunction("ZSAVE");
  88. createRequest.Invoke(destination);
  89. IRfcTable helpreqtab = createRequest.GetTable("ZHELP_REQTAB");
  90. RequestDetails reqobj = new RequestDetails();
  91.  
  92. reqobj.empid = helpreqtab.GetString("ZREQ_EMPID");
  93.  
  94.  
  95.  
  96. }
  97. catch (RfcCommunicationException e)
  98. {
  99.  
  100. }
  101. catch (RfcLogonException e)
  102. {
  103. // user could not logon...
  104. }
  105. catch (RfcAbapRuntimeException e)
  106. {
  107. // serious problem on ABAP system side...
  108. }
  109. catch (RfcAbapBaseException e)
  110. {
  111. // The function module returned an ABAP exception, an ABAP message
  112. // or an ABAP class-based exception...
  113. }
  114. }
  115. }
  116.  
  117. Element ZHELP_REQTAB of container metadata ZSAVE unknown
  118.  
  119. foreach (IRfcStructure str in helpreqtab)
  120. {
  121. //You can use get string if thefield type is string, you would use the proper Getmethod based on type of the field.
  122. empid = str["empid field name in table"].GetString()
  123. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement