cancel
Showing results for 
Search instead for 
Did you mean: 

How to update the data "Incoterms" and "Incoterms Location" of Purchase Order in ABSL?

Former Member
0 Kudos
892

Hi Experts,

I would like to update the data "Incoterms" and "Incoterms Location" of existing Purchase Order ID in ABSL. I worte some codes in ABSL of custom BO. But the following error is shown and cannot update correctly. Error → "Location for Incoterms missing; enter an Incoterms location"

Here is my code. I also traced the code and the data is correctly filled to the fields respectively during debug time. But the error is shown and save failed at the end. Please kindly help.

import ABSL;

import AP.Purchasing.Global;

var query = PurchaseOrder.QueryByElements;

var param = query.CreateSelectionParams();

param.Add(query.ID.content, "I", "EQ", "1234");

var result = query.Execute(param);

foreach (var header in result) {

  if (header.DeliveryTerms.IsSet()) {

      header.DeliveryTerms.Incoterms.ClassificationCode = "FOB";

      header.DeliveryTerms.Incoterms.TransferLocationName = "Hamburg";

  }

  header.SubmitForOrder();

}

Thanks and Regards,

Thiri

LuisMendoza
Explorer
0 Kudos
SPRO

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Thi,

Can you use Retrieve method? Something like:

import ABSL;

import AP.Purchasing.Global;

  

var purchaseOrder = PurchaseOrder.Retrieve("1234");

if (purchaseOrder.IsSet() && purchaseOrder.DelivetyTerms.IsSet())

{

      purchaseOrder.DeliveryTerms.Incoterms.ClassificationCode = "FOB";

      purchaseOrder.DeliveryTerms.Incoterms.TransferLocationName = "Hamburg";

      purchaseOrder.SubmitForOrder();

}

Regards,

Alexandre

HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Thi,

Are you sure that the status of the PurchaseOrder allows the change of the fields?

Bye,

   Horst

Former Member
0 Kudos

Hi Horst,

Yes, sure. I tested with the status "In Preparation" and "Sent" in Purchase Order.

Thanks

Thiri

Former Member
0 Kudos

Hi Alexandre,

Thank you for your precious answer. Yes, I got it when I use "Retreive()" method.

Could you also explain why we cannot use QueryByElements (Execute)?

What is difference?

Thanks and Regards,

Thiri

Former Member
0 Kudos

Hi Alexandre,

I apologize for my incomplete testing. Now, I tested again. It is OK with both ways 【Retrieve() and Execute()】.

The problem is that it cannot fill the data when the "Incoterms" and "Incoterms" Location is empty.

It can only update the values of those fields when the initial values have been set.

Thanks and Regards,

Thiri

Answers (0)