Application Development and Automation 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: 
Read only

Table control -Row selection

Former Member
0 Likes
511

HI

Im facing one problem in table control. My requirement is to maintain the master data as well as relationship datas. So in first screen i have one table control. Suppose in that screen im having two entries. i want to delete selected entry from this table . since second screen is relationship table i want to delete entries from second table based on the selected key field value. How to write code for that.

i have written like this

if sy-ucomm = 'DELE'.

if vim_marked = 'X'.

select dealerid from zsample2 into TABLE it_dealerid .

endif.

LOOP at it_dealerid into wa_dealerid .

delete from zdealerclass where dealerid = wa_dealerid-dealerid.

MESSAGE i004(zmsg).

ENDLOOP.

endif.

But here im getting all the values in zsample2 . I want only selected row field value..

please help me.

2 REPLIES 2
Read only

Former Member
0 Likes
440

I think you wish to delete the entries from internal tables..If you wish to delete db table entries directly, you can update the delete statement syntax accordingly.

IF SY-UCOMM EQ 'DELE'.

" READ SELECTED ENTRY.

READ TABLE ITAB_TC1 INTO LS_TC1 WHERE MARK = 'X'

IF SY-SUBRC EQ 0.

"DELETE PARENT ENTRY.

DELETE ITAB_TC1 FROM LS_TC1.

" DELETE ENTRIES IN SECONDARY INTERNAL TABLE

DELETE ITAB_TC2 WHERE DEALERID = LS_TC1-DEALERID

ENDIF.

ENDIF.

~Piyush

Read only

Former Member
0 Likes
440

Hi,

What is that vim_marked? Will this be marked field i.e., checkbox field in the first table control. if that is the case, if i am not wrong that table control will have multiple records, then why you are checking only for one record using if condition probably that may be last record because while filling it will retain last record value may be space. And using that value you are deleting records from second internal table thats why it is showing all the records. Could you please check that.

Hope this will give you some idea,

Regards,

Aswini.