‎2007 Sep 24 12:23 PM
How to move the cursor to next field in scree painter?
scenario:
I have validate 'Employer Id' field by using field er_id module m1
module m1 input.
select * from employer where er_id = er_id
if sy-dbcnt <> 0.
message e000
else
-
> Here I want to move to next field,if it is valid er_id(not existing one)
set cursor to 'er_name'.--->its not working
endmodule.
Hope you understood my query,thanks in advance.
‎2007 Sep 24 10:18 PM
A few dot points:
1. You don't need the cursor on the field to validate it.
2. There's no need for the "else" for the "if sy-dbcnt <> 0." as the "e000." will prevent the program going further e.g.
if sy-dbcnt <> 0.
message e000. "explain what the message says in the comments
endif.
*" now check the name field:
if er_name is initial. "blank provided
set cursor field 'ER_NAME'.
message e398(00) with 'Employee name must be provided'
space space space.
endif.4. You can have a "set cursor" in the PBO logic if you want to have the cursor start in a field other than the first of the screen.
Jonathan
‎2007 Sep 25 7:20 AM
Jonathan,
Thanks for your reply.Iam confused little.My purpose is that if it is Valid Er_Id, the cursor should go to er_name,if not the message.So I have used 'If' loop and searched records for entered Er_id, if it fetch records I displayed the message and in else part (it will not fetch record) the cursor should go to next field (i.e Er_name)
If I was not wrong, your code checks if record exists, if yes it displays the message.To say virtually,First I enter '1' the message 'already exist' is display then I clear 1 , enter 100 and press enter,at this point the cursor stands in er_id field without any message(its correct) but I want to move the cursor to er_name field if entered er_id doesnt exist in table.
Let me know if Iam wrong.Thanks.