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

Deleting selected rows in table control

Former Member
0 Likes
2,240

Hi all,

I am displayed a database table values in a table designed

using screen painter.

My need is if i select one record and click the delete button means then the record should be deleted from the

database table.

Can anyone let me know this and send the coding...

Regards,

Ranjith.

Hi all,

I am displayed a database table values in a table designed

using screen painter.

My need is if i select one record and click the delete button means then the record should be deleted from the

database table.

Can anyone let me know this and send the coding...

Regards,

Ranjith.

7 REPLIES 7
Read only

Former Member
0 Likes
1,265

Hi Ranjith,

In your screen painter by using the sy-tabix you can find the no. of rows of a particular table control using that sy-tabix = '2'. You can delete the entry from the table control

Regards

Pavan

Read only

Former Member
0 Likes
1,265

hi for this you need to use this in the coding of the table control

delete mara where field = wa-field .

Read only

former_member200872
Active Participant
0 Likes
1,265

Hi,

Name the table control attribute - w/ SelColumn.

Search the forum to get relevant code.

Regards,

Wajid Hussain P.

Read only

Former Member
0 Likes
1,265

hi,

see the transaction ABAPDOCU , in this USER DIALOGUS>Screens>complesx screens--> table control with modifications

i think this example will solve ur problem

Read only

former_member556412
Active Participant
0 Likes
1,265

Hi ,

Try this

In PAI make one module....

PROCESS AFTER INPUT.

*&SPWIZARD: PAI FLOW LOGIC FOR TABLECONTROL 'TAB1'

LOOP AT itab.

CHAIN.

FIELD itab-matnr.

FIELD itab-matkl.

FIELD itab-mark.

MODULE TAB1_MODIFY ON CHAIN-REQUEST.

ENDCHAIN.

ENDLOOP.

here itab-mark is my field for line selection....

MODULE tab1_modify INPUT.

IF sy-ucomm = 'DEL' AND itab-mark = 'X'.

MODIFY itab INDEX tab1-current_line TRANSPORTING mark.

ENDIF.

ENDMODULE. " TAB1_MODIFY INPUT

MODULE user_command_1000 INPUT.

CASE sy-ucomm.

WHEN 'BACK' OR 'UP' OR 'CANC'.

LEAVE PROGRAM.

WHEN 'FND'.

CALL SCREEN 1001 STARTING AT 37 5 ENDING AT 87 22.

WHEN 'DEL'.

DELETE itab where mark = 'X'. ENDCASE.

ENDMODULE. " user_command_1000 INPUT

And in module of PBO in which u fetching data from database.....

write this

MODULE fetch_data OUTPUT.

IF sy-ucomm 'DEL'.

SELECT matnr matkl INTO CORRESPONDING FIELDS OF TABLE itab

FROM mara

WHERE matnr BETWEEN '000000000000000101' AND '000000000000000115'.

ENDIF.

ENDMODULE. " fetch_data OUTPUT

Regards,

Bhanu

Read only

Former Member
0 Likes
1,265

Ck,

refer:

Amit.

Read only

Former Member
0 Likes
1,265

Hi,

Try with this code:

CONTROLS TABLE_CONTROL TYPE TABLEVIEW USING SCREEN 100.

TABLES SDYN_SDW4.

DATA SDYN_ITAB LIKE STANDARD TABLE OF SDYN_SDW4.

DATA INIT.

DATA OK_CODE LIKE SY-UCOMM.

DATA SAVE_OK LIKE SY-UCOMM.

DATA MARK.

DATA COL TYPE CXTAB_COLUMN.

CALL SCREEN 100.

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE STATUS_0100 OUTPUT.

SET PF-STATUS 'GRUND'.

SET TITLEBAR '100'.

IF INIT IS INITIAL.

  • Datenbeschaffung

SELECT CARRID CONNID CITYFROM AIRPFROM CITYTO AIRPTO DEPTIME ARRTIME

DISTANCE DISTID

FROM SPFLI

INTO CORRESPONDING FIELDS OF TABLE SDYN_ITAB.

DESCRIBE TABLE SDYN_ITAB LINES TABLE_CONTROL-LINES.

INIT = 'X'.

ENDIF.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Module FILL_TABLE_CONTROL OUTPUT

&----


  • text

----


MODULE CHANGE_SDYN_CONN OUTPUT.

  • you can change the content of current table control line via

  • sdyn_conn

  • READ TABLE sdyn_itab INTO sdyn_conn INDEX table_control-current_line.

ENDMODULE. " FILL_TABLE_CONTROL OUTPUT

&----


*& Module READ_TABLE_CONTROL INPUT

&----


  • text

----


MODULE READ_TABLE_CONTROL INPUT.

  • Check input values

IF MARK = 'X' AND SAVE_OK = 'DELETE'.

DELETE TABLE SDYN_ITAB FROM sdyn_sdw4.

DESCRIBE TABLE SDYN_ITAB LINES TABLE_CONTROL-LINES.

ENDIF.

ENDMODULE. " READ_TABLE_CONTROL INPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE USER_COMMAND_0100 INPUT.

SAVE_OK = OK_CODE.

CLEAR OK_CODE.

CASE SAVE_OK.

WHEN 'SORT'.

DATA: FLDNAME(100),HELP(100).

READ TABLE TABLE_CONTROL-COLS INTO COL WITH KEY SELECTED = 'X'.

SPLIT COL-SCREEN-NAME AT '-' INTO HELP FLDNAME.

SORT SDYN_ITAB BY (FLDNAME).

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

&----


*& Module EXIT INPUT

&----


  • text

----


MODULE EXIT INPUT.

LEAVE PROGRAM.

ENDMODULE. " EXIT INPUT

Regards,

Bhaskar