0

I have a screen for creating new records in a table, it contains a form with all the database columns. Problem is, once the screen is called, it has the last database record in it. So to add a new record, you have to empty the current values first.

Any idea how to get rid of this?

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48

2 Answers2

2

The only way that this could happen is if you are selecting values into the fields in the first place. Presumably you have declared the a structure of the same type as the table (possibly with a TABLES statement) in your program and have named the fields the same on the screen, and you are selecting values into the structure. If this is the case, you can simply issue CLEAR and it will clear all the fields in the structure. (You could do this directly after the last update). It is difficult to tell, however, without a sample of your program and screen code.

mydoghasworms
  • 18,233
  • 11
  • 61
  • 95
  • Well I generated my form in the screen painter (the wizard that opens when you hit F6) and I do think that it uses the same names for the fields as for the DB columns if that's what you mean? There's actually not any typed code involved in this part, only code generated from the screen painter. As soon as I launch the screen, it contains values –  May 31 '11 at 19:18
1

I can't agree more with mydoghasworms's answer. One comment, when you find the table, make sure to CLEAR itab[], when the table with header.

I encountered the same issue yesterday, and it works when I cleared the table on the screen.

user836290
  • 11
  • 1
  • When using a table with a header line CLEAR itab[] will only clear the contents of the table, you still have to clear the header line separately using CLEAR itab. I prefer to use explicit header lines is implicit header lines are not allowed in the OO context anyway – Esti Jul 18 '11 at 07:18