This is a migrated thread and some comments may be shown as answers.

Populate Grid Asyncronously via Call to SAP

1 Answer 38 Views
Grid
This is a migrated thread and some comments may be shown as answers.
sircutbreaker
Top achievements
Rank 1
sircutbreaker asked on 28 Apr 2009, 11:23 PM
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?



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; 
 
         
         
 
 
 
    } 



1 Answer, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 04 May 2009, 02:01 PM

Hi sircutbreaker,

As long as your SAP .NET connector returns a collection which implements IList, IEnumerable or ICustomTypeDescriptor interfaces as explained in this help topic, this should be sufficient to pass the source to the control and bind it. Can you please verify that?

Moreover, you can utilize our RadAjax framework to perform the operations with ajax calls and display RadAjaxLoadingPanel while the update is in progress.

Best regards,

Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
sircutbreaker
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Share this question
or