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: 

Unable to delete a row in table control

Former Member
0 Kudos

Hi,

I'm unable to delete a row in table control.

I have defined a selection column for my table control but it is not getting value 'X' when i'm selecting a row for deletion.

Also, when I press enter, some of the columns in table control are getting initialized. I'm passing these values to the internal table along with other columns.

Please help.

Regards,

Manasee

Message was edited by: Manasee Chandorkar

8 REPLIES 8

Former Member
0 Kudos

check this program , u will come to know where is the probs.

DEMO_DYNPRO_TABCONT_LOOP_AT

regards

Prabhu

Former Member
0 Kudos

Hello,

Add one more field in the database table as MARK of character length 1. Then while creating the table in the screen, in the table properties at the below there will be one option with check box (W/selcolumn). Click that and mention the value ITAB-MARK in the text box next to it.

Now automatically when you select the row in the table control, the particular row will be marked as 'X' in the internal table.

So now you can delete the value from the internal table where MARK = 'X'.

I hope this help.

Regs,

Venkat

Former Member
0 Kudos

Hi

You have to insert the MARK colunm in your table control and assign this field to a flag field of your internal table:

PROCESS PBO.

LOOP AT ITAB....

MODULE SHOW_ITAB.

ENDLOOP.

PROCESS PAI.

LOOP AT ITAB....

MODULE MODIFY_ITAB.

ENDLOOP.

MODULE USER_COMMAND.

MODULE SHOW_ITAB.

<TABLE CONTROL FIELD FOR MARK> = ITAB-MARK.

ENDMODULE.

MODULE MODIFY_ITAB.

ITAB-MARK = <TABLE CONTROL FIELD FOR MARK>.

MODIFY ITAB INDEX <TABLE CONTROL>-CURRENT_LINE.

ENDMOFULE.

MODULE USER_COMMAND.

CASE OK_CODE.

WHEN 'DELE'.

DELETE ITAB WHERE MARK = 'X'

ENDCASE.

ENDMODULE.

Max

0 Kudos

hi guys,

Thanks a lot for the replies. I have done all these things already.

My problem is that the 'SEL' field is not getting set when i select a row.

Regards,

Manasee

anversha_s
Active Contributor
0 Kudos

hi,

kindly chk this.

PROCESS BEFORE OUTPUT.

MODULE status_9010.

LOOP WITH CONTROL tab_control.

MODULE move_data_to_table.

ENDLOOP.

PROCESS AFTER INPUT.

LOOP WITH CONTROL tab_control.

MODULE move_data_from_table.

ENDLOOP.

****************************

&----


*& Module move_data_to_table OUTPUT

&----


  • This is to move the data from the internal table to the table control

----


MODULE move_data_to_table OUTPUT.

  • This is to move the data from the internal table to the table control

zmpets_mode-modecode,zmpets_range-rangeid,zmpets_servfacto-factor are column name of table control

READ TABLE int_factor INDEX tab_control-current_line.

IF sy-subrc = 0.

zmpets_mode-modecode = int_factor-modecode.

zmpets_range-rangeid = int_factor-rangeid.

zmpets_servfacto-factor = int_factor-factor.

ENDIF.

ENDMODULE. " move_data_to_table OUTPUT

**********************

&----


*& Module move_data_from_table INPUT

&----


  • Date is moved from the table control to the Internal Table

----


MODULE move_data_from_table INPUT.

  • To move the data from the table control to internal table 'INT_FACTOR'.

int_factor-modecode = zmpets_mode-modecode.

int_factor-rangeid = zmpets_range-rangeid.

int_factor-factor = zmpets_servfacto-factor.

int_factor-chk = line.

*here if the data is there, it will modify

MODIFY int_factor INDEX tab_control-current_line.

IF sy-subrc NE 0. "data not exixting in table control . ie new data, then append it

APPEND int_factor.

CLEAR int_factor.

ENDIF.

ENDMODULE. " move_data_from_table INPUT

*delete a line from table control

MODULE user_command_9010 INPUT.

CASE sy-ucomm.

  • When an entry is deleted, and the entry is removed from the table

  • control.

WHEN 'DELETE'.

PERFORM f_del_frm_tab_cntrl.

ENDCASE.

ENDMODULE.

FORM f_del_frm_tab_cntrl .

LOOP AT int_factor WHERE chk = 'X'.

DELETE int_factor WHERE chk = 'X' .

CONTINUE.

ENDLOOP.

CLEAR int_factor.

ENDFORM.

for any clarifiaction pls mail me.

pls reward points, if this helped u.

regards,

anversha.

anversha.shahul@wipro.com

Message was edited by: Anversha s

Former Member
0 Kudos

hi,

1. in SE51, choose LAYOUT button on application tool bar. 2. in layout, double click on table control. u get attributes wondow opened.

3. at the bottom of the window, u have an option

<b>w/SelColumn</b>. give a name for ex. SEL in the box.

4. now in ur code write like this

<b> data selcol(1).

if selcol = 'X'.

delete itab.

endif.</b>

reward if useful...

0 Kudos

hi again,

a small correction in my reply.

data sel(1).

if sel = 'X'.

delete itab.

endif.

anversha_s
Active Contributor
0 Kudos

Yes manasee,

DATA :BEGIN OF int_factor OCCURS 0,

modecode TYPE zmpets_mode-modecode,

rangeid TYPE zmpets_range-rangeid,

factor TYPE zmpets_servfacto-factor,

chk(1),

END OF int_factor.

In the screenlayout also u have to do some things.

Double click the table control.

In the screen painter-> go to bottom-> tick that w/selectcolumn -> on the right hand text of that give LINE

rgds

anver