如何用外币创建DI一揽子协议?

2020-09-04 05:22发布

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


你好!

通过DI一揽子协议创建时遇到问题。

在执行方法AddBlanketAgreement BlanketAgreementsService对象后,我们收到:

-文本" PlannedAmountLC中的无效货币OAT1"或

错误

-一揽子协议是使用主要货币系统而非外币创建的

当我们在用户界面中创建此一揽子协议手册时,我们已经取得了成功。 也许我们必须更改系统主设置?

我们正在等待一些建议,谢谢!

我们的主要代码行:

 SAPbobsCOM.BlanketAgreementsService oBargSer = oCompanyService.GetBusinessService(SAPbobsCOM.ServiceTypes.BlanketAgreementsService)作为SAPbobsCOM.BlanketAgreementsService;
 SAPbobsCOM.BlanketAgreement oBarg = oBargSer.GetDataInterface(SAPbobsCOM.BlanketAgreementsServiceDataInterfaces.basBlanketAgreement)as SAPbobsCOM.BlanketAgreement;
 SAPbobsCOM.BlanketAgreements_ItemsLine oBarg_i;
 SAPbobsCOM.BlanketAgreementParams oParams = oBargSer.GetDataInterface(SAPbobsCOM.BlanketAgreementsServiceDataInterfaces.basBlanketAgreementParams)作为SAPbobsCOM.BlanketAgreementParams;
 SAPbobsCOM.Currencies oCurr = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oCurrencyCodes)作为SAPbobsCOM.Currencies;
 oBarg.EndDate = Convert.ToDateTime(" 12,31," + DateTime.Today.Year +""); //датазакінчення-кінецьроку
 query2 ="从OCRD U_1C_GUID ='"中选择CardCode ="" + oRset.Fields.Item(" BpGUID")。Value.ToString()+"'";
 oRset2.DoQuery(query2);
 if(oRset2.RecordCount == 1)
 oBarg.BPCode = oRset2.Fields.Item(" CardCode")。Value.ToString();
 oCurr.GetByKey(oCurr.Code = oRset.Fields.Item(" BPCurr")。Value.ToString());
 oBarg.BPCurrency = oCurr.Code;
 oBarg.AgreementMethod = SAPbobsCOM.BlanketAgreementMethodEnum.amMonetary;
 oBarg.Description = oRset.Fields.Item(" Descript")。Value.ToString();
 sql ="从OHEM中选择empID,其中ExtEmpNo = N'" + oRset.Fields.Item(" Owner")。Value.ToString()+"'";
 dt = select(sql);
 如果(dt.Rows.Count> 0)
 oBarg.Owner = Convert.ToInt32(dt.Rows [0] [0]);
 sql ="从OCTG WHERE PymntGroup = N'中选择GroupNum" + oRset.Fields.Item(" GroupNum")。Value.ToString()+"'";
 dt = select(sql);
 如果(dt.Rows.Count> 0)
 oBarg.PaymentTerms = Convert.ToInt32(dt.Rows [0] [0]);
 sql ="从OPYM WHERE描述= N'"中选择PayMethCod + oRset.Fields.Item(" PayMethod")。Value.ToString()+"'";
 dt = select(sql);
 如果(dt.Rows.Count> 0)
 oBarg.PaymentMethod = dt.Rows [0] [0] .ToString();
 如果(oBarg.BlanketAgreements_ItemsLines.Count == 1)
 oBarg.BlanketAgreements_ItemsLines.Remove(0);
 oBarg_i = oBarg.BlanketAgreements_ItemsLines.Add();
 oBarg_i.PriceCurrency = oCurr.Code;
 oBarg_i.PlannedAmountFC = 1.0000;
 oBarg_i.PlannedAmountLC = 28.0000;
 oBarg.Status = SAPbobsCOM.BlanketAgreementStatusEnum.asApproved;
 oBargSer.AddBlanketAgreement(oBarg); 

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


你好!

通过DI一揽子协议创建时遇到问题。

在执行方法AddBlanketAgreement BlanketAgreementsService对象后,我们收到:

-文本" PlannedAmountLC中的无效货币OAT1"或

错误

-一揽子协议是使用主要货币系统而非外币创建的

当我们在用户界面中创建此一揽子协议手册时,我们已经取得了成功。 也许我们必须更改系统主设置?

我们正在等待一些建议,谢谢!

