Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

set cursor not working in module pool

Former Member
0 Likes
7,029

Hi Experts,

I am facing the problem while setting the cursor in the first field of the module pool program.

My requirement:

  1. On ENTER command -> the non editable fields need to be filled up
  2. On EXECUTE command -> should do some process.

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
5,237

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

27 REPLIES 27
Read only

Arun_Prabhu_K
Active Contributor
0 Likes
5,237

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.

Read only

0 Likes
5,237

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.

Read only

Former Member
0 Likes
5,237

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

Read only

0 Likes
5,237

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.

Read only

Former Member
0 Likes
5,237

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

Read only

0 Likes
5,237

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.

Read only

0 Likes
5,237

Whether you had written code exclusively to set cursor in EXECUTE button or not?

Read only

0 Likes
5,237

Hi

Try to post your screen logic (PBO and PAI)

Max

Read only

0 Likes
5,237

Hi Arun,

As I said earlier, I did not write any code for set cursor EXECUTE commant in PBO.

Read only

0 Likes
5,237

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,

Read only

0 Likes
5,237

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.

Read only

0 Likes
5,237

Just a test : could you put

  SET CURSOR FIELD 'SLIP'.

After

  SET PF-STATUS 'STATUS_1001'.
  SET TITLEBAR 'TITLE_1001'.

But I fear that wont work because the cursor is not currently in the dynpro but is in the application toolbar, so bypassing SET CURSR statements ?

Regards,

Raymond

Read only

0 Likes
5,237

Hi Arun,

Yes it is.

Read only

0 Likes
5,237

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,

Read only

Former Member
0 Likes
5,237

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

Read only

0 Likes
5,237

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,

Read only

Former Member
0 Likes
5,238

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

Read only

hiriyappa_myageri
Participant
0 Likes
5,236

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

Read only

former_member220538
Active Participant
0 Likes
5,236

Hi,

Use ok_code instead of sy-ucomm.

Try this in the PBO,

SET CURSOR FIELD '<field>'.

Regards,

Jeffin

Read only

Former Member
0 Likes
5,236

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

Read only

0 Likes
5,236

Hi Jeffin and Ashish,

I wrote my code in PBO only and using ok_code not sy-ucomm.

Rgds,

Read only

0 Likes
5,236

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

Read only

0 Likes
5,236

Hi Max,

I posted my PBO and PAI codes.

Do you want the perform codes also?

Rgds,

Read only

0 Likes
5,236

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

Read only

0 Likes
5,236

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,

Read only

0 Likes
5,236

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

Read only

Former Member
0 Likes
5,236

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.