Exemplo n.º 1
0
        private static void ExecuteSAPQuery(R3Connection con)
        {
            using (con)
            {
                con.Open(false);

                // Create Query object Query q;
                Query q;
                try
                {
                    q = con.CreateQuery(WorkSpace.GlobalArea, "/SAPQUERY/QD", "CONNECTIONS_02");
                    //q.Variant = "ALL";
                    q.MaxRows = 1000;
                }
                catch (Exception e1)
                {
                    Console.WriteLine(e1.ToString());
                    return;
                }

                // Add a criteria (in this case the material number)
                //q.SelectionParameters["SP$00017"].Ranges.Add(Sign.Include, RangeOption.Equals, "100-100");

                // Add a second criteria (in this case the currency)
                //q.SelectionParameters["S_WAERS"].Ranges.Add(Sign.Include, RangeOption.Equals, "EUR");

                // Run the Query
                q.Execute();

                // Bind result to datagrid
                DataTable table = q.Result;

                Console.Read();
            }
        }