The posting period will be updated once you set the entity field and not by setting the trandate. you can set the trandate first but the posting period will not be updated untill you set the entity field. But if you set the trandate and entity and still doesn't populate the posting period something is wrong.