Section 243(2) in The Code of Criminal Procedure, 1973
(2)If the accused, after he has entered upon his defence, applies to the Magistrate to issue any process for compelling the attendance of any witness for the purpose of examination or cross-examination, or the production of any document or other thing, the Magistrate shall issue such process unless he considers that such application should be refused on the ground that it is made for the purpose of vexation or delay or for defeating the ends of justice and such ground shall be recorded by him in writing:Provided that, when the accused has cross-examined or had the opportunity of cross-examining any witness before entering on his defence, the attendance of such witness shall not be compelled under this section, unless the Magistrate is satisfied that it is necessary for the ends of justice.