Skip to Content
avatar image
-2
Former Member

How can i move the cursor position to all the fields i have selected in Table control (module pool)?

My requirement is if i select three fields in Table control and click on the update button,
the cursor should first go to the first field and then the second field where i've clicked and so on.
How do i write the code ?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Mar 02 at 12:50 PM
    • In initial PAI (selection of fields) Memorize the field names in an internal table
    • In the following PBO, as log as this table is not empty, read fist record, set cursor on field, delete record from internal table
    Add comment
    10|10000 characters needed characters exceeded

  • Mar 02 at 08:52 AM
    -1

    hi

    use below statements.

    get cursor field <f> line <line>

    set cursor field <f> line <l>.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 05 at 11:14 AM
    -1

    this is my program.


    MODULE status_0100 OUTPUT.
    SET PF-STATUS 'STATUS'.
    SET TITLEBAR 'TITLE'.






    LOOP AT SCREEN.
    IF screen-name EQ 'ZEMPLOYEE-EMPLOYEEID' AND zemployee-employeeid EQ 'X'.
    screen-input = 0.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    ENDMODULE. " STATUS_0100 OUTPUT



    MODULE user_command_0100 INPUT.



    CASE ok_code.

    WHEN 'BACK'.
    LEAVE PROGRAM.


    MODULE add_row OUTPUT.

    SELECT * FROM zemployee INTO TABLE it_emp.


    ENDMODULE. " ADD_ROW OUTPUT
    *&---------------------------------------------------------------------*
    *& Module USER_DML INPUT
    *&---------------------------------------------------------------------*
    * text
    *----------------------------------------------------------------------*
    MODULE user_dml INPUT.


    CASE ok_code.
    *

    WHEN 'DELETE'.

    IF sel EQ 'X'.
    DELETE FROM zemployee WHERE employeeid = zemployee-employeeid.

    IF sy-subrc EQ 0.
    MESSAGE 'Record successfully deleted' TYPE 'S'.
    ELSE.
    MESSAGE 'Record not deleted' TYPE 'E'.
    ENDIF.
    ENDIF.



    WHEN 'UPDATE'.

    UPDATE zemployee SET firstname = zemployee-firstname
    lastname = zemployee-lastname
    maritalstatus = zemployee-maritalstatus
    dateofjoining = zemployee-dateofjoining
    officeextension = zemployee-officeextension
    mobilephone = zemployee-mobilephone
    bloodgroup = zemployee-bloodgroup
    personalemail = zemployee-personalemail
    department = zemployee-department
    aadhaarno = zemployee-aadhaarno
    employeestatus = zemployee-employeestatus
    gender = zemployee-gender
    dateofbirth = zemployee-dateofbirth
    officephone = zemployee-officephone
    homephone = zemployee-homephone
    pannumber = zemployee-pannumber
    officeemail = zemployee-officeemail
    designation = zemployee-designation
    supervisor = zemployee-supervisor
    WHERE employeeid = zemployee-employeeid .

    IF sy-subrc EQ 0.
    MESSAGE 'Record(s) successfully updated' TYPE 'S'.
    ELSE.
    MESSAGE 'Record(s) not updated' TYPE 'E'.
    ENDIF.

    ENDCASE.


    MODIFY it_emp FROM zemployee INDEX vcontrol-current_line.

    set CURSOR FIELD wa_emp-employeeid LINE sel.
    *
    * READ TABLE it_emp INTO wa_emp INDEX vcontrol-current_line.
    * if sel IS NOT INITIAL.
    * wa_emp-sel = 'X'.
    * modify it_emp FROM wa_emp TRANSPORTING sel WHERE sel eq 'X'.
    * CLEAR wa_emp.
    * ENDIF.

    IF sy-subrc NE 0.

    APPEND zemployee TO it_emp.
    ENDIF.


    ENDMODULE. " USER_DML INPUT
    *&---------------------------------------------------------------------*
    *& Module GET_DATA OUTPUT
    *&---------------------------------------------------------------------*
    * text
    *----------------------------------------------------------------------*
    MODULE get_data OUTPUT.

    SELECT * FROM zemployee INTO TABLE it_emp.

    ENDMODULE. " GET_DATA OUTPUT
    *&---------------------------------------------------------------------*
    *& Module GET_CURSOR OUTPUT
    *&---------------------------------------------------------------------*
    * text
    *----------------------------------------------------------------------*



    Add comment
    10|10000 characters needed characters exceeded