Why can't create New PO Suggestions via Erp.Adapters.POSugg.dll and Erp.Contracts.BO.POSugg.dll

I want to create New PO Suggestions (SugPoDtl) for Requisition

For example, 1 Requisitions has 5 Lines that have been Generate Suggestions and have 3 lines of PO that have been generated PO Sugges and have created POs as part of Requisition
but due to mistakenly deleting PO Suggestions in the Purchase Order Suggestion Entry screen
Cannot Reset Dispatching part of Requisition to generate PO Sugges
I tried to create PO Suggestions using Adapter but received a message:
Description: Cannot create Suggstions with this object
Program: Erp.Services.BO.POSugg.dll
Method: SugPoDtlBeforeGetNew
Line Number: 4128
Column Number: 13
Table: SugPoDtl
Temporarily, I use BAQ update’s BPM and use Erp.Tables; và Ice.Tablesets;
DMS_GetNewPoSuggFromReq.baq (86.1 KB)

if (ttResults != null )
 {
  try
  {         
    if (ttResults.Count>0)
    {
      foreach (var item in ttResults.AsEnumerable())
      {
          /*
          var boSugPOService = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.POSuggSvcContract>(Db);
          Erp.Tablesets.POSuggTableset POSugg_Updated = new Erp.Tablesets.POSuggTableset();
          var sugPONewRow = POSugg_Updated.SugPoDtl.NewRow();   
          POSugg_Updated.SugPoDtl.Add(sugPONewRow);        
          //boSugPOService.GetNewSugPoDtl(ref POSugg_Updated);    
          //POSugg_Updated.SugPoDtl[0].SugNum =  6099011;
          POSugg_Updated.SugPoDtl[0].BuyerID = "23020104";
          POSugg_Updated.SugPoDtl[0].SugType = "M";
          POSugg_Updated.SugPoDtl[0].Plant =  Session.PlantID;
          POSugg_Updated.SugPoDtl[0].PartNum = item.ReqDetail_PartNum;
          POSugg_Updated.SugPoDtl[0].LineDesc = item.ReqDetail_LineDesc;  
          POSugg_Updated.SugPoDtl[0].CommentText = item.ReqDetail_CommentText;  
          POSugg_Updated.SugPoDtl[0].ClassID = item.ReqDetail_Class;  
          POSugg_Updated.SugPoDtl[0].PurchasingFactor = item.ReqDetail_PurchasingFactor;
          
          POSugg_Updated.SugPoDtl[0].RelQty = item.ReqDetail_OrderQty;
          POSugg_Updated.SugPoDtl[0].IUM = item.ReqDetail_RUM;
          POSugg_Updated.SugPoDtl[0].XRelQty = item.ReqDetail_XOrderQty;
          POSugg_Updated.SugPoDtl[0].IUM = item.ReqDetail_IUM;
          POSugg_Updated.SugPoDtl[0].ReqNum = item.ReqDetail_ReqNum;
          POSugg_Updated.SugPoDtl[0].ReqLine = item.ReqDetail_ReqLine;
          POSugg_Updated.SugPoDtl[0].DueDate = item.ReqDetail_DueDate;    
          POSugg_Updated.SugPoDtl[0].Taxable = item.ReqDetail_Taxable;
          POSugg_Updated.SugPoDtl[0].CostPerCode = item.ReqDetail_CostPerCode;
          POSugg_Updated.SugPoDtl[0].PurchasingFactorDirection = item.ReqDetail_PurchasingFactorDirection;
          //boSugPOService.ChangeVendor(item.Vendor_VendorID, ref POSugg_Updated);  
          POSugg_Updated.SugPoDtl[0].VendorID = item.Vendor_VendorID;                    
          POSugg_Updated.SugPoDtl[0].VendorNum = item.ReqDetail_VendorNum;          
          POSugg_Updated.SugPoDtl[0].PurPoint = item.ReqDetail_PurPoint;
          POSugg_Updated.SugPoDtl[0].CurrencyCode = item.ReqDetail_CurrencyCode;      
          POSugg_Updated.SugPoDtl[0].RowMod = "A";     
          boSugPOService.Update(ref POSugg_Updated);        
          */
          //------------------------
          SugPoDtl newRowSugPO = new SugPoDtl();
          newRowSugPO.Company =  callContextClient.CurrentCompany;
          //newRowSugPO.SugNum =  6099011;
          newRowSugPO.BuyerID =  item.Calculated_BuyerID;
          newRowSugPO.SugType = "M";
          newRowSugPO.Plant =  item.Calculated_Plant;
          newRowSugPO.PartNum = item.ReqDetail_PartNum;
          newRowSugPO.LineDesc = item.ReqDetail_LineDesc;  
          newRowSugPO.CommentText = item.ReqDetail_CommentText;  
          newRowSugPO.ClassID = item.ReqDetail_Class;  
          newRowSugPO.PurchasingFactor = item.ReqDetail_PurchasingFactor;
          
          newRowSugPO.RelQty = item.ReqDetail_OrderQty;
          newRowSugPO.PUM = item.ReqDetail_RUM;
          newRowSugPO.UnitPrice = item.ReqDetail_UnitCost;
          newRowSugPO.XRelQty = item.ReqDetail_XOrderQty;
          newRowSugPO.IUM = item.ReqDetail_IUM;
          newRowSugPO.DocUnitPrice = item.ReqDetail_DocUnitCost;
          newRowSugPO.ReqNum = item.ReqDetail_ReqNum;
          newRowSugPO.ReqLine = item.ReqDetail_ReqLine;
          newRowSugPO.DueDate = item.ReqDetail_DueDate;               
          newRowSugPO.Taxable = item.ReqDetail_Taxable;
          newRowSugPO.CostPerCode = item.ReqDetail_CostPerCode;
          newRowSugPO.PurchasingFactorDirection = item.ReqDetail_PurchasingFactorDirection;         
          newRowSugPO.VendorID = item.Vendor_VendorID;   
          newRowSugPO.Name = item.Vendor_Name;   
          newRowSugPO.VendorNum = item.ReqDetail_VendorNum;          
          newRowSugPO.PurPoint = item.ReqDetail_PurPoint;
          newRowSugPO.TermsCode = item.Vendor_TermsCode;  
          newRowSugPO.FOB = item.Vendor_DefaultFOB;
          newRowSugPO.ShipViaCode = item.XaSyst_DefaultShipViaCode;
          newRowSugPO.WarehouseCode = item.Calculated_PrimWhse;
          newRowSugPO.LeadTime = item.Calculated_LeadTime;
          newRowSugPO.OrderByDate = item.ReqDetail_DueDate.Value.AddDays(-item.Calculated_LeadTime); //The date the item needs to be ordered by in order to be received by the Due Date.   DueDate - Lead Time.  
          newRowSugPO.CurrencyCode = item.ReqDetail_CurrencyCode;             
          Db.SugPoDtl.Insert(newRowSugPO);
          Db.Validate(); // save changes to DB
          Db.SaveChanges();
      }
    }
  }
  catch(Exception ex)
  {
     this.PublishInfoMessage(ex.Message, Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "DMS-BAQ BPM","Create POSugg Req");
  } 
}
with [DefaultOfPart] as 
(select 
	[PartPlant_Default].[Company] as [PartPlant_Default_Company],
	[PartPlant_Default].[Plant] as [PartPlant_Default_Plant],
	[PartPlant_Default].[PartNum] as [PartPlant_Default_PartNum],
	[PartPlant_Default].[PrimWhse] as [PartPlant_Default_PrimWhse],
	[PartPlant_Default].[LeadTime] as [PartPlant_Default_LeadTime],
	[PartPlant_Default].[BuyerID] as [PartPlant_Default_BuyerID],
	[PartPlant_Default].[PersonID] as [PartPlant_Default_PersonID],
	[PartPlant_Default].[CostMethod] as [PartPlant_Default_CostMethod],
	((case when PartPlant_Default.Plant=Constants.CurrentPlant then 0  else 1 end)) as [Calculated_CurrentPlant],
	(DENSE_RANK () OVER (PARTITION BY PartPlant_Default.Company, PartPlant_Default.PartNum order by PartPlant_Default.Company,CurrentPlant,PartPlant_Default.Plant )) as [Calculated_RankDese]
from Erp.PartPlant as PartPlant_Default)

