Create gap records based on existing records from the file for a specific period

Hi,

I have a requirement to create the data for complete year based on the records provided in the file. For example some students had already records with specific period in the year so need to fill the records with missing periods.

Here is the expected output: Need to create the missing period records with in the year with status as ā€œPā€ as shown below.

Could you please help me on how to create the missing records