How to accessing related field on grid or scroll area through peoplecode

How to accessing related field on grid or scroll area through peoplecode

How to accessing related field on grid or scroll area through peoplecode. You can use peoplecode for accessing related field on grid or scroll area both get description of related field and hide/ unhide/ gray/ displayonly/ Enabled of eache requirement of work by use below code.

Local Field &FIELD, &REL_FIELD;

&FIELD = GetField(DEPT_TBL.DEPTID);
/* control field object */
&REL_FIELD = &FIELD.GetRelated(DEPT_TBL.DESCR);
/* related display object */
&REL_FIELD.displayonly= true;

Posted in Peoplecode.