on 2019 Dec 03 8:29 AM
Hello Experts,
I try to overwrite Ship to address in Sale order, but I got the message "Must not be changed".
import ABSL;
import AP.CRM.Global;
// define SalesOrder root node
var elSalesOrder_Root: elementsof SalesOrder;
var instSalesOrder;
// define SalesOrder item node
var elSalesOrder_Item: elementsof SalesOrder.Item;
var instSalesOrder_Item;
elSalesOrder_Root.Name.content = "Heat Transfer Specialists";
elSalesOrder_Root.BuyerID.content = "Check";
// SalesOrder: create new instance
instSalesOrder = SalesOrder.Create(elSalesOrder_Root);
//Account
instSalesOrder.Party.GetFirst().RoleCode = "1001";
instSalesOrder.Party.GetFirst().PartyKey.PartyID.content = "CP100140";
var saveAccountData = instSalesOrder.Party.Create();
//Process Ship to Address
if(instSalesOrder.ProductRecipientParty.AddressSnapshot.IsSet())
{
var address = instSalesOrder.ProductRecipientParty.AddressSnapshot.PostalAddress.GetFirst();
address.CountryCode = "US";
address.RegionCode.content = "AK";
address.CityName = "CHARLOTTE";
address.StreetPostalCode="28269-0000";
address.StreetName="7777 STATESVILLE ROAD";
}
else
{
var address = instSalesOrder.ProductRecipientParty.AddressSnapshot.PostalAddress.Create();
address.RegionCode.content = "AK";
address.CityName = "CHARLOTTE";
address.StreetPostalCode="28269-0000";
address.StreetName="7777 STATESVILLE ROAD";
}
//Item
elSalesOrder_Item.ID = "1";
instSalesOrder_Item = instSalesOrder.Item.Create(elSalesOrder_Item);
instSalesOrder_Item.ItemProduct.ProductKey.ProductID.content = "P100205";
if (instSalesOrder_Item.FirstRequestedItemScheduleLine.IsSet()) {
// set product quantity and UOM (will be defaulted by the system if not set)
instSalesOrder_Item.FirstRequestedItemScheduleLine.Quantity.content = 10;
instSalesOrder_Item.FirstRequestedItemScheduleLine.Quantity.unitCode = "EA";
} else {
instSalesOrder_Item.FirstRequestedItemScheduleLine.Create();
instSalesOrder_Item.FirstRequestedItemScheduleLine.Quantity.content = 10;
instSalesOrder_Item.FirstRequestedItemScheduleLine.Quantity.unitCode = "EA";
}
//discount header
if(instSalesOrder.PriceAndTaxCalculation.MainDiscount.IsSet())
{
var discount = instSalesOrder.PriceAndTaxCalculation.MainDiscount;
discount.TypeCode.content = "0007";
discount.Rate.DecimalValue= -20;
discount.Rate.MeasureUnitCode = "P1";
}
else
{
var discount = instSalesOrder.PriceAndTaxCalculation.MainDiscount.Create();
discount.TypeCode.content = "0007";
discount.Rate.DecimalValue= -20;
discount.Rate.MeasureUnitCode = "P1";
}
//Charge header
if(instSalesOrder.PriceAndTaxCalculation.MainSurcharge.IsSet())
{
var discount = instSalesOrder.PriceAndTaxCalculation.MainSurcharge;
discount.TypeCode.content = "7PR8";
discount.Rate.DecimalValue= 30;
discount.Rate.CurrencyCode = "USD";
}
else
{
var discount = instSalesOrder.PriceAndTaxCalculation.MainSurcharge.Create();
discount.TypeCode.content = "7PR8";
discount.Rate.DecimalValue= 30;
discount.Rate.CurrencyCode = "USD";
}
How can I Overwrite Ship to Address of Sale order when I create SO by ABSL?
Regards,
Quyen
Hello Quyen,
In general: A Snapshot cannot be changed at all. 😞
You need to find the correct place where the ship-to-address is maintained.
HTH,
. Horst
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
71 | |
10 | |
8 | |
7 | |
7 | |
6 | |
6 | |
6 | |
6 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.