SETTABLE Function (RecordRef)
Sets the table to which a Record variable refers as the same table as a RecordRef variable.
The RecordRef for the table you want to the RecordVar to refer to.
The Record for which you want to specify a table.
Any filters that are applied to the RecordRef are also applied to the Record. If you change the filter that is applied to the RecordRef, you must call SETTABLE again to apply the new filter to the Record.
This example shows that if you have a RecordID data type, you can get a RecordRef for the table that the RecordID refers to. Then you can use the RecordRef to set the table to which a Record variable refers.
This example requires that you create the following variables in the C/AL Globals or C/AL Locals window.
|InvtEventBuf||Record||Inventory Event Buffer|
|ProdOrderComp||Record||Prod. Order Component|
InvtEventBuf.FIND('-'); RecID := InvtEventBuf."Source Line ID"; RecRef := RecID.GETRECORD; RecRef.SETTABLE(ProdOrderComp);