Comparing User layer and system layer through code for documentation

Hey, I have an issue while i am trying to compare system layer and user layer through code for my documentation purpose. here all I want to do is

i. to compare both layers through X++ instead of using compare tool.

ii. and to get documents as info and for all the objects together instead of going into one by one comparison.

I have started with table comparison as follows

for that purpose i have created one class (Raj_syscompare) to make syscomparetext public.

{SysTreeNode Layer1, Layer2;
TreeNode systreenode, Usertreenode;
UtilIdElements utilElements, joinUtilElements;
raj_syscompare sys;
str b,c;

container a;

sys = New raj_syscompare();
while select UtilElements
where UtilElements.utilLevel == UtilEntryLevel::sys && Utilelements.recordType == UtilElementType::Table

select firstonly recid from joinUtilElements
where joinUtilElements.utilLevel == UtilEntryLevel::usr && //UtilElements.utilLevel == &&
joinUtilElements.recordType == UtilElements.recordType;
if (joinUtilElements.RecId)

systreenode = SysTreeNode::findNodeInLayer(UtilElements.recordType,, UtilElements.parentId, UtilElements.utilLevel);

Usertreenode = SysTreeNode::getLayeredNode(systreenode, 1);
Layer1 = SysTreeNode::newTreeNode(systreenode);
Layer2 = SysTreeNode::newTreeNode(Usertreenode);
if (SysCompare::silentCompare(Layer1, Layer2))

info(strFmt(“Element name: %1, Element type: %2”,, enum2str(UtilElements.recordType)));
//after that somewhere I am going wrong.,Layer2.toString(),false,true,false,false,false);
a= sys.getResult();

b= systreenode.AOTgetSource();
c= Usertreenode.AOTgetSource();

I need your help guys as usual to complete this code.