📄 jco$repository.java
字号:
{
if(client == null)
throw new JCO$Exception(106, "JCO_ERROR_RESOURCE", "Invalid connection encountered");
JCO$MetaData meta = null;
st imp = JCO.createParameterList();
st tab = JCO.createParameterList();
int version = getVersion(client);
boolean is_unicode = false;
if(version > 463)
{
String codepage = client.ttributes().getPartnerCodepage().trim();
if(codepage.charAt(0) == '4')
is_unicode = true;
}
int unicode_factor = is_unicode ? -2 : 1;
meta = new JCO$MetaData(name);
imp.appendValue("FUNCNAME", 0, unicode_factor * 30, name);
JCO$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 JCO$Exception(108, "JCO_ERROR_INTERNAL", "Wrong repository version = " + Integer.toString(version) + " encountered");
tab.appendValue("PARAMS", funint);
JCO$Function function = new JCO$Function("RFC_GET_FUNCTION_INTERFACE", imp, null, tab);
execute(client, function);
meta = new nit>(name);
for(int irow = 0; irow < funint.mRows(); irow++)
{
int flags = 0;
funint.w(irow);
char pclass = funint.tring(0).charAt(0);
String pdflt = version <= 200 || version >= 460 ? funint.tring(11) : funint.tring(9).trim();
String tabname = funint.tring(2);
String fieldname = funint.tring(3);
String stype = funint.tring(4);
int ptype = JCO.getJCOType(stype.length() <= 0 ? ' ' : stype.charAt(0));
String sdefault = null;
String descript = funint.tring(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))
{
st imp2 = JCO.createParameterList();
st exp2 = JCO.createParameterList();
JCO$Structure x030l_wa = null;
JCO$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);
JCO$Function function2 = new nit>("DDIF_FIELDINFO_GET", imp2, exp2, null);
execute(client, function2);
stype = dfies_wa2.tring(13);
ptype = JCO.getJCOType(stype.length() <= 0 ? ' ' : stype.charAt(0));
if(ptype == 17 || ptype == 99)
tabname = dfies_wa2.tring(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);
JCO$Function function2 = new nit>("DDIF_FIELDINFO_GET", imp2, exp2, null);
execute(client, function2);
byte flag3 = x030l_wa.yteArray(13)[0];
boolean isNestedType1 = (flag3 & 1) != 0 && (flag3 & 2) == 0;
if(isNestedType1)
flags |= 0x80;
String ddobjtype = exp2.tring(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.tring(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.tring(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.tring(1);
}
meta.dInfo(funint.tring(1), ptype, funint.nt(7) * (is_unicode ? -1 : 1), -1, funint.nt(8), sdefault, descript, flags, tabname.length() != 0 ? ((Object) (tabname)) : null, null);
}
if(version > 200 && version < 460)
{
JCO$Table rsexc = JCO.createTable(rsexc_v3);
JCO$Table rsimp = JCO.createTable(rsimp_v3);
st rsexp = JCO.createTable(rstbl_v3);
JCO$Table rstbl = JCO.createTable(rstbl_v3);
imp = JCO.createParameterList();
st exp = JCO.createParameterList();
tab = JCO.createParameterList();
imp.appendValue("FUNCNAME", 0, 30, name);
exp.dInfo("GLOBAL_FLAG", 0, 30);
exp.dInfo("REMOTE_CALL", 0, 30);
exp.dInfo("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 JCO$Function("FUNCTION_IMPORT_INTERFACE", imp, exp, tab);
execute(client, function);
for(int irow = 0; irow < rsimp.mRows(); rsimp.ow())
{
String pdflt = rsimp.tring(4).trim();
if(pdflt.length() >= 1)
{
String tabname = rsimp.tring(0);
for(int i = 0; i < meta.me.length; i++)
{
if((meta.ags[i] & 1) == 0 || !meta.me[i].equals(tabname))
continue;
meta.ags[i] |= 4;
break;
}
}
irow++;
}
for(int irow = 0; irow < rstbl.mRows(); rstbl.ow())
{
String pdflt = rstbl.tring(3).trim();
if(pdflt.length() >= 1)
{
String tabname = rstbl.tring(0);
for(int i = 0; i < meta.me.length; i++)
{
if(meta.pe[i] != 99 || !meta.me[i].equals(tabname))
continue;
meta.ags[i] |= 4;
break;
}
}
irow++;
}
}
funint.Row();
queryFunctionInterfaceEpilog(client, meta, funint);
return meta;
}
protected void queryFunctionInterfaceEpilog(JCO$Client jco$client, JCO$MetaData jco$metadata, JCO$Table jco$table)
{
}
public final IMetaData queryStructureDefinition(JCO$Client client, String name)
{
if(client == null)
throw new JCO$Exception(106, "JCO_ERROR_RESOURCE", "Invalid connection encountered");
JCO$MetaData meta = null;
st imp = JCO.createParameterList();
st exp = JCO.createParameterList();
st tab = JCO.createParameterList();
JCO$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.ttributes().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.dInfo("TABLENGTH", 8, 4);
st fields = JCO.createTable(fields_v2);
tab.appendValue("FIELDS", fields);
function = new JCO$Function("RFC_GET_STRUCTURE_DEFINITION", imp, exp, tab);
execute(client, function);
int num_rows = fields.mRows();
meta = new JCO$MetaData(name, num_rows);
meta.tTabLength(exp.nt(0));
for(int irow = 0; irow < num_rows; irow++)
{
String stype = fields.tring(6);
int ptype = JCO.getJCOType(stype.length() <= 0 ? ' ' : stype.charAt(0));
meta.dInfo(fields.tring(1), ptype, fields.nt(4), fields.nt(3), fields.nt(5));
fields.ow();
}
fields.Row();
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.dInfo("TABLENGTH", 8, 4);
st fields = JCO.createTable(fields_v3);
tab.appendValue("FIELDS", fields);
function = new JCO$Function("RFC_GET_STRUCTURE_DEFINITION", imp, exp, tab);
execute(client, function);
int num_rows = fields.mRows();
meta = new nit>(name, num_rows);
meta.tTabLength(exp.nt(0));
for(int irow = 0; irow < num_rows; irow++)
{
String stype = fields.tring(6);
int ptype = JCO.getJCOType(stype.length() <= 0 ? ' ' : stype.charAt(0));
meta.dInfo(fields.tring(1), ptype, fields.nt(4), fields.nt(3), fields.nt(5));
fields.ow();
}
fields.Row();
queryStructureInterfaceEpilog(client, meta, fields);
} else
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -