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: 

Dout in table control

Former Member
0 Kudos
112

Hi

I have doubt in table control Can u go through this

In the table control if i am selecting in the left end of the row and clicking on button named DELETE the row should got deleted.

How can do these.Can you guys give me solution for this.

5 REPLIES 5

Former Member
0 Kudos
79

Use below code logic Refer SAP standard program RSDEMO02.

DATA: BEGIN OF IT_SPFLI OCCURS 20, "flight connections

MARKED. "Check box

INCLUDE STRUCTURE SPFLI.

DATA: END OF IT_SPFLI.

START-OF-SELECTION.

  • read flight connections

SELECT * FROM SPFLI UP TO 100 ROWS.

MOVE-CORRESPONDING SPFLI TO IT_SPFLI.

APPEND IT_SPFLI.

ENDSELECT.

DESCRIBE TABLE IT_SPFLI LINES TC_SPFLI-LINES.

TC_COLS-LINES = 6.

  • display flights with table control

CALL SCREEN 100.

WHEN 'DELL'.

  • remove marked lines

LOOP AT IT_SPFLI WHERE MARKED = 'X'.

DELETE IT_SPFLI.

ENDLOOP.

IF SY-SUBRC <> 0.

GET CURSOR FIELD FLD LINE LINNO OFFSET OFF.

SET CURSOR FIELD FLD LINE LINNO OFFSET OFF.

IF FLD CP 'IT_SPFLI*' AND SY-SUBRC = 0.

LINNO = LINNO + TC_SPFLI-TOP_LINE - 1.

DELETE IT_SPFLI INDEX LINNO.

TC_SPFLI-LINES = TC_SPFLI-LINES - 1.

ENDIF.

ENDIF.

Regards,

Mukesh Kumar

Former Member
0 Kudos
79

Hi,

Check this demo program demo_dynpro_tabcont_loop_at

Regards,

Pankaj

Former Member
0 Kudos
79

u will be having the field in ur internal table from which u are displaying the table control.

for example consider that field is mark.

After clicking the delete button,

in user_command,

READ TABLE itab into wa_itab WITH KEY mark = 'X'.

if sy-subrc 0.

delete table itab from wa_itab.

endif,

Former Member
0 Kudos
79

HI

subin

write like this

i think u have one field of length 1 to store check box value so if u click on particular row then tht field will have value x

so write

loop at where check_field eq 'x'.

delete it_tab where key = condition.

endloop.

plzzz reward if usefull.

Former Member
0 Kudos
79

hi,

try like this...

In USER_COMMAND of PAI.

MODULE user_command_9000 INPUT.

CASE ok_code.

WHEN 'BACK' OR 'UP' OR 'CANCEL'.

LEAVE PROGRAM.

WHEN 'DEL'.

GET CURSOR LINE lin_no.

f1 = 1.

ENDCASE.

ENDMODULE. " USER_COMMAND_9000 INPUT

and in PBO, there would b one Module in which u fetching data....

MODULE get_data OUTPUT.

IF f1 <> 1.

SELECT kunnr name1

INTO CORRESPONDING FIELDS OF TABLE mytab

FROM kna1.

ENDIF.

IF f1 = 1.

DELETE mytab INDEX lin_no.

FREE lin_no.

FREE f1.

ENDIF.

ENDMODULE. " get_data OUTPUT

reward if useful...