cancel
Showing results for 
Search instead for 
Did you mean: 

Overwrite Ship to Address of Sale order VIA ABSL

former_member535084
Participant
0 Kudos
459

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

former_member535084
Participant
0 Kudos

@may.thitsaoo ,horst.schaude

Do you have any idea ?

Thank

Quyen

View Entire Topic
HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

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

former_member535084
Participant
0 Kudos

Hello Horst,

I do not want to overwrite the current ship to that setup default in Account.

The ship-to address only is used one time for the SO.

Regards,

Quyen