Calling function inside seq body

In reply to rag123:
Below is an executabale code:

class c1;
  rand byte unsigned byte_data[];
  rand longint unsigned address;
  rand bit byte_enable[];
 
  virtual task body();
    c1 seq_item;
    seq_item =new();
    $display("Write Done ...");
	    //Call write function
    write(32'h0100_0814,32'h01);  
  endtask :body
 
  function void write(int address, int data_bytes);
     seq_item.address                   = address;
     seq_item.data_bytes                = new[4];
     seq_item.data_bytes                = data_bytes;
     seq_item.byte_enable               = new[4];
     seq_item.byte_enable               = 4'hF;
     foreach(seq_item.data_bytes[i]) begin
       seq_item.data_bytes[i] = address[8*i +:0];
       seq_item.byte_enable[i] = data_bytes[8*i +:0];
       end
   endfunction	  
endclass : c1