We present the results of the ab initio calculated electronic properties, first and second harmonic generation for the AII BIV N2 (AII=Be, Mg; BIV =C, Si, Ge) compounds with chalcopyrite structure performed using the Linear Augmented Slater-Type Orbitals (LASTO) method. The second-order optical susceptibilities as functions of frequency for AII BIV N2 are also presented. Specifically, we study the relation between the structural properties and the optical responses. Our electronic band structure and density of states (PDOS) analysis reveal that the underestimate bandgaps of these chalcopyrite A IIBIV N2 are wide enough (from 4eV to 6eV), direct transition and mainly located at Γ-point. Calcultion results show this new category wide-bandgap ternary nitrides has potential applications in optoelectronics.