Exemplo n.º 1
0
        private String ConvertHeadere2XML(X030L oX030L)
        {
            X030LTable oTable = null;

            oTable = new X030LTable();
            oTable.Add(oX030L);

            return(ConvertDataTable2XML(oTable.ToADODataTable()));
        }
Exemplo n.º 2
0
        public virtual void RFC_GET_NAMETAB(

            [RfcParameter(AbapName = "TABNAME", RfcType = RFCTYPE.RFCTYPE_CHAR, Optional = false, Direction = RFCINOUT.IN, Length = 30, Length2 = 60)]
            [XmlElement("TABNAME", IsNullable = false, Form = XmlSchemaForm.Unqualified)]
            string TABNAME,
            [RfcParameter(AbapName = "HEADER", RfcType = RFCTYPE.RFCTYPE_STRUCTURE, Optional = true, Direction = RFCINOUT.OUT)]
            [XmlElement("HEADER", IsNullable = false, Form = XmlSchemaForm.Unqualified)]
            out X030L HEADER,
            [RfcParameter(AbapName = "NAMETAB", RfcType = RFCTYPE.RFCTYPE_ITAB, Optional = false, Direction = RFCINOUT.INOUT)]
            [XmlArray("NAMETAB", IsNullable = false, Form = XmlSchemaForm.Unqualified)]
            [XmlArrayItem("item", IsNullable = false, Form = XmlSchemaForm.Unqualified)]
            ref X031LTable NAMETAB)
        {
            object[] results = null;
            results = this.SAPInvoke("RFC_GET_NAMETAB", new object[] {
                TABNAME, NAMETAB
            });
            HEADER  = (X030L)results[0];
            NAMETAB = (X031LTable)results[1];
        }
Exemplo n.º 3
0
        private DataTable RFC_Get_TabName(String strTabName, out X030L oHeader)
        {
            X031LTable oNameTab = null;

            oHeader = null;

            if (this.Connection.IsOpen == false)
            {
                return(null);
            }

            try
            {
                oNameTab = new X031LTable();
                RFC_GET_NAMETAB(strTabName, out oHeader, ref oNameTab);
            }
            catch (Exception exp)
            {
                throw exp;
            }

            return(oNameTab.ToADODataTable()); // Converts the SAP table to an ADO.NET DataTable.
        }
Exemplo n.º 4
0
        private void GetRFCStructDef(ref XmlNode oParentNode)
        {
            XmlNodeList oNodeList = null;
            DataTable   oDTStruct = null;

            String strParamClass = null;
            String strExid       = null;
            String strTabName    = null;

            String      strDTXML      = null;
            XmlDocument oXmlDoc       = null;
            XmlNode     oDTNode       = null;
            XmlNode     oImportedNode = null;

            X030L oX030LHeader = null;

            try
            {
                oXmlDoc = new XmlDocument();
                oXmlDoc.PreserveWhitespace = false;

                while (true)
                {
                    oNodeList = oParentNode.SelectNodes(XPATH_HNODE);
                    if (oNodeList == null || oNodeList.Count == 0)
                    {
                        break;
                    }

                    for (int i = 0; i < oNodeList.Count; ++i)
                    {
                        strParamClass = strTabName = null;
                        strExid       = oNodeList[i].Attributes[COLUMN_EXID].Value;
                        if (String.Equals(oNodeList[i].Name, "RFC_FUNINTTable"))
                        {
                            strParamClass = oNodeList[i].Attributes[COLUMN_PARAMCLASS].Value;
                            if (strParamClass.Equals("T") ||
                                (!strParamClass.Equals("X") && strExid.Length.Equals(0)) ||
                                (strExid.Equals("u") || strExid.Equals("h") || strExid.Equals("v"))
                                )
                            {
                                strTabName = oNodeList[i].Attributes[COLUMN_TABNAME].Value;
                            }
                        }
                        else if (String.Equals(oNodeList[i].Name, "X031LTable"))
                        {
                            if (strExid.Equals("u") || strExid.Equals("h") || strExid.Equals("v"))
                            {
                                strTabName = oNodeList[i].Attributes[COLUMN_TABTYPE].Value;
                            }
                        }

                        if (String.IsNullOrEmpty(strTabName))
                        {
                            continue;
                        }

                        oDTStruct = RFC_Get_TabName(strTabName, out oX030LHeader);
                        if (oDTStruct == null || oDTStruct.Rows.Count <= 1)
                        {
                            if (!String.IsNullOrEmpty(oX030LHeader.Refname))
                            {
                                strTabName = oX030LHeader.Refname;
                                oDTStruct  = RFC_Get_TabName(strTabName, out oX030LHeader);
                            }
                        }
                        oDTStruct.Namespace = "";
                        if (oX030LHeader != null)
                        {
                            strDTXML = ConvertHeadere2XML(oX030LHeader);
                            oXmlDoc.LoadXml(strDTXML);
                            oDTNode = oXmlDoc.DocumentElement;

                            oImportedNode = oNodeList[i].OwnerDocument.ImportNode(oDTNode, true);
                            oNodeList[i].AppendChild(oImportedNode);
                        }
                        strDTXML = ConvertDataTable2XML(oDTStruct);
                        oXmlDoc.LoadXml(strDTXML);
                        oDTNode = oXmlDoc.DocumentElement;

                        oImportedNode = oNodeList[i].OwnerDocument.ImportNode(oDTNode, true);
                        oNodeList[i].AppendChild(oImportedNode);
                    } // for
                }     // while (true)
            }
            catch (Exception exp)
            {
                throw exp;
            }
            return;
        }
Exemplo n.º 5
0
        /// <summary>
        /// 인터페이스 목록으로부터 테이블, 구조체 형식의 XML 정보를 획득한다.
        /// </summary>
        /// <param name="oParentNode">인터페이스 정보를 갖는 XML 노드</param>
        private void GetRFCStructDef(ref XmlNode oParentNode)
        {
            XmlNodeList oNodeList = null;     // XML 노드 리스트
            DataTable   oDTStruct = null;     // RFC 함수 속성 중, Struct 형태의 정보 테이블

            String strParamClass = null;      // RFC 함수 인자 속성 중, PARAMCLASS 항목의 값
            String strExid       = null;      // RFC 함수 인자 속성 중, EXID 항목의 값
            String strTabName    = null;      // RFC 함수 인자 속성 중, TABNAME 항목의 값

            String      strDTXML      = null; // 테이블 XML 문서
            XmlDocument oXmlDoc       = null; // XML 문서
            XmlNode     oDTNode       = null; // IMPORT 테이블 노드
            XmlNode     oImportedNode = null; // IMPORT 대상 테이블 노드

            X030L oX030LHeader = null;        // X030LHeader Struct

            try
            {
                oXmlDoc = new XmlDocument();
                oXmlDoc.PreserveWhitespace = false;

                // 테이블, 구조를 갖는 하위 노드를 선택한다.
                while (true)
                {
                    // 하위노드 정보가 없는 Table(Struct) 노드를 선택한다.
                    oNodeList = oParentNode.SelectNodes(XPATH_HNODE);
                    if (oNodeList == null || oNodeList.Count == 0)
                    {
                        break;
                    }

                    for (int i = 0; i < oNodeList.Count; ++i)
                    {
                        // PARAMCLASS 값을 가져온다.
                        strParamClass = strTabName = null;
                        strExid       = oNodeList[i].Attributes[COLUMN_EXID].Value;
                        if (String.Equals(oNodeList[i].Name, "RFC_FUNINTTable"))
                        {
                            strParamClass = oNodeList[i].Attributes[COLUMN_PARAMCLASS].Value;
                            // Struct(Table) 구조에 대한 처리를 한다.
                            if (strParamClass.Equals("T") ||
                                (!strParamClass.Equals("X") && strExid.Length.Equals(0)) ||
                                (strExid.Equals("u") || strExid.Equals("h") || strExid.Equals("v"))
                                )
                            {
                                strTabName = oNodeList[i].Attributes[COLUMN_TABNAME].Value;
                            }
                        }
                        else if (String.Equals(oNodeList[i].Name, "X031LTable"))
                        {
                            // Struct(Table) 구조에 대한 처리를 한다.
                            if (strExid.Equals("u") || strExid.Equals("h") || strExid.Equals("v"))
                            {
                                strTabName = oNodeList[i].Attributes[COLUMN_TABTYPE].Value;
                            }
                        }

                        if (String.IsNullOrEmpty(strTabName))
                        {
                            continue;
                        }

                        // Struct(Table) 구조를 획득한다.
                        oDTStruct = RFC_Get_TabName(strTabName, out oX030LHeader);
                        if (oDTStruct == null || oDTStruct.Rows.Count <= 1)
                        {
                            if (!String.IsNullOrEmpty(oX030LHeader.Refname))
                            {
                                strTabName = oX030LHeader.Refname;
                                oDTStruct  = RFC_Get_TabName(strTabName, out oX030LHeader);
                            }
                        }
                        oDTStruct.Namespace = ""; // 네임스페이스를 제거한다.
                        if (oX030LHeader != null)
                        {
                            // 획득한 테이블을 XML 문서로 변환하여, XMLDOM 개체에 로드한다.
                            strDTXML = ConvertHeadere2XML(oX030LHeader);
                            oXmlDoc.LoadXml(strDTXML);
                            oDTNode = oXmlDoc.DocumentElement;

                            // 헤더의 XML 문서를 현재 노드의 자식으로 삼는다.
                            oImportedNode = oNodeList[i].OwnerDocument.ImportNode(oDTNode, true);
                            oNodeList[i].AppendChild(oImportedNode);
                        }

                        // 획득한 테이블을 XML 문서로 변환하여, XMLDOM 개체에 로드한다.
                        strDTXML = ConvertDataTable2XML(oDTStruct);
                        oXmlDoc.LoadXml(strDTXML);
                        oDTNode = oXmlDoc.DocumentElement;

                        // Table 구조를 획득하고, 구해진 XML 문서를 현재 노드의 자식으로 삼는다.
                        // 현재 노드의 하위 노드로 설정한다.
                        oImportedNode = oNodeList[i].OwnerDocument.ImportNode(oDTNode, true);
                        oNodeList[i].AppendChild(oImportedNode);
                    } // for
                }     // while (true)
            }
            catch (Exception exp)
            {
                throw exp;
            }
            return;
        }
