JCO.ParameterList params = function.getImportParameterList();
JCO.Structure structure1 = params.getStructure("CLIENTDATA");
JCO.Structure structure2 = params.getStructure("CLIENTDATAX");
JCO.Structure structure3 = params.getStructure("PLANTDATA");
JCO.Structure structure4 = params.getStructure("PLANTDATAX");
JCO.Structure structure5 = params.getStructure("VALUATIONDATA");
JCO.Structure structure6 = params.getStructure("VALUATIONDATAX");
JCO.Structure structure7 = params.getStructure("HEADDATA");
JCO.Structure structure = null;
//基本視圖1
碼率 structure1.setValue(curDoc.getItemValueString("F_BaseUom"), "BASE_UOM"); // 物料基本單位
//基本視圖2
structure1.setValue("X", "BASE_UOM");
// 頭數據
structure7.setValue(material, "MATERIAL"); //物料編碼
structure7.setValue(curDoc.getItemValueString("F_IndSector"), "IND_SECTOR"); //行業領域
structure7.setValue(matlType, "MATL_TYPE"); //物料類型
structure7.setValue("X", "BASIC_VIEW"); //基本數據視圖
structure7.setValue("X", "PURCHASE_VIEW"); //採購視圖
structure7.setValue("X", "ACCOUNT_VIEW"); //會計視圖
//採購視圖
structure3.setValue(curDoc.getItemValueString("F_Plant"), "PLANT"); //工廠
structure1.setValue(matlGroup, "MATL_GROUP"); // 物料組
structure3.setValue(curDoc.getItemValueString("F_PurGroup"), "PUR_GROUP"); //採購組
structure3.setValue(curDoc.getItemValueString("F_IndPostToInspStock"), "IND_POST_TO_INSP_STOCK"); //過賬到檢驗庫存
structure4.setValue(curDoc.getItemValueString("F_Plant"), "PLANT"); //工廠
structure4.setValue("X", "PUR_GROUP"); //採購組
structure4.setValue("X", "IND_POST_TO_INSP_STOCK"); //過賬到檢驗庫存
//會計視圖
structure3.setValue(curDoc.getItemValueString("F_Plant"), "PLANT"); //工廠
structure5.setValue("1000", "VAL_AREA"); //估價範圍
structure5.setValue(curDoc.getItemValueString("F_ValClass"), "VAL_CLASS"); //評估類
structure5.setValue(curDoc.getItemValueString("F_PRICECTRL"), "PRICE_CTRL"); //價格控制指示符
structure5.setValue(curDoc.getItemValueString("F_StdPrice"), "STD_PRICE"); //標準價格
structure6.setValue("1000", "VAL_AREA"); //估價範圍
structure6.setValue("X", "PRICE_CTRL"); //價格控制指示符
structure6.setValue("X", "STD_PRICE"); //標準價格
structure6.setValue("X", "VAL_CLASS"); //評估類
params = function.getTableParameterList();
JCO.Table table = null;
table = params.getTable("MATERIALDESCRIPTION");
table.appendRow();
table.setValue("ZH", "LANGU_ISO");
table.setValue("1", "LANGU");
table.setValue(matlDesc, "MATL_DESC"); //物料描述
table = params.getTable("TAXCLASSIFICATIONS");
table.appendRow();
//table.setValue(curDoc.getItemValueString("F_TaxClass1"),"TAXCLASS_1"); //物料的稅分類*/
try{
mConnection.execute(function);}catch(Exception e1) {
e1.printStackTrace();
retmsg="出現錯誤: "+e1;
}
com.sap.mw.jco.JCO.Structure returnStructure = (Structure) function
.getExportParameterList().getValue("RETURN");
//pw.println(returnStructure.getString("TYPE"));
if (!returnStructure.getString("TYPE").equals("")
&& !returnStructure.getString("TYPE").equals("S")) {
retmsg = returnStructure.getString("MESSAGE");
retmsg = retmsg + "出錯1111,沒有成功導入"+curDoc.getItemValueString("F_StdPrice");
} else {
function = createFunction("BAPI_TRANSACTION_COMMIT");
if (function == null) {
retmsg="BAPI2不存在";
}
params = function.getImportParameterList();
params.setValue("X", "WAIT");
try{
mConnection.execute(function);}catch(Exception e2) {
e2.printStackTrace();
retmsg="出現錯誤: "+e2;
}
params = function.getExportParameterList();
JCO.Structure returnStru = params.getStructure("RETURN");
if (!returnStru.getString("TYPE").equals("") && !returnStru.getString("TYPE").equals("S")) {
retmsg = "出錯2";
} else {System.out.println(curDoc.getItemValueString("F_PRICECTRL"));
retmsg = "";
}
}
以上程序執行成功,未捕獲到任何錯誤,但實際上SAP中未這個條數據,哪位高手能告訴這是爲何嗎!是否是還要執行什麼BAPIweb