buf2buf copies all fields except system fields.(intercompany usefull)
data copies every thing including system fields.
static void updatesalesparameter(Args _args)
{
CompanyInfo CompanyInfo;
SalesParameters SalesParameters,SalesParameters1375;
CustParameters CustParameters,CustParameters1375;
CustLedger CustLedger;
changeCompany ('9999')
{
select CustParameters1375;
select SalesParameters1375;
}
select CompanyInfo where CompanyInfo.DataArea == "1997"
&& CompanyInfo.SON_Active == NoYes::Yes;
{
changeCompany(CompanyInfo.DataArea)
{
SalesParameters = null;
CustParameters = null;
CustLedger = null;
ttsBegin;
select forUpdate SalesParameters;
if(SalesParameters)
{
SalesParameters.OrderType = SalesType::Sales;
SalesParameters.doUpdate();
}
else
{
SalesParameters.clear();
//SalesParameters.BillOfLading = SalesShipping::None;
//SalesParameters.OrderType = SalesType::Sales;
//SalesParameters.BOLfreightChargeTerms = WMSFreightChargeTerms::Prepaid;
//SalesParameters.BOLfreightCounted = WMSFreightCounted::ByShipper;
//SalesParameters.BOLFreightedBy = WMSFreightedBy::Carrier;
//SalesParameters.BOLtrailerLoaded = WMSTrailerLoaded::ByShipper;
//SalesParameters.CreditNoteDocumentDateControlType_W = DateControlType_W::None;
//SalesParameters.CreditNoteInvoiceDateControlType_W = DateControlType_W::None;
//SalesParameters.MCRResourceNum_Acceptable = 3125;
//SalesParameters.MCRResourceNum_Questionable = 3127;
//SalesParameters.MCRResourceNum_Unacceptable = 3126;
//SalesParameters.OrderEntryStatistics = 5;
//SalesParameters.PromptQty = NoYes::Yes;
//SalesParameters.QuotationNumOfDaysExpiryDate =30;
//SalesParameters.QuotationNumOfDaysFollowUpDate =2;
//SalesParameters.SplitDeliveryPackingSlip = NoYes::Yes;
//SalesParameters.SplitDeliveryPickingList = NoYes::Yes;
//SalesParameters.insert();
buf2buf(SalesParameters1375, SalesParameters);
SalesParameters.OrderType = SalesType::Sales;
SalesParameters.insert();
}
select CustLedger where CustLedger.PostingProfile == 'Gen';
if(!CustLedger)
{
CustLedger.initValue();
CustLedger.PostingProfile = 'Gen';
CustLedger.insert();
}
CustLedger.clear();
select CustLedger where CustLedger.PostingProfile == 'Gen';
select forUpdate CustParameters;
if(CustParameters)
{
CustParameters.PostingProfile = CustLedger.PostingProfile;
CustParameters.doUpdate();
}
else
{
//CustParameters.clear();
//CustParameters.PostingProfile = CustLedger.PostingProfile;
//CustParameters.insert();
buf2buf(CustParameters1375, CustParameters);
CustParameters.PostingProfile = CustLedger.PostingProfile;
CustParameters.insert();
}
ttsCommit;
}
}
}
No comments:
Post a Comment