accept() is used to accept the value inputted to the current field and terminate the current dialog:
CALL dialog.Accept()
The method is equal to pressing the Accept key. The method can prove useful when you want to terminate input from a function, where it is impossible to manipulate the calling routine dialog.
There is some specifics about using variables with ui.Dialog methods.
You can learn about them here.