Skip to Content
0
Jun 26, 2020 at 03:53 AM

How to Retrieve ShipFromItemLocation from CustomerInvoice

52 Views Last edit Jun 26, 2020 at 03:54 AM 2 rev

My code in sap cloud studio:

var dataLocation;
var data = CustomerInvoice.Retrieve(this.GetFirst().ID);
if(data.IsSet())
{
   if(data.Item.GetFirst().IsSet())
   {
	  if(data.Item.GetFirst().ItemOriginCustomerInvoiceItemReference.IsSet())
	  {
	     if(data.Item.GetFirst().ItemOriginCustomerInvoiceItemReference.CorrespondingCustomerInvoiceRequestItem.IsSet())
		 {
		    if(data.Item.GetFirst().ItemOriginCustomerInvoiceItemReference.CorrespondingCustomerInvoiceRequestItem.ShipFromItemLocation.IsSet())
			{
				dataLocation = data.Item.GetFirst().ItemOriginCustomerInvoiceItemReference.CorrespondingCustomerInvoiceRequestItem.ShipFromItemLocation.LocationID.content;
			}
		 }
	  }
   }
}

Object for ItemOriginCustomerInvoiceItemReference not retrieve the data. in the form print out ShipFromItemLocation have value.