Exemplo n.º 6
0
 /// <summary>
 /// Removes the first occurrence of the specified X030L from the collection.
 /// </summary>
 /// <param name="value">The X030L to remove from the collection.</param>
 public void Remove(X030L value)
 {
     List.Remove(value);
 }
Exemplo n.º 7
0
 /// <summary>
 /// Determines wheter an element is in the collection.
 /// </summary>
 /// <param name="value">The X030L to locate in the collection.</param>
 /// <returns>True if found; else false.</returns>
 public bool Contains(X030L value)
 {
     return(List.Contains(value));
 }
Exemplo n.º 8
0
 /// <summary>
 /// Searches for the specified X030L and returnes the zero-based index of the first occurrence in the collection.
 /// </summary>
 /// <param name="value">The X030L to locate in the collection.</param>
 /// <returns>The index of the object found or -1.</returns>
 public int IndexOf(X030L value)
 {
     return(List.IndexOf(value));
 }
Exemplo n.º 9
0
 /// <summary>
 /// Inserts a X030L into the collection at the specified index.
 /// </summary>
 /// <param name="index">The zero-based index at which value should be inserted.</param>
 /// <param name="value">The X030L to insert.</param>
 public void Insert(int index, X030L value)
 {
     List.Insert(index, value);
 }
Exemplo n.º 10
0
 /// <summary>
 /// Adds a X030L to the end of the collection.
 /// </summary>
 /// <param name="value">The X030L to be added to the end of the collection.</param>
 /// <returns>The index of the newX030L.</returns>
 public int Add(X030L value)
 {
     return(List.Add(value));
 }