Skip to Content

Cursor problem in table controls in tabstrip

Hi colleagues abapers,

I have a problem with cursor positioning in dialog program. There is tabstrip control with two tabs and on each is one table control. I want, when a hit Enter, that cursor stay in same field of table control instead of returning to starting position, first enabled column/row.

Until now I always did like this and it worked:

DATA : cursor_field TYPE fieldname, "char 30

cursor_line TYPE sy-linno.

In PAI user command module: GET CURSOR FIELD cursor_field LINE cursor_line.

In PBO status module: SET CURSOR FIELD cursor_field LINE cursor_line.

I tried different combinations, without LINE, or setting and getting in tabstrip subscreens modules, but the problem is that cursor_field never get read when it is in table control, which I see from debugger.

Got any suggestions?

Thanks

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    Posted on Dec 05, 2013 at 11:16 AM

    Ok, after much of experimenting I finally made it. Now cursor stays in field, in header box and in table controls, which I want at the beginning. This is how I did:

    In main screen flow logic:

    PROCESS BEFORE OUTPUT.

    MODULE status_0100.

    *&SPWIZARD: PBO FLOW LOGIC FOR TABSTRIP 'TS_STAVKE'

    MODULE ts_stavke_active_tab_set.

    CALL SUBSCREEN ts_stavke_sca

    INCLUDING g_ts_stavke-prog g_ts_stavke-subscreen.

    PROCESS AFTER INPUT.

    *&SPWIZARD: PAI FLOW LOGIC FOR TABSTRIP 'TS_STAVKE'

    CALL SUBSCREEN ts_stavke_sca.

    MODULE ts_stavke_active_tab_get.

    MODULE user_command_0100.


    In subscreens PAI and PBO modules:


    SET CURSOR FIELD cursor_field LINE cursor_line.

    ENDMODULE. " STATUS_0101 OUTPUT


    *&SPWIZARD: INPUT MODULE FOR TC 'TC_RAD1'. DO NOT CHANGE THIS LINE!

    *&SPWIZARD: PROCESS USER COMMAND

    MODULE tc_rad1_user_command INPUT.

    ok_code = sy-ucomm.

    PERFORM user_ok_tc USING 'TC_RAD1'

    'RAD1_ITAB'

    'FLAG'

    CHANGING ok_code.

    sy-ucomm = ok_code.

    GET CURSOR FIELD cursor_field LINE cursor_line.

    ENDMODULE. "TC_RAD1_USER_COMMAND INPUT


    In main screen PBO and PAI:


    SET CURSOR FIELD cursor_field LINE cursor_line.

    ENDMODULE. " STATUS_0100 OUTPUT


    *&---------------------------------------------------------------------*

    *& Module USER_COMMAND_0100 INPUT

    *&---------------------------------------------------------------------*

    * text

    *----------------------------------------------------------------------*

    MODULE user_command_0100 INPUT.

    IF cursor_field IS INITIAL.

    GET CURSOR FIELD cursor_field LINE cursor_line.

    ENDIF.



    Thank you all for help!



    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 05, 2013 at 09:09 AM

    Here is the code from screen flow logic:

    PROCESS BEFORE OUTPUT.

    *&SPWIZARD: PBO FLOW LOGIC FOR TABSTRIP 'TS_STAVKE'

    MODULE ts_stavke_active_tab_set.

    CALL SUBSCREEN ts_stavke_sca

    INCLUDING g_ts_stavke-prog g_ts_stavke-subscreen.

    MODULE status_0100.

    PROCESS AFTER INPUT.

    MODULE user_command_0100.

    *&SPWIZARD: PAI FLOW LOGIC FOR TABSTRIP 'TS_STAVKE'

    CALL SUBSCREEN ts_stavke_sca.

    MODULE ts_stavke_active_tab_get.

    MODULE exit_command_0100 AT EXIT-COMMAND.


    And snippet from PAI user command and PBO status modules where I set/get cursor variable:


    SET CURSOR FIELD cursor_field LINE cursor_line.

    ENDMODULE. " STATUS_0100 OUTPUT

    *&---------------------------------------------------------------------*

    *& Module USER_COMMAND_0100 INPUT

    *&---------------------------------------------------------------------*

    * text

    *----------------------------------------------------------------------*

    MODULE user_command_0100 INPUT.

    GET CURSOR FIELD cursor_field LINE cursor_line.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 05, 2013 at 08:54 AM

    Hello Vladimir,

    in PAI, keep a condition for sy-ucomm. check the sy-ucomm for enter action.

    lets say ENTR is the sy-ucomm then u can place like below.

    if sy-ucomm = 'ENTR'.

    get cursor position into a variable.

    endif.

    in the PBO you can make use of this variable and set the position again.

    make sure that your VARIABLE is accessible in both modules.

    Let us know in case of issues.

    Regards,

    Bhaskar

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 05, 2013 at 12:48 PM

    Hii Vladmir,

    You can also use System structure variable SY-STEPL And it works in table control for the index of current step loop line for current field.

    Just try with it and hope will work without creating a variable cursorl_line.

    Syntax:

    SET/GET CURSOR FIELD <fieldname> LINE SY-STEPL.

    SET CURSOR FIELD cursor_field LINE sy-stepl.


    regards

    Syed

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 05, 2013 at 08:42 AM

    In PBO your set cursor shoudl be after the loop endloop of table control and in PAI it shoudl be at the beginning

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.