select 
	[ReqDetail].[Company] as [ReqDetail_Company],
	[ReqDetail].[OpenLine] as [ReqDetail_OpenLine],
	[ReqDetail].[ReqNum] as [ReqDetail_ReqNum],
	[ReqDetail].[ReqLine] as [ReqDetail_ReqLine],
	[ReqDetail].[LineDesc] as [ReqDetail_LineDesc],
	[ReqDetail].[PartNum] as [ReqDetail_PartNum],
	[ReqHead].[Company] as [ReqHead_Company],
	[ReqHead].[ReqNum] as [ReqHead_ReqNum],
	[ReqDetail].[IUM] as [ReqDetail_IUM],
	[ReqDetail].[UnitCost] as [ReqDetail_UnitCost],
	[ReqDetail].[DocUnitCost] as [ReqDetail_DocUnitCost],
	[ReqDetail].[Taxable] as [ReqDetail_Taxable],
	[ReqDetail].[RUM] as [ReqDetail_RUM],
	[ReqDetail].[CostPerCode] as [ReqDetail_CostPerCode],
	[ReqDetail].[VenPartNum] as [ReqDetail_VenPartNum],
	[ReqDetail].[CommentText] as [ReqDetail_CommentText],
	[ReqDetail].[Class] as [ReqDetail_Class],
	[ReqDetail].[RevisionNum] as [ReqDetail_RevisionNum],
	[ReqDetail].[RcvInspectionReq] as [ReqDetail_RcvInspectionReq],
	[ReqDetail].[VendorNum] as [ReqDetail_VendorNum],
	[ReqDetail].[PurPoint] as [ReqDetail_PurPoint],
	[ReqDetail].[PurchasingFactor] as [ReqDetail_PurchasingFactor],
	[ReqDetail].[DueDate] as [ReqDetail_DueDate],
	[ReqDetail].[PONUM] as [ReqDetail_PONUM],
	[ReqDetail].[POLine] as [ReqDetail_POLine],
	[ReqDetail].[PORelNum] as [ReqDetail_PORelNum],
	[ReqDetail].[JobNum] as [ReqDetail_JobNum],
	[ReqDetail].[PrcConNum] as [ReqDetail_PrcConNum],
	[ReqDetail].[CurrencyCode] as [ReqDetail_CurrencyCode],
	[ReqDetail].[ExchangeRate] as [ReqDetail_ExchangeRate],
	[ReqDetail].[LockRate] as [ReqDetail_LockRate],
	[ReqDetail].[ReqDate] as [ReqDetail_ReqDate],
	[ReqDetail].[OrderQty] as [ReqDetail_OrderQty],
	[ReqDetail].[XOrderQty] as [ReqDetail_XOrderQty],
	[ReqDetail].[JobSeqType] as [ReqDetail_JobSeqType],
	[ReqDetail].[TranType] as [ReqDetail_TranType],
	[ReqDetail].[GlbCompany] as [ReqDetail_GlbCompany],
	[ReqDetail].[GlbReqNum] as [ReqDetail_GlbReqNum],
	[ReqDetail].[GlbReqLine] as [ReqDetail_GlbReqLine],
	[ReqDetail].[PurchasingFactorDirection] as [ReqDetail_PurchasingFactorDirection],
	[ReqDetail].[Rpt1UnitCost] as [ReqDetail_Rpt1UnitCost],
	[ReqDetail].[Rpt2UnitCost] as [ReqDetail_Rpt2UnitCost],
	[ReqDetail].[Rpt3UnitCost] as [ReqDetail_Rpt3UnitCost],
	[ReqDetail].[RateGrpCode] as [ReqDetail_RateGrpCode],
	[ReqDetail].[MfgNum] as [ReqDetail_MfgNum],
	[ReqDetail].[MfgPartNum] as [ReqDetail_MfgPartNum],
	[ReqDetail].[SysRevID] as [ReqDetail_SysRevID],
	[ReqDetail].[SysRowID] as [ReqDetail_SysRowID],
	[ReqDetail].[OverridePriceList] as [ReqDetail_OverridePriceList],
	[ReqDetail].[EpicorFSA] as [ReqDetail_EpicorFSA],
	[ReqDetail].[Date09] as [ReqDetail_Date09],
	[ReqDetail].[CheckBox06] as [ReqDetail_CheckBox06],
	[ReqDetail].[ShortChar10] as [ReqDetail_ShortChar10],
	[ReqDetail].[ShortChar03] as [ReqDetail_ShortChar03],
	[ReqDetail].[CheckBox01] as [ReqDetail_CheckBox01],
	[ReqDetail].[Character10] as [ReqDetail_Character10],
	[Vendor].[VendorID] as [Vendor_VendorID],
	[Vendor].[TermsCode] as [Vendor_TermsCode],
	[Vendor].[DefaultFOB] as [Vendor_DefaultFOB],
	(isnull(DefaultOfPart.PartPlant_Default_Plant, Constants.CurrentPlant)) as [Calculated_Plant],
	(isnull(DefaultOfPart.PartPlant_Default_LeadTime, isnull(UD04.Number01,10))) as [Calculated_LeadTime],
	(isnull(DefaultOfPart.PartPlant_Default_PrimWhse,N'')) as [Calculated_PrimWhse],
	(isnull(DefaultOfPart.PartPlant_Default_BuyerID,N'')) as [Calculated_BuyerID],
	[XaSyst].[DefaultShipViaCode] as [XaSyst_DefaultShipViaCode],
	[Vendor].[Name] as [Vendor_Name]
from Erp.ReqDetail as ReqDetail
inner join Erp.ReqHead as ReqHead on 
	ReqDetail.Company = ReqHead.Company
	and ReqDetail.ReqNum = ReqHead.ReqNum
	and ( ReqHead.ReqActionID = 'CMH'  )

inner join Erp.VendorPP as VendorPP on 
	ReqDetail.Company = VendorPP.Company
	and ReqDetail.VendorNum = VendorPP.VendorNum
	and ReqDetail.PurPoint = VendorPP.PurPoint
inner join Erp.Vendor as Vendor on 
	VendorPP.Company = Vendor.Company
	and VendorPP.VendorNum = Vendor.VendorNum
left outer join Ice.UD04 as UD04 on 
	UD04.Company = ReqDetail.Company
	and UD04.Key1 = ReqDetail.PartNum
inner join Erp.XaSyst as XaSyst on 
	ReqDetail.Company = XaSyst.Company
left outer join  DefaultOfPart  as DefaultOfPart on 
	ReqDetail.Company = DefaultOfPart.PartPlant_Default_Company
	and ReqDetail.PartNum = DefaultOfPart.PartPlant_Default_PartNum
	and ( DefaultOfPart.Calculated_RankDese = 1  )

where (ReqDetail.Company = @CurrentCompany  and ReqDetail.OpenLine = 1  and ReqDetail.ReqNum = @ReqNum  and ReqDetail.ReqLine = @ReqLine)


With this method, I have to get the exact information of each column of PO Suggestions to assign to it. I cannot use the built-in functions of Erp.Adapters.POSugg like other screens.
I researched and found a suggestion to create PO directly from the remaining 2 lines of Requisition but currently I still want to go through PO Suggestions
In BPM, I have not checked the ReqNum condition, ReqLine will not be created PO Suggestions
Thank you very much! Have a good day! :smiling_face_with_three_hearts: :smiling_face_with_three_hearts:

if they were deleted they should be remade if you rerun generate suggestions.

1 Like

I tried running it again but it didn’t work. Just use Reset Dispatching Requisition and then run generate suggestions but it will have to Reset Dispatching the entire Requisition and management will have to review this. The company doesn’t want to.

Thank you very much! Have a good day! :smiling_face_with_three_hearts: :smiling_face_with_three_hearts:

I don’t know what Reset Dispatching is, but we totally clear and regen every weekend.

1 Like

Reset Dispatching:


The request will be approved through level 2 and a proposal will be created.

select * from ReqActs where Company='01'


Currently, the company also automatically runs generate suggestions at 12 noon every day!

Thank you very much! Have a good day! :smiling_face_with_three_hearts: :smiling_face_with_three_hearts: