09-18-2006 12:52 PM
i want to delete selected row in table control from database. i.e. i want to extract the selected data from tablecontrol.
Please help me...its very urgent
09-18-2006 1:02 PM
Hi Dheeraj,
while creating table control you give selected line option as check so your internal table will be having one more field with char1.
when ever you select some row this field will be having 'X' value in that row.
so using this field you can delete that particular row after user command.
-Anu
09-18-2006 12:54 PM
HI,
IN PAI you have to look for the flag field, if flag field is X then the row is selected.
For mutlitple selection.
LOOP AT itab_table where MARK = 'X'.
"DELETE from database table"
ENDLOOP.
for single selection allowed in table control
READ TABLE itab_table WITH KEY MARK = 'X'.
"DELETE FROM database table"
Regards,
09-18-2006 1:00 PM
hi,
Here is the sample code.
in PAI.
PROCESS AFTER INPUT.
loop at IT_CONF.
chain.
field X_CONF-EBTYP.
field X_CONF-EINDT.
field X_CONF-LPEIN.
field X_CONF-UZEIT.
field X_CONF-ERDAT.
field X_CONF-MENGE.
field X_CONF-XBLNR.
module TC_CONF_modify on chain-request.
endchain.
field X_CONF-CHECK
module TC_CONF_mark on request.
endloop.
MODULE USER_COMMAND_0102.
module tc_conf_mark input.
data: g_tc_conf_wa2 like line of it_conf.
if tc_conf-line_sel_mode = 1.
clear g_tc_conf_wa2.
loop at it_conf into g_tc_conf_wa2
where check = 'X'.
g_tc_conf_wa2-check = ''.
modify it_conf
from g_tc_conf_wa2
transporting check.
endloop.
endif.
modify it_conf
from x_conf
index tc_conf-current_line
transporting check.
endmodule.
module user_command_0102 input.
"delete th line
LOOP AT it_conf where MARK = 'X'.
"DELETE from internal table"
ENDLOOP.
endmodule.
Regards,
Richa.
09-19-2006 6:52 AM
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.
09-19-2006 6:52 AM
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.
09-18-2006 1:02 PM
Hi Dheeraj,
while creating table control you give selected line option as check so your internal table will be having one more field with char1.
when ever you select some row this field will be having 'X' value in that row.
so using this field you can delete that particular row after user command.
-Anu
09-19-2006 6:53 AM
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.
09-18-2006 1:07 PM
hi,
chk this sample.
DATA :BEGIN OF int_table OCCURS 0,
fld1 TYPE ztable-fld1,
fld2 TYPE ztable-fld2,
fld3 TYPE ztable-fld3,
chk(1),
END OF int_factor.
*write the blow code in PAI
LOOP AT int_table WHERE chk = 'X'.
*data to be deleted are stored to temp internal table.
APPEND int_table TO int_table_temp.
CLEAR int_table.
CLEAR int_table_temp.
*delete from data base
DELETE ztable FROM int_table. "from header
*delete from the table control
DELETE int_table WHERE chk = 'X' .
clear int_table
ENDLOOP.
in the table int_table_temp u will get the deleted records
rgds
anver
if hlped rwrd points
09-19-2006 6:53 AM
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.
09-18-2006 1:09 PM
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 Ramanan N
Message was edited by: Venkat Ramanan Natarajan
09-19-2006 6:53 AM
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.
09-19-2006 7:33 AM
Hi ,
You Can Do The Following.where sydn is the structure of your tablecontrol fileds .my_control ur table control. Mark the selction coloumn and wa_itab ur work area
PAI
Loop at itab.
field sydn-mark module modify_itab on request.
Endloop.
Module modify_itab input.
move-corresponding sydn to wa_itab.
Delete itab from wa_itab .
Endmodule.