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 add/modify/delete functionality

Former Member
0 Likes
1,498

Hi all,

I have tab control. Under that tab control i have a table control. Now the recors are displaying on the table control . Now i want to delete, modify and insert the recors on the table contol. Please help me out to achieve this functioanlity.

Ranjan

3 REPLIES 3
Read only

AB27
Explorer
0 Likes
1,044

Hi Priyaranjan ,

1) Add the buttons for adding , deleting the rows of the table .

2) Create the table control with the check box .

3) To delete a record , under the user command code for that button , loop at the respective internal table and delete the record where it is marked 'X' .

4) append an empty line in the loop .

5 ) To modify the entries , first enable the input option for the table control and then loop the table when at user defined command ,

and modify the table .

Guess this should solve your problem.

Read only

Former Member
0 Likes
1,044

Hi ,


IF ok_code = 'CB_SAV'.  "for save
    MODIFY zmara FROM TABLE it_zmara.
  ENDIF.

IF ok_code = 'CB_DEL'.   "for delete

*    setting the flag to make the table control in editable mode after
*    deleting te selected line
    flag = 'Y'.
    CALL FUNCTION 'POPUP_TO_CONFIRM'
         EXPORTING
              titlebar              = 'CONFIRM '
              text_question         = 'ARE, YOU SURE TO DELETE FROM DB?'
              text_button_1         = 'YES'(001)
              text_button_2         = 'NO'(002)
              display_cancel_button = 'X'
         IMPORTING
              answer                = ok_code_ans.
    IF ok_code_ans EQ 1.
*UPDATE THE DB TABLE FROM INTERNAL TABLE.
      UPDATE zmara FROM TABLE it_zmara.
* Deleting the selected row from the internal table
      DELETE it_zmara WHERE  pick = 'X'.
*       Deleting the selected row from the database table
      DELETE FROM zmara WHERE matnr = it_zmara-matnr.
*      MESSAGE s003 WITH 'Deleted Successfully'.

    ENDIF.

  ENDIF.

Tks, Krishna

Read only

Former Member
0 Likes
1,044

Hii,

For inserting ,

u need to write in the user command

case ok_code.

when 'INSERT'. "give the function code of the insert

"button as INSERT

describe table itab line wrk_lines.

wrk_lines = wrk_lines + 1.

sy-tfill = wrk_lines.

when 'DELETE' . "func code for del button is DELETE

delete itab where sel = 'X'.

"u need to give the sel name as itab-sel in the

"layout then only the selected can be easily

"identified.

I hope this serves.

Neeraj

endcase.