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

Search Help Exit and Cursor Position

Former Member
0 Likes
1,101

I have created a new search help, which returns the selected value into the applicable screen field correctly. The problem is that there are multiple fields on the screen, and the first field keeps getting the cursor focus instead of the search help field. Is there any way to control the position of the cursor upon returning from the search help?

1 ACCEPTED SOLUTION
Read only

Former Member

I have created a new search help, which returns the selected value into the applicable screen field correctly. The problem is that there are multiple fields on the screen, and the first field keeps getting the cursor focus instead of the search help field. Is there any way to control the position of the cursor upon returning from the search help?

6 REPLIES 6
Read only

Former Member
Read only

0 Likes
940

Hi Judith,

Thanks for the links. Unfortunately I couldn't find anything related to cursor positioning.

Thanks,

Irene

Read only

0 Likes
940

Implement this sample program. While the selection screen is displayed, keep hitting enter. Notice the cursor changing from field to field. Maybe you could use this type of coding.



report zrich_0001.

data: cursorfield(30) type c.

parameters: p_matnr type mara-matnr,
            p_werks type marc-werks,
            p_lgort type mard-lgort.

at selection-screen.
  get cursor field cursorfield.


at selection-screen output.

  case cursorfield.
    when 'P_MATNR'.
      set cursor field 'P_WERKS'.
    when 'P_WERKS'.
      set cursor field 'P_LGORT'.
    when 'P_LGORT'.
      set cursor field 'P_MATNR'.
  endcase.

Regards,

Rich Heilman

Read only

0 Likes
940

Actually, I'm a little confused why this is happening. In my system, when popping up a search help and selecting an entry, the value pops in the field and the cursor stays on that field.

Can you post your code?

Regards,

Rich Heilman

Read only

0 Likes
940

Hi Rich,

The search help is invoked from an SAP screen, and calls a function module which then calls a custom screen. The custom screen performs a search and returns the result value back to the SAP screen. The custom screen is displayed as a full screen, and the cursor focus always goes back to the first field on the SAP screen even though the value is returned to the correct field. Can this screen be throwing the cursor off somehow? Where are you selecting your search results from? Can you post your working code for me?

Thanks and Regards,

Irene

Read only

0 Likes
940

Oh, i see. To fix this it should be as easy as setting the cursor field using the SET CURSOR statement. When you are firing your custom screen for search help, note the field in which the user is by using the GET CURSOR statement. Then in the PBO of the previous screen set the cursor by using the SET CURSOR statement. This is what I was showing you in the sample code above.

Regards,

Rich Heilman