1.导入Interop.SAPFunctionsOCX.dll Interop.SAPlogonCtrl.dll Interop.SAPTableFactoryCtrl
2.
com端口,缺点:占用线程,单线程
private void getCurrentStock(object obj)
{
SPItemEventProperties Pro = (SPItemEventProperties)obj;
SPListItem item = Pro.ListItem;
SAPFunctionsOCX.SAPFunctionsClass func = VStoSAP.getSAPFunctionsClass("", "");
if (func != null)
{
string MaterialNo = getSPFieldTextValue(item["Material"]);
string Plant = getSPFieldTextValue(item["Plant"]);
SAPFunctionsOCX.IFunction ifunc = (SAPFunctionsOCX.IFunction)func.Add("ZRFC_MM_MASTER_MRB");
SAPFunctionsOCX.IParameter IV_MATNR = (SAPFunctionsOCX.IParameter)ifunc.get_Exports("IV_MATNR"); //Material No.
SAPFunctionsOCX.IParameter IV_WERKS = (SAPFunctionsOCX.IParameter)ifunc.get_Exports("IV_WERKS"); //Plant
IV_MATNR.Value = MaterialNo;
IV_WERKS.Value = Plant;
ifunc.Call();
SAPFunctionsOCX.IParameter EV_MAKTX = (SAPFunctionsOCX.IParameter)ifunc.get_Imports("EV_MAKTX");
SAPFunctionsOCX.IParameter EV_PRICE = (SAPFunctionsOCX.IParameter)ifunc.get_Imports("EV_PRICE");
SAPFunctionsOCX.IParameter EV_MEINS = (SAPFunctionsOCX.IParameter)ifunc.get_Imports("EV_MEINS");
SAPFunctionsOCX.IParameter EV_DSNAM = (SAPFunctionsOCX.IParameter)ifunc.get_Imports("EV_DSNAM");
if (EV_MAKTX != null && EV_MAKTX.Value != null)
{
item["Description"] =