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: 

Table control

Former Member
0 Kudos

thanks fr ur help.but still i m not able to delete the row.please help me by giving code for beloww statement

I HAVE 1 database table named zSTUD_TEMP having field sid,sname,saddress.

Please give me the code for deleteing row from database table through table control.

its vry urgent.i have to use it in project.

sample code:

case sy-ucomm.

WHEN 'DELETE'.

MODIFY i_ZSTUD_TEMP FROM I_ZSTUD_TEMP INDEX

tab_cntrl-CURRENT_LINE transporting CHECK.

LOOP AT i_ZSTUD_TEMP WHERE CHECK = 'X'.

APPEND i_ZSTUD_TEMP TO WA_ZSTUD_TEMP1.

DELETE FROM ZSTUD_TEMP WHERE SID EQ WA_ZSTUD_TEMP1-SID.

ENDLOOP.

endcase.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

To delete and add rows in the table control, first set the selection mode property and give a name to it (Say "SEL").

Either u can select the rows in the table control and press the push button.

Then in PAI write the module.

CONTROLS TC1 TYPE TABLEVIEW USING SCREEN 9001.

MODULE DeleteADDRecord INPUT.

if SEL = 'X' AND sy-ucomm = 'DELETE'.

delete it_purchase index tc1-Current_line.

elseif SEL = 'X' AND sy-ucomm = 'ADD'.

it_purchase-itemno = tc1-Current_line + 1.

insert it_purchase index tc1-Current_line.

endif.

ENDMODULE. " DeleteRecord INPUT

Try with the above code.

delete rows

2 REPLIES 2

Former Member
0 Kudos

To delete and add rows in the table control, first set the selection mode property and give a name to it (Say "SEL").

Either u can select the rows in the table control and press the push button.

Then in PAI write the module.

CONTROLS TC1 TYPE TABLEVIEW USING SCREEN 9001.

MODULE DeleteADDRecord INPUT.

if SEL = 'X' AND sy-ucomm = 'DELETE'.

delete it_purchase index tc1-Current_line.

elseif SEL = 'X' AND sy-ucomm = 'ADD'.

it_purchase-itemno = tc1-Current_line + 1.

insert it_purchase index tc1-Current_line.

endif.

ENDMODULE. " DeleteRecord INPUT

Try with the above code.

delete rows

Former Member
0 Kudos

Hi,

Please stop creating new threads for the same issue.

The problem can be solved by having a 'marking method'. This can be achieved by having a marking column in the table control.

Check if this is present in the table control.

In case the marking column is not created then you'll have to get the selected line.

basically the table control is based on the internal table.

The problem is you have to identify the lines in the internal table and then put them in another internal table.

Now you can use this internal table to delete from the Database table.

In case of queries feel free to ask

Regards

Nishant