Yes Sure, this is how i am retriving the Inventory Status and Stock Status:
tableextension 50349 Arm_SalesOrderLines extends "Sales Line"
{
fields
{
field(50300; "Inventory Status"; Option)
{
Caption = 'Inventory Status';
DataClassification = ToBeClassified;
OptionMembers = " ","Oversold","Out of Stock";
}
field(50301; "Stock Status"; Option)
{
Caption = 'Stock Status';
DataClassification = ToBeClassified;
OptionMembers = " ","Discontinued","Limited Availability";
}
}
var
ItemRecord: Record Item;
InventoryStatus: Text;
InventoryOrStockStatusLbl: Text;
StockStatus: Text;
procedure GetInventoryStatus(): Option " ","Oversold","Out of Stock"
var
Inventory: Decimal;
begin
Clear(ItemRecord);
if (Rec."Document Type" = Rec."Document Type"::Order) or (Rec."Document Type" = Rec."Document Type"::Invoice) then begin
if Rec.Type = Rec.Type::Item then begin
ItemRecord.SetRange("No.", Rec."No.");
ItemRecord.SetRange("Location Filter", Rec."Location Code");
if ItemRecord.FindFirst() then begin
ItemRecord.CalcFields(Inventory);
Inventory := ItemRecord.Inventory;
if Inventory < Rec.Quantity then begin
if Inventory <> 0 then begin
Rec."Inventory Status" := Rec."Inventory Status"::Oversold;
Rec.Modify(true);
exit(Rec."Inventory Status"::"Oversold");
end;
end;
if (Inventory = 0) or (Inventory < 0) then begin
Rec."Inventory Status" := Rec."Inventory Status"::"Out of Stock";
Rec.Modify(true);
exit(Rec."Inventory Status"::"Out of Stock");
end;
end;
end
else begin
Rec."Inventory Status" := Rec."Inventory Status"::" ";
Rec.Modify(true);
exit(Rec."Inventory Status"::" ");
end;
end;
end;
procedure GetStockStatus(): Option " ","Discontinued","Limited Availability"
var
Inventory: Decimal;
begin
Clear(ItemRecord);
if (Rec."Document Type" = Rec."Document Type"::Order) or (Rec."Document Type" = Rec."Document Type"::Invoice) then begin
if Rec.Type = Rec.Type::Item then begin
if ItemRecord.Get(Rec."No.") then begin
if ItemRecord."Stock Status" = ItemRecord."Stock Status"::Discontinued then begin
Rec."Stock Status" := Rec."Stock Status"::Discontinued;
Rec.Modify(true);
exit(Rec."Stock Status"::Discontinued);
end
else if ItemRecord."Stock Status" = ItemRecord."Stock Status"::"Limited Availability" then begin
Rec."Stock Status" := Rec."Stock Status"::"Limited Availability";
Rec.Modify(true);
exit(Rec."Stock Status"::"Limited Availability");
end
else begin
Rec."Stock Status" := Rec."Stock Status"::" ";
Rec.Modify(true);
exit(Rec."Stock Status"::" ");
end;
end;
end;
end;
end;
}
and here is a functionality of this code:
When an item is added to a sales order line or an unposted sales invoice line, the
system will check the current stock status of the item as indicated on the Item master record. The
system will set the Stock Status on the sales line to the same value as the Stock Status on the Item
record
When an item is added to a sales order line or an unposted sales invoice line, the
system will check the current inventory levels of the item in the Location specified on the line. If the
current quantity on hand in that Location is less than the quantity on sales orders in that
Location, then it will set Inventory Status to Oversold. If the current quantity on hand in that
Location is zero or negative, then it will set Inventory Status to Out of Stock.