
Anyone can share code about VARIANT how to write variant code.
The question is honestly not too much clear to me.
As an example, the following example determines whether a C/AL variant contains a record variable. The GET function gets customer number 10000 from the Customer table. The record is stored in the MyRecord variable. The MyRecord variable is assigned to the variant variable that is named MyVariant. The ISRECORD function determines whether the variant contains a Record variable and stores the return value in the varResult variable. In this case, the variant contains a Record variable so Yes is returned and displayed in a message box.
MyRecord.GET('10000');
MyVariant := MyRecord;
varResult := MyVariant.ISRECORD;
MESSAGE(Text000,MyVariant,varResult);
varResult := MyVariant.ISCODE;
MESSAGE(Text001,MyVariant,varResult);