procedure GetCurrCallStack() CallStack: Text;
var
Len: Integer;
Pos: Integer;
SubString: Text;
begin
if ThrowError() then;
CallStack := GetLastErrorCallStack();
SubString := '"Error Message Management"(CodeUnit 28)';
Len := StrLen(SubString);
repeat
Pos := StrPos(CallStack, SubString);
CallStack := CopyStr(CallStack, Pos + Len);
until Pos = 0;
CallStack := CopyStr(CallStack, StrPos(CallStack, '\') + 1);
end;
[TryFunction]
local procedure ThrowError()
begin
// Throw an error to get the call stack by GetLastErrorCallstack
Error('');
end;