‎2013 Sep 12 11:16 AM
Hi Experts,
I am facing the problem while setting the cursor in the first field of the module pool program.
My requirement:
When I keep my cursor in any of the input fields and press ENTER, the SY-UCOMM = ‘ENTER’ and the non-editable fields are filled out.
When I first do the ‘EXECUTE’ , SY-UCOMM = ‘EXECUTE’ and processing fine.
When I do the ‘EXECUTE’ first, SY-UCOMM = ‘EXECUTE’, the values are not filled – This is ok ( works ).
The above three statements works fine.
My problem starts now.
But when I do the ‘ENTER’ now, the cursor is positioned in ‘EXECUTE’ button and SY-UCOMM = ‘EXECUTE’ . So I am trying to keep the CURSOR using the SET CURSOR ‘FIRST_FIELD’ in PBO .
But it is not working out.
Kindly help me, how to bring the cursor from ‘EXECUTE BUTTON’ to the input field of the screen. I have attached the screen shot too.
Experts can you help on this.
Regards,
Satkhi.
‎2013 Sep 12 12:27 PM
Hii sakthi sri
After the execution do the following
clear sy-ucomm.
set cursor field 'choice field name'.
hope this will work out in your case
write if this resolve your issue.
regards
Syed
‎2013 Sep 12 11:28 AM
Hello Sakthi.
Whether you had written in PBO specifically to set cursor in EXECUTE button?
By normal flow, cursor won't be in execute button but in the the first input field in the screen.
If you had written specifically, then in PBO after that code, SET CURSOR FIELD 'First_field' based on your business logic.
Regards.
‎2013 Sep 12 11:42 AM
Hi Arun,
Thanks for your input.
In PBO i wrote the SET CURSOR FIELD - to point to FIRST EDITABLE FIELD. This I inserted, as the cursor, sits on the EXECUTE push button in the Application Tool Bar.
Rgds,
Sakthi.
‎2013 Sep 12 11:28 AM
Hi,
Instead of sy-ucomm, why don't you use ok_code field. This field you need to define in TOP include of Module pool and also in the Screen Element List.
Regards
Sajid Shaik
‎2013 Sep 12 11:44 AM
Hi Sajid,
Thanks for the input.
Actually, I use, ok_code only. For convenience I wrote her sy-ucomm. Even I am clearing the ok_code after passing the sy-ucomm.
Rgds,
Sakthi.
‎2013 Sep 12 11:28 AM
Hi
In generally the cursor is placed in the first field of the screen automatically....but you're saying it's placed in a button of the bar?
Max
‎2013 Sep 12 11:52 AM
Hi Max,
Yes, this is only wondering me and that is the reason, I have introduced the SET CURSOR FIELD.
I attach the picture here, and the cursor positions the EXECUTE button and coming to first input field of the screen.
If I press ENTER now, the same EXECUTE function is working. If I manually, put my cursor on the first field and press ENTER, then the ENTER command is working.
But I want the cursor to be positioned automatically in the first field.
Rgds,
Sakthi.
‎2013 Sep 12 11:58 AM
Whether you had written code exclusively to set cursor in EXECUTE button or not?
‎2013 Sep 12 1:13 PM
‎2013 Sep 13 10:16 AM
Hi Arun,
As I said earlier, I did not write any code for set cursor EXECUTE commant in PBO.
‎2013 Sep 13 10:25 AM
Hi Max,
process before output.
module status_1001.
process after input.
module exit_1001 at exit-command.
module user_command_1001.
My PBO
MODULE status_1001 OUTPUT.
SET CURSOR FIELD 'SLIP'.
SET PF-STATUS 'STATUS_1001'.
SET TITLEBAR 'TITLE_1001'.
IF v_err_flag = 'X'.
IF v_set_cur_lgort = 'X'.
SET CURSOR FIELD 'LGORT_344'.
ELSEIF v_set_cur_fbin = 'X'.
SET CURSOR FIELD 'LGPLA_FINAL'.
ENDIF.
ENDIF.
ENDMODULE. " STATUS_1001 OUTPUT
My PAI
CLEAR: v_ok.
v_ok = ok_code.
CLEAR: ok_code.
PERFORM f_clear.
CASE v_ok.
WHEN 'EXEC'.
PERFORM f_process_update.
WHEN 'ENTR' or ''.
PERFORM f_validate_input.
PERFORM f_populate_values.
WHEN OTHERS.
" Do nothing.
ENDCASE.
ENDMODULE. " USER_COMMAND_1001 INPUT
*&---------------------------------------------------------------------*
*& Module EXIT_1001 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE exit_1001 INPUT.
v_ok = ok_code.
CLEAR: ok_code.
CASE v_ok.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN OTHERS.
ENDCASE.
ENDMODULE. " EXIT_1001 INPUT
Rgds,
‎2013 Sep 13 10:39 AM
Sakthi,
Just debug and check if the last statement in your PBO that is executed is SET CURSOR FIELD 'First_field'. Check required program flow is happening or not.
‎2013 Sep 13 10:46 AM
‎2013 Sep 13 10:59 AM
‎2013 Sep 13 11:03 AM
Hi Raymond,
Yes, I put and the behaviour is the same. No change.
But I found one strange behaviour. I logged off my SAP and logged on newly again. At the first time execution of the program, the program behaves normally that, cursor sits in the first editable screen. But when I do testing continuosly, cursor sits in the Toolbar EXECUTE button.
Do I need to get in touch with the Basis people regarding this ??
Rgds,
‎2013 Sep 12 11:42 AM
Hi Shakthi,
Try defining function code for the ENTER ok code in the PF status of the screen and include the code for filling the non editable fields under this Function code for enter in the PAI.
Regards
Alex
‎2013 Sep 13 10:19 AM
Hi Alex,
I am doing the same only. But I want to put my cursor to the first editable field as, I shown in screen shot.
Rgds,
‎2013 Sep 12 12:27 PM
Hii sakthi sri
After the execution do the following
clear sy-ucomm.
set cursor field 'choice field name'.
hope this will work out in your case
write if this resolve your issue.
regards
Syed
‎2013 Sep 12 12:36 PM
Hi
Its Very Simple Go to Your screen attributes there set default cursor position.
Reward some points if it is Helpful.
Thanks and regards.
Hiriz
‎2013 Sep 13 5:31 AM
Hi,
Use ok_code instead of sy-ucomm.
Try this in the PBO,
SET CURSOR FIELD '<field>'.
Regards,
Jeffin
‎2013 Sep 13 5:35 AM
Hi Sakthi,
As jeffin told it will work fine in the case of PBO, but if you want to write that in PAI the set cursor statement should be followe be a message of type 'E', ie error message.
EG; SET CUSRSOR FIELD '<FIELD>'.
MESSAGE 'ERROR' TYPE 'E'.
Regards,
Ashish Kumar
‎2013 Sep 13 10:17 AM
Hi Jeffin and Ashish,
I wrote my code in PBO only and using ok_code not sy-ucomm.
Rgds,
‎2013 Sep 13 10:30 AM
Hi
You should post your code.....I can't understand your problem because it's very strange behavior...it's the first time for me...I've never seen a situation where the cursor is set on toolbar.
Max
‎2013 Sep 13 10:45 AM
Hi Max,
I posted my PBO and PAI codes.
Do you want the perform codes also?
Rgds,
‎2013 Sep 13 10:46 AM
Hi,
Debug and check the IF conditions and make sure that control comes to any one of the statements
SET CURSOR FIELD 'LGORT_344'.
SET CURSOR FIELD 'LGPLA_FINAL'.
Regards,
Jeffin
‎2013 Sep 13 11:06 AM
Hi Jeffin,
If the IF condition is satisfied, then the control comes to these statements. But these statements does occur in the ENTER command only.
But my problem is, when I click on the EXECUTE command, curson sits in the EXECUTE button and not comes to the dynpro screen.
Rgds,
‎2013 Sep 13 11:39 AM
Hi
Your code seems to be ok
Which is the type of your screen? Whih is the type of the satus?
Try to post the images of the setting of your dynpro and status
Max
‎2013 Sep 20 8:25 AM
Hi Friends,
The problem still persists. Anyhow thanks for taking your valuable time and helping me friends. Let me discuss with the functional and let you know.
Thanks.
Sakthi.