Skip to Content
0
Former Member
Mar 26, 2007 at 10:31 AM

table control problem(plz suggest me where can i change it)

15 Views

hi all,

i have 3 buttons in application tool bar ADD, SAVE, EXIT

first table contraol is disable mode if u press add one time one row is enable for entering data and press SAVE data is saves and EXIT for exiting the current screen

logic, everything working fine my problem is if i press ADD one row is enable and as well as i got message down '' 000: all recors hasbeen updated sucessfully''.

but this massage is only for SAVE button

my coding is:

CONTROLS tabctrl TYPE TABLEVIEW USING SCREEN 100.

DATA: cols LIKE LINE OF tabctrl-cols,

lines TYPE i.

DATA: ok_code TYPE sy-ucomm,

save_ok TYPE sy-ucomm.

  • ok_save type sy-ucomm.

DATA: itab TYPE TABLE OF zfm_kmvrg,

fs_itab LIKE LINE OF itab,

fl_change TYPE c,

fl_error TYPE c.

*TABLES fs_itab.

*TABLES : ZFM_KMVRG.

*TABLES: ZFM_KFZ.

*DATA : ITAB LIKE ZFM_KMVRG OCCURS 0 WITH HEADER LINE.

LOOP AT tabctrl-cols INTO cols.

cols-screen-input = '0'.

MODIFY tabctrl-cols FROM cols INDEX sy-tabix.

ENDLOOP.

*SELECT * FROM spfli INTO TABLE itab.

select kfznr kostentraeger kmstand from zfm_kmvrg into corresponding fields of table itab.

CALL SCREEN 100.

----


  • MODULE status_0100 OUTPUT

----


*

----


MODULE status_0100 OUTPUT.

SET PF-STATUS 'SCREEN_101'.

DESCRIBE TABLE itab LINES lines.

tabctrl-lines = lines.

ENDMODULE. "status_0100 OUTPUT

----


  • MODULE cancel INPUT

----


*

----


MODULE cancel INPUT.

LEAVE PROGRAM.

ENDMODULE. "cancel INPUT

----


  • MODULE read_table_control INPUT

----


*

----


MODULE read_table_control INPUT.

MODIFY itab FROM fs_itab INDEX tabctrl-current_line.

*MODIFY ZFM_KMVRG FROM TABLE ITAB.

ENDMODULE. "read_table_control INPUT

----


  • MODULE user_command_0100 INPUT

----


*

----


MODULE user_command_0100 INPUT.

DATA:

lw_index TYPE i.

  • ok_save = ok_code.

save_ok = ok_code.

CLEAR ok_code.

CASE save_ok.

WHEN 'ADD'.

LOOP AT tabctrl-cols INTO cols.

cols-screen-input = '1'.

MODIFY tabctrl-cols FROM cols INDEX sy-tabix.

ENDLOOP.

CLEAR fs_itab.

APPEND fs_itab TO itab.

WHEN 'SAVE'.

IF NOT itab IS INITIAL.

LOOP AT itab into fs_itab.

lw_index = sy-tabix.

IF NOT fs_itab IS INITIAL.

MODIFY ZFM_KMVRG FROM fs_itab.

IF sy-subrc EQ 0.

UPDATE ZFM_KFZ set kmstand = fs_itab-kmstand

WHERE kfznr = fs_itab-kfznr.

ELSE.

fl_error = 'X'.

WRITE:/ 'The record number', lw_index,

'has not been updated'.

ENDIF.

ENDIF.

ENDLOOP.

ELSE.

MESSAGE s000(0) WITH 'No data is present to update'.

ENDIF.

WHEN 'EXIT'.

LEAVE PROGRAM.

ENDCASE.

IF fl_error = 'X'.

LEAVE TO LIST-PROCESSING.

ELSE.

MESSAGE s000(0) WITH

'All the records have been updated successfully'.

ENDIF.

ENDMODULE. "user_command_0100 INPUT