Skip to Content
author's profile photo Former Member
Former Member

SET CURSOR does not work, why?

Hi,

I want to set cursor to the new line which is inserted. Here is the code in MODULE user_command_0100 INPUT.

....

GET CURSOR LINE lin.

CHECK sy-subrc = 0.

lin = tbl-top_line + lin.

SET CURSOR LINE lin.

...

In flow logic the PBO is:

loop at i_test

into wa_test

with control tbl

cursor tbl-current_line.

endloop.

But, the SET CURSOR does not work. The cursor does not move to the insert line.

Any solutions?

Thanks a lot!

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 09, 2008 at 02:06 PM

    hi,

    Setting the Cursor Position

    When a screen is displayed, the system automatically places the cursor in the first field that is ready for input. However, you can also define on which screen element the cursor should appear in your program. The screen element does not have to be an input field. Positioning the cursor can make applications more user-friendly.

    You can set the cursor position either statically in the Screen Painter or dynamically in your ABAP program.

    At PBO you can set the cursor on a specific field of a specific row of a table control.

    code

    SET CURSOR FIELD f LINE lin OFFSET off.

    [/code]

    Using the optional addition OFFSET, you can enter the offset of the cursor in the field as described under .

    Setting the Cursor Position

    this program might help u:

    REPORT demo_dynpro_set_cursor.

    DATA: field1(14) TYPE c, field2(14) TYPE c, field3(14) TYPE c,

    name(10) TYPE c.

    SELECTION-SCREEN BEGIN OF BLOCK bloc WITH FRAME.

    PARAMETERS: def RADIOBUTTON GROUP rad,

    txt RADIOBUTTON GROUP rad,

    f1 RADIOBUTTON GROUP rad,

    f2 RADIOBUTTON GROUP rad,

    f3 RADIOBUTTON GROUP rad.

    SELECTION-SCREEN END OF BLOCK bloc.

    PARAMETERS pos TYPE i.

    IF txt = 'X'.

    name = 'TEXT'.

    ELSEIF f1 = 'X'.

    name = 'FIELD1'.

    ELSEIF f2 = 'X'.

    name = 'FIELD2'.

    ELSEIF f3 = 'X'.

    name = 'FIELD3'.

    ENDIF.

    CALL SCREEN 100.

    MODULE cursor OUTPUT.

    IF def NE 'X'.

    SET CURSOR FIELD name OFFSET pos.

    ENDIF.

    SET PF-STATUS 'SCREEN_100'.

    ENDMODULE.

    MODULE back INPUT.

    LEAVE SCREEN.

    ENDMODULE.

    reward if useful

    thanks and regards

    suma sailaja

    Edited by: suma sailaja pvn on Jan 9, 2008 3:43 PM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 09, 2008 at 02:32 PM

    Try the following:

    ....
    GET CURSOR LINE lin.
    CHECK sy-subrc = 0.
    lin = tbl-top_line + lin.
    SET CURSOR LINE lin.
    ...
    
    In flow logic the PBO is:
    
    loop at i_test
    into wa_test
    with control tbl
    *cursor tbl-current_line. "comment this line and try again
    endloop.
    

    Hope this helps.

    Thanks

    Sanjeev

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 10, 2008 at 03:10 PM

    solved by meself. thanks

    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.