Depends on contexts,
我吃饭了 = 我吃了饭 if you indicate that you've done your eating
however,
我吃饭了 could mean that you are going to eat, the punctuation is more like “我,吃饭了!”
Or,
To avoid confusion, you should better say "我要吃饭了“ indicating you are going to eat.