Application Development 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: 

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

Former Member
0 Kudos

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 ?

4 REPLIES 4

former_member241258
Active Participant
0 Kudos

hi

use below statements.

get cursor field <f> line <line>

set cursor field <f> line <l>.

raymond_giuseppi
Active Contributor
  • 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

Former Member
0 Kudos

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
*----------------------------------------------------------------------*



How does this answer the question? I'm confused...