⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jco.java

📁 SAP这个系统的一个转换器
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
                        throw exc;
                }
                IMetaData imetadata1 = meta;
                return imetadata1;
            }
            finally
            {
                if(jarm_monitor != null)
                {
                    jarm_monitor.compAction(structure_name);
                    jarm_monitor.endComponent();
                    jarm_monitor.endRequest();
                }
            }
        }

        public final IMetaData queryFunctionInterface(Client client, String name)
        {
            if(client == null)
                throw new Exception(106, "JCO_ERROR_RESOURCE", "Invalid connection encountered");
            MetaData meta = null;
            ParameterList imp = JCO.createParameterList();
            ParameterList tab = JCO.createParameterList();
            int version = getVersion(client);
            boolean is_unicode = false;
            if(version > 463)
            {
                String codepage = client.getAttributes().getPartnerCodepage().trim();
                if(codepage.charAt(0) == '4')
                    is_unicode = true;
            }
            int unicode_factor = is_unicode ? -2 : 1;
            meta = new MetaData(name);
            imp.appendValue("FUNCNAME", 0, unicode_factor * 30, name);
            Table funint;
            if(version >= 200 && version < 300)
                funint = JCO.createTable(funint_v2);
            else
            if(version >= 300 && version < 400)
                funint = JCO.createTable(funint_v3);
            else
            if(version >= 400 && version < 500)
                funint = JCO.createTable(funint_v4);
            else
            if(version >= 500 && !is_unicode)
                funint = JCO.createTable(funint_v5);
            else
            if(version >= 500 && is_unicode)
                funint = JCO.createTable(funint_v6u);
            else
                throw new Exception(108, "JCO_ERROR_INTERNAL", "Wrong repository version = " + Integer.toString(version) + " encountered");
            tab.appendValue("PARAMS", funint);
            Function function = new Function("RFC_GET_FUNCTION_INTERFACE", imp, null, tab);
            execute(client, function);
            meta = new MetaData(name);
            for(int irow = 0; irow < funint.getNumRows(); irow++)
            {
                int flags = 0;
                funint.setRow(irow);
                char pclass = funint.getString(0).charAt(0);
                String pdflt = version <= 200 || version >= 460 ? funint.getString(11) : funint.getString(9).trim();
                String tabname = funint.getString(2);
                String fieldname = funint.getString(3);
                String stype = funint.getString(4);
                int ptype = JCO.getJCOType(stype.length() <= 0 ? ' ' : stype.charAt(0));
                String sdefault = null;
                String descript = funint.getString(10).trim();
                descript = descript.length() <= 0 ? null : descript;
                if(ptype == -1 && (pclass == 'I' || pclass == 'E' || pclass == 'C'))
                {
                    for(int j = 0; j < ABAP_TYPES.length && ptype == -1; j++)
                        if(tabname.equals(ABAP_TYPES[j]))
                            ptype = JCO.getJCOType(ABAP_EXIDS[j]);

                }
                if(version >= 462 && pclass != 'X' && pclass != 'T' && (ptype == -1 || ptype == 17 || ptype == 99))
                {
                    ParameterList imp2 = JCO.createParameterList();
                    ParameterList exp2 = JCO.createParameterList();
                    Structure x030l_wa = null;
                    Structure dfies_wa2 = null;
                    imp2.appendValue("TABNAME", 0, unicode_factor * 30, tabname);
                    imp2.appendValue("ALL_TYPES", 0, unicode_factor * 1, "X");
                    if(fieldname.length() > 0)
                    {
                        imp2.appendValue("LFIELDNAME", 0, unicode_factor * 132, fieldname);
                        dfies_wa2 = JCO.createStructure(is_unicode ? ((IMetaData) (dfies_v6u)) : ((IMetaData) (dfies_v5)));
                        exp2.appendValue("DFIES_WA", dfies_wa2);
                        Function function2 = new Function("DDIF_FIELDINFO_GET", imp2, exp2, null);
                        execute(client, function2);
                        stype = dfies_wa2.getString(13);
                        ptype = JCO.getJCOType(stype.length() <= 0 ? ' ' : stype.charAt(0));
                        if(ptype == 17 || ptype == 99)
                            tabname = dfies_wa2.getString(6);
                    } else
                    if(ptype == -1 || ptype == 17)
                    {
                        exp2.appendValue("DDOBJTYPE", 0, unicode_factor * 31, (String)null);
                        x030l_wa = JCO.createStructure(version >= 500 ? ((IMetaData) (is_unicode ? ((IMetaData) (x030l_v6u)) : ((IMetaData) (x030l_v5)))) : ((IMetaData) (x030l_v4)));
                        exp2.appendValue("X030L_WA", x030l_wa);
                        Function function2 = new Function("DDIF_FIELDINFO_GET", imp2, exp2, null);
                        execute(client, function2);
                        byte flag3 = x030l_wa.getByteArray(13)[0];
                        boolean isNestedType1 = (flag3 & 1) != 0 && (flag3 & 2) == 0;
                        if(isNestedType1)
                            flags |= 0x80;
                        String ddobjtype = exp2.getString(0);
                        if(ddobjtype.equalsIgnoreCase("INTTAB") || ddobjtype.equalsIgnoreCase("TRANSP") || ddobjtype.equalsIgnoreCase("POOL") || ddobjtype.equalsIgnoreCase("CLUSTER"))
                            ptype = 17;
                        else
                        if(ddobjtype.equalsIgnoreCase("TTYP"))
                            ptype = 99;
                        else
                            ptype = -1;
                    }
                }
                if(pclass == 'I')
                {
                    flags |= 1;
                    if(pdflt.length() > 0 && pdflt.charAt(0) != ' ')
                        flags |= 4;
                    if(ptype == -1)
                        ptype = 17;
                    sdefault = funint.getString(9).trim();
                    sdefault = sdefault.length() <= 0 ? null : sdefault;
                } else
                if(pclass == 'E')
                {
                    flags |= 2;
                    if(ptype == -1)
                        ptype = 17;
                } else
                if(pclass == 'C')
                {
                    flags |= 3;
                    if(ptype == -1)
                        ptype = 17;
                    sdefault = funint.getString(9).trim();
                    sdefault = sdefault.length() <= 0 ? null : sdefault;
                } else
                if(pclass == 'T')
                {
                    flags = 0;
                    if(pdflt.length() > 0 && pdflt.charAt(0) != ' ')
                        flags |= 4;
                    ptype = 99;
                } else
                {
                    if(pclass != 'X')
                        continue;
                    flags = 0;
                    ptype = 98;
                    if(descript == null)
                        descript = funint.getString(1);
                }
                meta.addInfo(funint.getString(1), ptype, funint.getInt(7) * (is_unicode ? -1 : 1), -1, funint.getInt(8), sdefault, descript, flags, tabname.length() != 0 ? ((Object) (tabname)) : null, null);
            }

            if(version > 200 && version < 460)
            {
                Table rsexc = JCO.createTable(rsexc_v3);
                Table rsimp = JCO.createTable(rsimp_v3);
                Table rsexp = JCO.createTable(rstbl_v3);
                Table rstbl = JCO.createTable(rstbl_v3);
                imp = JCO.createParameterList();
                ParameterList exp = JCO.createParameterList();
                tab = JCO.createParameterList();
                imp.appendValue("FUNCNAME", 0, 30, name);
                exp.addInfo("GLOBAL_FLAG", 0, 30);
                exp.addInfo("REMOTE_CALL", 0, 30);
                exp.addInfo("UPDATE_TASK", 0, 30);
                tab.appendValue("EXCEPTION_LIST", 99, 24, rsexc);
                tab.appendValue("EXPORT_PARAMETER", 99, 24, rsexp);
                tab.appendValue("IMPORT_PARAMETER", 99, 24, rsimp);
                tab.appendValue("TABLES_PARAMETER", 99, 24, rstbl);
                function = new Function("FUNCTION_IMPORT_INTERFACE", imp, exp, tab);
                execute(client, function);
                for(int irow = 0; irow < rsimp.getNumRows(); rsimp.nextRow())
                {
                    String pdflt = rsimp.getString(4).trim();
                    if(pdflt.length() >= 1)
                    {
                        String tabname = rsimp.getString(0);
                        for(int i = 0; i < meta.name.length; i++)
                        {
                            if((meta.flags[i] & 1) == 0 || !meta.name[i].equals(tabname))
                                continue;
                            meta.flags[i] |= 4;
                            break;
                        }

                    }
                    irow++;
                }

                for(int irow = 0; irow < rstbl.getNumRows(); rstbl.nextRow())
                {
                    String pdflt = rstbl.getString(3).trim();
                    if(pdflt.length() >= 1)
                    {
                        String tabname = rstbl.getString(0);
                        for(int i = 0; i < meta.name.length; i++)
                        {
                            if(meta.type[i] != 99 || !meta.name[i].equals(tabname))
                                continue;
                            meta.flags[i] |= 4;
                            break;
                        }

                    }
                    irow++;
                }

            }
            funint.firstRow();
            queryFunctionInterfaceEpilog(client, meta, funint);
            return meta;
        }

        protected void queryFunctionInterfaceEpilog(Client client1, MetaData metadata, Table table)
        {
        }

        public final IMetaData queryStructureDefinition(Client client, String name)
        {
            if(client == null)
                throw new Exception(106, "JCO_ERROR_RESOURCE", "Invalid connection encountered");
            MetaData meta = null;
            ParameterList imp = JCO.createParameterList();
            ParameterList exp = JCO.createParameterList();
            ParameterList tab = JCO.createParameterList();
            Function function = null;
            int version = getVersion(client);
            boolean is_unicode = false;
            if(JCO.trace_level > 2)
            {
                JCO.fireTrace(3, "[JAV-LAYER] Client.queryStructureDefinition(\"" + name + "\") enter [SUCCESS]");
                JCO.fireTrace(3, "[JAV-LAYER] Client.getRepositoryVersion() = " + version + " [SUCCESS]");
            }
            if(version > 463)
            {
                String codepage = client.getAttributes().getPartnerCodepage().trim();
                if(codepage.charAt(0) == '4')
                    is_unicode = true;
            }
            int unicode_factor = is_unicode ? -2 : 1;
            if(version >= 200 && version < 300)
            {
                if(JCO.trace_level > 2)
                    JCO.fireTrace(3, "[JAV-LAYER] Client.queryStructureDefinition()  ");
                imp.appendValue("TABNAME", 0, 30, name);
                exp.addInfo("TABLENGTH", 8, 4);
                Table fields = JCO.createTable(fields_v2);
                tab.appendValue("FIELDS", fields);
                function = new Function("RFC_GET_STRUCTURE_DEFINITION", imp, exp, tab);
                execute(client, function);
                int num_rows = fields.getNumRows();
                meta = new MetaData(name, num_rows);
                meta.setTabLength(exp.getInt(0));
                for(int irow = 0; irow < num_rows; irow++)
                {
                    String stype = fields.getString(6);
                    int ptype = JCO.getJCOType(stype.length() <= 0 ? ' ' : stype.charAt(0));
                    meta.addInfo(fields.getString(1), ptype, fields.getInt(4), fields.getInt(3), fields.getInt(5));
                    fields.nextRow();
                }

                fields.firstRow();
                queryStructureInterfaceEpilog(client, meta, fields);
            } else
            if(version >= 300 && version < 400)
            {
                if(JCO.trace_level > 2)
                    JCO.fireTrace(3, "[JAV-LAYER] Client.queryStructureDefinition()  ");
                imp.appendValue("TABNAME", 0, 10, name);
                exp.addInfo("TABLENGTH", 8, 4);
                Table fields = JCO.createTable(fields_v3);
                tab.appendValue("FIELDS", fields);
                function = new Function("RFC_GET_STRUCTURE_DEFINITION", imp, exp, tab);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -