2005 Jul 27 10:50 AM
Hi All,
I have to display data from ztable in table control & also I have to allow user to modify & insert new records from there.
Is this possible?
If yes kindly suggest how?
Regards,
Dilip
Hi All,
Following is the code to delete the selected rtecord. But it is deleting the first record in the table control.
module read_tab input.
ok_code = sy-ucomm.
clear :sy-ucomm.
if ok_code = 'DEL'.
DELETE TABLE IT_ZEMP FROM ZEMP.
describe table it_zemp lines tab-lines.
endif.
endmodule. " read_tab INPUT
<b>This is how i have declared in the flow logic.</b>
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
loop at it_zemp into zemp with control tab." cursor tab-current_line.
current_line.
module read_table.
endloop.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
loop at it_zemp ." with control tab.
module read_tab.
endloop.
2005 Jul 27 10:55 AM
it is possible. in the graphical screen painter there is a button for table control with wizard, just follow the wizard.
Regards
Raja
2005 Jul 27 11:14 AM
Hi,
It is possible. Create a screen and cick the layout button. it will take u to the screen painter. there add table control and other stuffs and handle the logic in PBO/PAI according to your requirement.
Regs,
Venkat
2005 Jul 27 11:16 AM
Hi,
Check this example.
REPORT demo_dynpro_tabcont_loop_at.
CONTROLS flights TYPE TABLEVIEW USING SCREEN 100.
DATA: cols LIKE LINE OF flights-cols,
lines TYPE i.
DATA: ok_code TYPE sy-ucomm,
save_ok TYPE sy-ucomm.
DATA: itab TYPE TABLE OF demo_conn.
TABLES demo_conn.
SELECT * FROM spfli INTO CORRESPONDING FIELDS OF TABLE itab.
LOOP AT flights-cols INTO cols WHERE index GT 2.
cols-screen-input = '0'.
MODIFY flights-cols FROM cols INDEX sy-tabix.
ENDLOOP.
CALL SCREEN 100.
MODULE status_0100 OUTPUT.
SET PF-STATUS 'SCREEN_100'.
DESCRIBE TABLE itab LINES lines.
flights-lines = lines.
ENDMODULE.
MODULE cancel INPUT.
LEAVE PROGRAM.
ENDMODULE.
MODULE read_table_control INPUT.
MODIFY itab FROM demo_conn INDEX flights-current_line.
ENDMODULE.
MODULE user_command_0100 INPUT.
save_ok = ok_code.
CLEAR ok_code.
CASE save_ok.
WHEN 'TOGGLE'.
LOOP AT flights-cols INTO cols WHERE index GT 2.
IF cols-screen-input = '0'.
cols-screen-input = '1'.
ELSEIF cols-screen-input = '1'.
cols-screen-input = '0'.
ENDIF.
MODIFY flights-cols FROM cols INDEX sy-tabix.
ENDLOOP.
WHEN 'SORT_UP'.
READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.
IF sy-subrc = 0.
SORT itab STABLE BY (cols-screen-name+10) ASCENDING.
cols-selected = ' '.
MODIFY flights-cols FROM cols INDEX sy-tabix.
ENDIF.
WHEN 'SORT_DOWN'.
READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.
IF sy-subrc = 0.
SORT itab STABLE BY (cols-screen-name+10) DESCENDING.
cols-selected = ' '.
MODIFY flights-cols FROM cols INDEX sy-tabix.
ENDIF.
WHEN 'DELETE'.
READ TABLE flights-cols INTO cols WITH KEY screen-input = '1'.
IF sy-subrc = 0.
LOOP AT itab INTO demo_conn WHERE mark = 'X'.
DELETE itab.
ENDLOOP.
ENDIF.
ENDCASE.
ENDMODULE.
Regs,
Venkat
2005 Jul 27 11:23 AM
Hi,
Check this link.In that link,I am explaining everything step-by-step[dispalying records and manipulations in table control].
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/table control in abap.pdf
Kindly get back in case of clarifications.Otherwise,reward points if you find it as useful.
2005 Jul 27 12:29 PM
Hi Dillip,
and have a look here :
look at this sample program in transaction SE38:
RSDEMO_TABLE_CONTROL
regards Andreas
2005 Jul 28 1:59 PM
Hi All,
Following is the code to delete the selected rtecord. But it is deleting the first record in the table control.
module read_tab input.
ok_code = sy-ucomm.
clear :sy-ucomm.
if ok_code = 'DEL'.
DELETE TABLE IT_ZEMP FROM ZEMP.
describe table it_zemp lines tab-lines.
endif.
endmodule. " read_tab INPUT
<b>This is how i have declared in the flow logic.</b>
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
loop at it_zemp into zemp with control tab." cursor tab-current_line.
current_line.
module read_table.
endloop.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
loop at it_zemp ." with control tab.
module read_tab.
endloop.
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |