📄 jrfctest.java
字号:
{
initCall("STFC_PERFORMANCE");
com.sap.mw.jco.JCO.ParameterList imp = function.getImportParameterList();
imp.setValue(propValues.getProperty("jco.perform.elength0332"), "LGET0332");
imp.setValue(propValues.getProperty("jco.perform.elength1000"), "LGET1000");
imp.setValue(propValues.getProperty("jco.perform.ilength0332"), "LGIT0332");
imp.setValue(propValues.getProperty("jco.perform.ilength1000"), "LGIT1000");
imp.setValue(propValues.getProperty("jco.perform.checktable"), "CHECKTAB");
com.sap.mw.jco.JCO.ParameterList tab = function.getTableParameterList();
fillTable(tab.getTable("ITAB0332"), imp.getInt("LGIT0332"));
fillTable(tab.getTable("ITAB1000"), imp.getInt("LGIT1000"));
try
{
client.execute(function);
}
catch(Throwable thr)
{
RfcTest.out.println("STFC_PERFORMANCE call failed, error message: \n");
RfcTest.displayException(thr);
System.exit(1);
return;
}
com.sap.mw.jco.JCO.ParameterList exp = function.getExportParameterList();
RfcTest.out.println("Import Parameter CHECKTAB: " + imp.getValue("CHECKTAB"));
RfcTest.out.println("Import Parameter LGIT0332: " + imp.getValue("LGIT0332"));
RfcTest.out.println("Import Parameter LGIT1000: " + imp.getValue("LGIT1000"));
RfcTest.out.println("Import Parameter LGET0332: " + imp.getValue("LGET0332"));
RfcTest.out.println("Import Parameter LGET1000: " + imp.getValue("LGET1000"));
RfcTest.out.println("\nExport Parameter EXITCODE: " + exp.getValue("EXITCODE"));
RfcTest.out.println("Export Parameter TEXT0332: '" + exp.getValue("TEXT0332") + "'");
RfcTest.out.println("Export Parameter TEXT1000: '" + exp.getValue("TEXT1000") + "'");
RfcTest.out.println();
RfcTest.out.println(checkTable("Export", tab.getTable("ETAB0332"), "0332", imp.getInt("LGET0332"), imp.getString("CHECKTAB")));
RfcTest.out.println(checkTable("Export", tab.getTable("ETAB1000"), "1000", imp.getInt("LGET1000"), imp.getString("CHECKTAB")));
RfcTest.out.println(checkTable("Import", tab.getTable("ITAB0332"), "0332", imp.getInt("LGIT0332"), imp.getString("CHECKTAB")));
RfcTest.out.println(checkTable("Import", tab.getTable("ITAB1000"), "1000", imp.getInt("LGIT1000"), imp.getString("CHECKTAB")));
if(propValues.getProperty("jco.perform.display_tab").equalsIgnoreCase("Y"))
{
String answer = RfcTest.ask("\n\nHit return key to display internal tables on screen", null);
for(int i = 0; i < tab.getFieldCount(); i++)
{
RfcTest.out.println("\n\nTable: " + tab.getName(i));
displayParameters(tab, i, false);
}
}
finalizeCall();
if(numberOfCalls > numberOfCall + 1)
{
RfcTest.ask("\n\n\nHit return key for next RFC call", null);
RfcTest.out.println("\n\n");
}
}
RfcTest.out.println("\n\n" + rhomb2 + " SAP JCo TEST - " + PERFORMANCE_TEST + " " + rhomb2 + "\n\n");
}
private static void runSapguiTest()
{
RfcTest.out.println("\n\n" + rhomb1 + " SAP JCo TEST - " + RFC_WITH_SAPGUI + " " + rhomb1 + "\n\n");
for(numberOfCall = 0; numberOfCall < numberOfCalls; numberOfCall++)
{
RfcTest.out.println("Not implemented, yet.");
if(numberOfCalls > numberOfCall + 1)
{
RfcTest.ask("\n\n\nHit return key for next RFC call", null);
RfcTest.out.println("\n\n");
}
}
RfcTest.out.println("\n\n" + rhomb2 + " SAP JCo TEST - " + RFC_WITH_SAPGUI + " " + rhomb2 + "\n\n");
}
private static void runStructureTest()
{
RfcTest.out.println("\n\n" + rhomb1 + " SAP JCo TEST - " + STRUCTURE_TEST + " " + rhomb1 + "\n\n");
for(numberOfCall = 0; numberOfCall < numberOfCalls; numberOfCall++)
{
initCall("STFC_STRUCTURE");
com.sap.mw.jco.JCO.Structure istruct = function.getImportParameterList().getStructure("IMPORTSTRUCT");
istruct.setValue(1000000D, "RFCFLOAT");
istruct.setValue("A", "RFCCHAR1");
istruct.setValue(1000, "RFCINT2");
istruct.setValue(10, "RFCINT1");
istruct.setValue("EXT.", "RFCCHAR4");
istruct.setValue(0x186a0, "RFCINT4");
istruct.setValue(new byte[] {
49, 50, 51
}, "RFCHEX3");
istruct.setValue("BC", "RFCCHAR2");
istruct.setValue("124500", "RFCTIME");
istruct.setValue("19960924", "RFCDATE");
istruct.setValue("01234567890123456789012345678901234567890123456789", "RFCDATA1");
istruct.setValue("01234567890123456789012345678901234567890123456789", "RFCDATA2");
com.sap.mw.jco.JCO.Table tab = function.getTableParameterList().getTable("RFCTABLE");
tab.copyFrom(istruct);
try
{
client.execute(function);
}
catch(Throwable thr)
{
RfcTest.out.println("STFC_STRUCTURE call failed, error message: \n");
RfcTest.displayException(thr);
System.exit(1);
return;
}
RfcTest.out.println("Import Parameter IMPORTSTRUCT:\n");
displayParameters(function.getImportParameterList(), 0, true);
RfcTest.out.println("\nExport Parameter ECHOSTRUCT:\n");
displayParameters(function.getExportParameterList(), 0, true);
RfcTest.out.println("\nInternal Table RFCTABLE:");
displayParameters(function.getTableParameterList(), 0, true);
finalizeCall();
if(numberOfCalls > numberOfCall + 1)
{
RfcTest.ask("\n\n\nHit return key for next RFC call", null);
RfcTest.out.println("\n\n");
}
}
RfcTest.out.println("\n\n" + rhomb2 + " SAP JCo TEST - " + STRUCTURE_TEST + " " + rhomb2 + "\n\n");
}
private static void runTranRfcTest()
{
RfcTest.TidManager tidManager = new RfcTest.TidManager("trfctest.tid");
RfcTest.out.println("\n\n" + rhomb1 + " SAP JCo TEST - " + TRANSACTIONAL_RFC + " " + rhomb1 + "\n\n");
for(numberOfCall = 0; numberOfCall < numberOfCalls; numberOfCall++)
{
initCall("STFC_WRITE_TO_TCPIC");
com.sap.mw.jco.JCO.Table tcpicdat = function.getTableParameterList().getTable("TCPICDAT");
for(int i = 0; i < 10; i++)
{
tcpicdat.appendRow();
tcpicdat.setValue("Line No " + i + " ASYN-Test - " + numberOfCall + " : 12345678901234567890123456789012", "LINE");
}
String tid;
try
{
tid = client.createTID();
tidManager.update_TID(tid, "CREATED");
}
catch(Throwable thr)
{
RfcTest.out.println("createTID call failed, error message: \n");
RfcTest.displayException(thr);
System.exit(1);
return;
}
try
{
client.execute(function, tid);
}
catch(Throwable thr)
{
RfcTest.out.println("STFC_WRITE_TO_TCPIC call failed, error message: \n");
RfcTest.displayException(thr);
System.exit(1);
return;
}
if(!client.isAlive())
try
{
client = JCO.createClient(propValues);
client.connect();
}
catch(Throwable thr)
{
RfcTest.out.println("Cannot create client, error message: \n");
RfcTest.displayException(thr);
System.exit(1);
return;
}
try
{
client.confirmTID(tid);
tidManager.update_TID(tid, "CONFIRMED");
}
catch(Throwable thr)
{
RfcTest.out.println("confirmTID call failed, error message: \n");
RfcTest.displayException(thr);
System.exit(1);
return;
}
finalizeCall();
if(numberOfCalls > numberOfCall + 1)
{
RfcTest.ask("\n\n\nHit return key for next RFC call", null);
RfcTest.out.println("\n\n");
}
}
RfcTest.out.println("\n\n" + rhomb2 + " SAP JCo TEST - " + TRANSACTIONAL_RFC + " " + rhomb2 + "\n\n");
}
private static void correctProperties()
{
numberOfCalls = Integer.parseInt(propValues.getProperty("jco.run.number_of_calls"));
if(propValues.getProperty("jco.client.type").equals("3"))
if(propValues.getProperty("jco.client.load_balancing").equalsIgnoreCase("N"))
{
propValues.setProperty("jco.client.ashost", propValues.getProperty("jco.client.iashost"));
propValues.setProperty("jco.client.sysnr", propValues.getProperty("jco.client.isysnr"));
propValues.remove("jco.client.r3name");
propValues.remove("jco.client.mhost");
propValues.remove("jco.client.group");
} else
{
propValues.setProperty("jco.client.r3name", propValues.getProperty("jco.client.ir3name"));
propValues.setProperty("jco.client.mhost", propValues.getProperty("jco.client.imhost"));
propValues.setProperty("jco.client.group", propValues.getProperty("jco.client.igroup"));
propValues.remove("jco.client.ashost");
propValues.remove("jco.client.sysnr");
}
if(propValues.getProperty("jco.client.type").equals("2"))
{
propValues.setProperty("jco.client.dest", propValues.getProperty("jco.client.idest"));
propValues.setProperty("jco.client.gwhost", propValues.getProperty("jco.client.igwhost"));
propValues.setProperty("jco.client.gwserv", propValues.getProperty("jco.client.igwserv"));
propValues.remove("jco.client.tpname");
} else
{
propValues.remove("jco.client.dest");
}
if(propValues.getProperty("jco.client.type").equals("E"))
{
if(propValues.getProperty("jco.client.registprog").equalsIgnoreCase("y"))
{
propValues.setProperty("jco.client.tpname", propValues.getProperty("jco.client.tpid"));
} else
{
propValues.setProperty("jco.client.tpname", propValues.getProperty("jco.client.itpname"));
propValues.setProperty("jco.client.tphost", propValues.getProperty("jco.client.itphost"));
}
propValues.setProperty("jco.client.gwhost", propValues.getProperty("jco.client.igwhost"));
propValues.setProperty("jco.client.gwserv", propValues.getProperty("jco.client.igwserv"));
}
if(propValues.getProperty("jco.client.type").equals("F"))
propValues.setProperty("jco.client.profile_name", propValues.getProperty("jco.client.iprofile_name"));
if(propValues.getProperty("jco.client.isnc_mode").equalsIgnoreCase("Y"))
{
propValues.setProperty("jco.client.snc_mode", "1");
propValues.setProperty("jco.client.snc_lib", propValues.getProperty("jco.client.isnc_lib"));
propValues.setProperty("jco.client.snc_partnername", propValues.getProperty("jco.client.isnc_partnername"));
} else
{
propValues.remove("jco.client.snc_mode");
propValues.remove("jco.client.snc_lib");
propValues.remove("jco.client.snc_partnername");
}
if(propValues.getProperty("jco.client.iabap_debug").equalsIgnoreCase("Y"))
propValues.setProperty("jco.client.abap_debug", "1");
else
propValues.setProperty("jco.client.abap_debug", "0");
if(propValues.getProperty("jco.client.iuse_sapgui").equalsIgnoreCase("N"))
propValues.setProperty("jco.client.use_sapgui", "0");
else
if(propValues.getProperty("jco.client.sapgui_invisible").equalsIgnoreCase("N"))
propValues.setProperty("jco.client.use_sapgui", "1");
else
propValues.setProperty("jco.client.use_sapgui", "2");
if(propValues.getProperty("jco.client.itrace").equalsIgnoreCase("Y"))
propValues.setProperty("jco.client.trace", "1");
else
propValues.setProperty("jco.client.trace", "0");
int traceLevel = Integer.parseInt(propValues.getProperty("jco.client.jco_trace_level"));
JCO.setTraceLevel(traceLevel);
if(traceLevel > 0)
JCO.setTracePath(".");
if(propValues.getProperty("jco.client.type").equals("E"))
{
propReposValues.setProperty("jco.client.client", propValues.getProperty("jco.client.iclient"));
propReposValues.setProperty("jco.client.user", propValues.getProperty("jco.client.iuser"));
propReposValues.setProperty("jco.client.passwd", propValues.getProperty("jco.client.ipasswd"));
propReposValues.setProperty("jco.client.lang", propValues.getProperty("jco.client.ilang"));
propReposValues.setProperty("jco.client.ashost", propValues.getProperty("jco.client.iashost"));
propReposValues.setProperty("jco.client.sysnr", propValues.getProperty("jco.client.isysnr"));
} else
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -