cancel
Showing results for 
Search instead for 
Did you mean: 

No access possible via a 'NULL' data reference

Former Member
0 Kudos

Hi all,

I have wrote some ABSL code and it causes dump because of "No access possible via a 'NULL' data reference". I have mode some changes but the problem still occurs and i dont see what the problem should be.

The dump occurs in the following line:

if(i.SupplyPlanningArea.ID.content == this.InventoryItemChange.SupplyPlanningAreaID.content)

This is a snippet from my code where is use the line:

var query = Inventory.AggregationOverview.QueryByElements;
var params = query.CreateSelectionParams();
params.Add(query.MainInventorySeparatingValues.MaterialKey.ProductID.content, "I", "EQ", this.InventoryItemChange.MaterialKey.ProductID.content);

var queryResult = query.Execute(params);

if(this.InventoryItemChange.IdentifiedStockKey.ID.content.Length() <= 0 && queryResult.Count() >= 1 && this.InventoryItemChange.SupplyPlanningAreaID.content.Length() > 0) {
	foreach(var i in queryResult) {
		if(i.SupplyPlanningArea.ID.content == this.InventoryItemChange.SupplyPlanningAreaID.content) {

Best regards,

Hunor

Accepted Solutions (1)

Accepted Solutions (1)

HorstSchaude
Product and Topic Expert
Product and Topic Expert

Hello Hunor,

The "i.SupplyPlanningArea" is an association which is not neccessary set all the time.
Before traversing an association one need to make sure that it is set via "i.SupplyPlanningArea.IsSet()"

HTH,
. Horst

Former Member
0 Kudos

Hi Horst,

Thanks for the help. I don't know how i missed this :-?

Best Regards,

Hunor

HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

you're welcome 🙂

Answers (1)

Answers (1)

former_member535186
Participant
0 Kudos

Dear Horst,

i want to set Project Stock order/Item/Itemlocation/Shipfromlocation ID by default value, this is while creating PSO on Project screen.

"See attached" capture.jpg

- The Ship to location is editable and i could set the value by default via script in Item,Item-location or Root itself of Projectstockorder XBO.

if(!this.Location.IsSet()) 
{ this.Location.ID.content = "AWDXI00000" ; }

And i receive null reference error, please advise.

Best Regards,