我们的主要代码行:

 SAPbobsCOM.BlanketAgreementsService oBargSer = oCompanyService.GetBusinessService(SAPbobsCOM.ServiceTypes.BlanketAgreementsService)作为SAPbobsCOM.BlanketAgreementsService;
 SAPbobsCOM.BlanketAgreement oBarg = oBargSer.GetDataInterface(SAPbobsCOM.BlanketAgreementsServiceDataInterfaces.basBlanketAgreement)as SAPbobsCOM.BlanketAgreement;
 SAPbobsCOM.BlanketAgreements_ItemsLine oBarg_i;
 SAPbobsCOM.BlanketAgreementParams oParams = oBargSer.GetDataInterface(SAPbobsCOM.BlanketAgreementsServiceDataInterfaces.basBlanketAgreementParams)作为SAPbobsCOM.BlanketAgreementParams;
 SAPbobsCOM.Currencies oCurr = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oCurrencyCodes)作为SAPbobsCOM.Currencies;
 oBarg.EndDate = Convert.ToDateTime(" 12,31," + DateTime.Today.Year +""); //датазакінчення-кінецьроку
 query2 ="从OCRD U_1C_GUID ='"中选择CardCode ="" + oRset.Fields.Item(" BpGUID")。Value.ToString()+"'";
 oRset2.DoQuery(query2);
 if(oRset2.RecordCount == 1)
 oBarg.BPCode = oRset2.Fields.Item(" CardCode")。Value.ToString();
 oCurr.GetByKey(oCurr.Code = oRset.Fields.Item(" BPCurr")。Value.ToString());
 oBarg.BPCurrency = oCurr.Code;
 oBarg.AgreementMethod = SAPbobsCOM.BlanketAgreementMethodEnum.amMonetary;
 oBarg.Description = oRset.Fields.Item(" Descript")。Value.ToString();
 sql ="从OHEM中选择empID,其中ExtEmpNo = N'" + oRset.Fields.Item(" Owner")。Value.ToString()+"'";
 dt = select(sql);
 如果(dt.Rows.Count> 0)
 oBarg.Owner = Convert.ToInt32(dt.Rows [0] [0]);
 sql ="从OCTG WHERE PymntGroup = N'中选择GroupNum" + oRset.Fields.Item(" GroupNum")。Value.ToString()+"'";
 dt = select(sql);
 如果(dt.Rows.Count> 0)
 oBarg.PaymentTerms = Convert.ToInt32(dt.Rows [0] [0]);
 sql ="从OPYM WHERE描述= N'"中选择PayMethCod + oRset.Fields.Item(" PayMethod")。Value.ToString()+"'";
 dt = select(sql);
 如果(dt.Rows.Count> 0)
 oBarg.PaymentMethod = dt.Rows [0] [0] .ToString();
 如果(oBarg.BlanketAgreements_ItemsLines.Count == 1)
 oBarg.BlanketAgreements_ItemsLines.Remove(0);
 oBarg_i = oBarg.BlanketAgreements_ItemsLines.Add();
 oBarg_i.PriceCurrency = oCurr.Code;
 oBarg_i.PlannedAmountFC = 1.0000;
 oBarg_i.PlannedAmountLC = 28.0000;
 oBarg.Status = SAPbobsCOM.BlanketAgreementStatusEnum.asApproved;
 oBargSer.AddBlanketAgreement(oBarg); 
付费偷看设置
发送
3条回答
槿木_熙
1楼-- · 2020-09-04 06:26

亲爱的 Andrii Slyzhuk

我已经在SAP Business中测试了该问题 一个版本9.3 PL10和我已经能够使用以下代码通过DI API创建具有外币的一揽子协议:

SAPbobsCOM.BlanketAgreementsService sbaService =(SAPbobsCOM.BlanketAgreementsService)oCompany.GetCompanyService()。GetBusinessService(SAPbobsCOM.ServiceTypes.BlanketAgreementsService);
SAPbobsCOM.BlanketAgreement ba =(SAPbobsCOM.BlanketAgreement)sbaService.GetDataInterface(SAPbobsCOM.BlanketAgreementsServiceDataInterfaces.basBlanketAgreement);
SAPbobsCOM.BlanketAgreementParssBlansBlansBlansBlansBlansBlansBlansAlansBlansBlansBlanketBlans );
SAPbobsCOM.BlanketAgreements_ItemsLine itemLine;
string baMode ="总值";
字符串baMethod ="货币";
int planningAmountFC = 1000;
ba.BPCode =" C70000";
ba.EndDate = DateTime.Today;
ba.Description ="测试外币";
ba.Status = SAPbobsCOM.BlanketAgreementStatusEnum.asApproved;

if(baMode ==" Gross")
{
ba.PriceMode = SAPbobsCOM.PriceModeEnum.pmGross;
}
else
{
ba.PriceMode = SAPbobsCOM.PriceModeEnum.pmNet;
}

if(baMethod == " I")
{
ba.AgreementMethod = SAPbobsCOM.BlanketAgreementMethodEnum.amItem;
itemLine = ba.BlanketAgreements_ItemsLines .Add();
itemLine.ItemNo =" I01";
itemLine.PlannedQuantity = 100;
itemLine .UnitPrice = 100;
itemLine = ba.BlanketAgreements_ItemsLines.Add();
itemLine.ItemNo =" I02";
itemLine.PlannedQuantity = 100;
itemLin e.UnitPrice = 100;
}
else
{
ba .AgreementMethod = SAPbobsCOM.BlanketAgreementMethodEnum.amMonetary;
ba.PriceList = 1;
itemLine = ba.BlanketAgreements_ItemsLines.Add(); < br> if(plannedAmountFC!= 0)
{
itemLine.PlannedAmountFC = plannedAmountFC;
}
else
{
itemLine.PlannedAmountLC = 10000;
}
}
sbaPara = sbaService.AddBlanketAgreement(ba);

我们会请您检查您的项目代码

希望如此!

问候,

ANKIT CHAUHAN >

SAP Business One支持

95年老男孩
2楼-- · 2020-09-04 06:18

尊敬的 ANKIT CHAUHAN

我们已经通过了您的代码测试,遇到了一些麻烦。 我们认为您的业务伙伴" C7000"在"货币"字段中只有"美元"。 但是我们的业务合作伙伴必须在"货币"字段中拥有"所有债务"。

我们正在等待您的建议,

Tong__Ming
3楼-- · 2020-09-04 06:26

您好,Andrew Barabash Andrii Slyzhuk

该问题已被分类为错误,并且应该在即将发布的修补程序或版本中得到修复。 继续检查SAP Note 2826372

< em>请注意,更改时间范围或解决问题的决定可能会随时更改,恕不另行通知。

亲切的问候,

< p> ANKIT CHAUHAN

SAP Business One支持

一周热门 更多>