Problem with the number of items in overview screen in VA02 and VA03.

I am using some scripts in relation to the sales order overview screen in VA02 and VA03. I need to know how many items there are in the order and am using the command
GetTableAttribute T[All items] FirstVisibleRow=fvitem
LastVisibleRow=lvitem LastRow=lsitem.
When in VA03 I get the correct number of items. However, when in VA02, the value returned is 1 greater than the actual number of items.
Can you please explain this?

The line number that GuiXT returns is independent of whether a line is filled or not. Since the SAP application already provides an additional line for entering new data in VA02, this line is included. In VA03, no free line is provided, so you get the exact item count there.