I am currently using a radgrid to display contents from a remote function call to SAP.
It works great... But I need to architect it async. Sometimes the calls take some time to come back.
I am using the SAP .NET connector. It comes with the Async routines.
I am able to get the data... but I have the code set up wrong to bind and display the dataset once it returns from SAP.
I think i need some sort of handler....
Ultimately, I would like to display a loading gif while the data is being retrieved..
Here is what the call looks like in c#
I have removed most of the data code...
how would I set the grid up to populate from this?
Here is the receiving routine...
It works great... But I need to architect it async. Sometimes the calls take some time to come back.
I am using the SAP .NET connector. It comes with the Async routines.
I am able to get the data... but I have the code set up wrong to bind and display the dataset once it returns from SAP.
I think i need some sort of handler....
Ultimately, I would like to display a loading gif while the data is being retrieved..
Here is what the call looks like in c#
I have removed most of the data code...
how would I set the grid up to populate from this?
| Object asyncState = null; |
| //AsyncCallback callback; |
| IAsyncResult asyncresult = null; |
| try |
| { |
| DateTime begintime = DateTime.Now; |
| //Connect |
| proxy.Connection = new SAP.Connector.SAPConnection(destination1); |
| proxy.Connection.Open(); |
| // Call SAP RFC HERE |
| string strCustNo = "0000000000" + user.SAPCustomerNo.Trim(); |
| strCustNo = strCustNo.Substring(strCustNo.Length - 10, 10); |
| string cust = strCustNo; |
| AsyncCallback callback = new AsyncCallback(ProcessInfo); |
| asyncresult = proxy.BeginZvasec_Pnlookup_And_Ixos(cust, portal, strPN, ref tblALTPN_ACTYPE, ref tblALTPN_AVAIL, ref tblPN_ACTYPE, ref tblPN_AVAIL, callback, asyncState); |
| //proxy.Connection.Close(); |
| DateTime endtime = DateTime.Now; |
| TimeSpan elapsedtime = endtime - begintime; |
| } |
| catch (Exception ex) |
| { |
| proxy.Connection.Close(); |
| _return = false; |
| } |
| } |
Here is the receiving routine...
| void ProcessInfo(IAsyncResult result) |
| { |
| OrderFunctions objOF = new OrderFunctions(); |
| TList<Cart> reg = new TList<Cart>(); |
| TList<Cart> alt = new TList<Cart>(); |
| ArrayList ary = new ArrayList(); |
| string pnDesc; |
| int partNo; |
| ZVAS_INVENTORY_SEARCH_STOCK2Table tblALTPN_AVAIL = new ZVAS_INVENTORY_SEARCH_STOCK2Table(); |
| ZVAS_INVENTORY_SEARCH_STOCK2Table tblPN_AVAIL = new ZVAS_INVENTORY_SEARCH_STOCK2Table(); |
| ZVAS_INVENTORY_SEARCH_AIRCRAFTTable tblALTPN_ACTYPE = new ZVAS_INVENTORY_SEARCH_AIRCRAFTTable(); |
| ZVAS_INVENTORY_SEARCH_AIRCRAFTTable tblPN_ACTYPE = new ZVAS_INVENTORY_SEARCH_AIRCRAFTTable(); |
| SAPDestinationFunctions objSF = new SAPDestinationFunctions(); |
| bool blnProduction = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings.Get("isproduction")); |
| SAP.Connector.Destination destination1 = objSF.GetR3Destination(blnProduction); |
| SAPR3Proxy proxy = new SAPR3Proxy(); |
| proxy.Connection = new SAP.Connector.SAPConnection(destination1); |
| //proxy.Connection.Open(); |
| proxy.EndZvasec_Pnlookup_And_Ixos(result, out pnDesc, out partNo, ref tblALTPN_ACTYPE, ref tblALTPN_AVAIL, ref tblPN_ACTYPE, ref tblPN_AVAIL); |
| proxy.Connection.Close(); |
| UserProfile user = new UserProfile();// = (UserProfile)HttpContext.Current.Session["user"]; |
| DateTime endtime = DateTime.Now; |
| } |