// Methods
 public virtual void Add(QueryField NewParameter)
 {
     base.List.Add(NewParameter);
 }
Exemplo n.º 2
0
 internal void RefreshFieldsAndSelections()
 {
     if (this._UserGroup.Trim().Equals("") || this._Name.Trim().Equals(""))
     {
         throw new SAPException(Messages.PleasemakesurethatthefieldsUserGroupandNamearefilledcorrectly);
     }
     //RFCFunction function = RFCFunctionFactory.GenerateFunctionObjectForRSAQ_REMOTE_QUERY_FIELDLIST(this._con.IsUnicode);
     IRfcFunction function = _des.Repository.CreateFunction("RSAQ_REMOTE_QUERY_FIELDLIST");
     //function.Connection = this._con;
     if (this._WorkArea == WorkSpace.StandardArea)
     {
         function.SetValue("WORKSPACE", " ");
     }
     else
     {
         function.SetValue("WORKSPACE", "X");
     }
     function["QUERY"].SetValue(this._Name);
     function.SetValue("USERGROUP", this._UserGroup);
     //function.Exports["USERGROUP"].ParamValue = this._UserGroup;
     try
     {
         function.Invoke(_des);
         // function.Execute();
         IRfcTable table = function.GetTable("FIELDS");
         IRfcTable table2 = function.GetTable("SEL_FIELDS");
         this._Fields.Clear();
         this._SelectionParameters.Clear();
         string str = "";
         foreach (IRfcStructure structure in table.ToList())
         {
             if (str == "")
             {
                 str = structure["LID"].GetValue().ToString();
             }
             if (str == structure["LID"].GetValue().ToString())
             {
                 QueryField newParameter = new QueryField(structure["NAME"].GetValue().ToString(), structure["TYPE"].GetValue().ToString(), Convert.ToInt32(structure["OLENG"].GetValue()), Convert.ToInt32(structure["DECIMALS"].GetValue()), "");
                 this._Fields.Add(newParameter);
                 if ((!structure["CURRY"].GetValue().ToString().Trim().Equals("") && !structure["CURRY"].GetValue().ToString().Trim().Equals("W")) && !structure["CURRY"].GetValue().ToString().Trim().Equals("E"))
                 {
                     QueryField field2 = new QueryField(structure["NAME"].GetValue().ToString() + "-" + structure["LINE"].GetValue().ToString() + structure["POS"].GetValue().ToString(), "C", 10, 0, "");
                     this._Fields.Add(field2);
                 }
             }
         }
         foreach (IRfcStructure structure2 in table2.ToList())
         {
             if (!structure2["SPNAME"].GetValue().ToString().Substring(0, 1).Equals("%"))
             {
                 string descriptionText = structure2["FTEXT"].GetValue().ToString();
                 if (descriptionText.StartsWith("D       "))
                 {
                     descriptionText = descriptionText.Substring(8);
                 }
                 QuerySelectionParameter parameter = new QuerySelectionParameter(structure2["SPNAME"].GetValue().ToString(), structure2["FNAME"].GetValue().ToString(), descriptionText, Convert.ToInt32(structure2["LENGTH"].GetValue()), structure2["OBLIGATORY"].GetValue().ToString().Equals("X"), structure2["NODISPLAY"].GetValue().ToString().Equals("X"), structure2["KIND"].GetValue().ToString().Equals("S") ? Kind.SelectOption : Kind.Parameter);
                 this.SelectionParameters.Add(parameter);
             }
         }
     }
     catch (RfcAbapException ee)
     {
         throw new SAPException(ee.Key + ee.Message);
     }
     catch (Exception ee)
     {
         throw new SAPException(ee.Message);
     }
 }