JCO使用BAPI_MATERIAL_SAVEDATA,下列程序是否有误!!
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中未这个条数据,哪位高手能告诉这是为什么吗!是不是还要执行什么BAPI
posted on 2014-01-16 08:50 anuo_ruibo 阅读(581) 评论(0) 编辑 收藏 举报