Use the indirection operator
One of the goals of using declared functions is to allow reuse of common functionality. Unfortunately, many functions need to call scroll functions (ScrollSelect, FetchValue, etc.) to operate on data in scrolls, and these functions require specific page and record field references, thus making the functions page- or record-specific. The good news is that the indirection operator “@” allows you to store page and record field references in a generic temporary variable and use the temporary variable in the scroll functions, eliminating the page- or record-specific references.
Example:
Reusable way:
function GetRowValue(&recfield, &row) returns string;
&value = FetchValue(@&recfield, &row);
return &value;
end-function;
Record-specific way:
function GetVoucherIdValue(&row) returns string;
&value = FetchValue(VOUCHER.VOUCHER_ID, &row);
return &value;
end-function;