‎2007 Oct 25 5:30 AM
hi,
i want to have one <b>Table Control</b> and it is having one table from database.
i want to select the records from database and also want to update certain
fields in TAble control at run time . So, can anybody suggest me the code or
solutions for retrieving records from database and updating the fields.
Points will be definately awarded for Useful answer.
Thanks
Kamal
‎2007 Oct 25 6:18 AM
check these links, it may be helpful to u.
this link contains information about :
1)Table Controls in ABAP Programs
2)Looping Through an Internal Table
3)Table Controls: Examples with Scrolling
http://help.sap.com/saphelp_47x200/helpdata/en/9f/dbac1d35c111d1829f0000e829fbfe/frameset.htm
Instead of using table control, use <b>table control wizard</b>...... very easy to populate the table.... bcoz it will automatically ask everything during its creation...ie from which database table , internal table and which all fields u want to select in the table control etc..
This wizard allows you to create a working table control quickly and easily. It also lets you generate certain standard table maintenance functions.
check this link....
http://help.sap.com/saphelp_47x200/helpdata/en/6d/150d67da1011d3963800a0c94260a5/frameset.htm
Reward me if useful.......
Harimanjesh AN
‎2007 Oct 25 6:26 AM
Hi check these basic example for table control in ABAPDOCU.
This will give you a good idea of working on table controls
demo_dynpro_tabcont_loop
demo_dynpro_tabcont_loop_at
RSDEMO_TABLE_CONTROL
Regards
Gopi
‎2007 Oct 25 7:34 AM
I have taken 2 screens 2nd one has table control
code to be written in module pool is
process before output.
module populate_it.
loop with control tab_ctrl.
module status_0101.
endloop.
****************************
process after input.
loop with control tab_ctrl.
module modify_mod.
endloop.
module mod_del.
module modify_ttab.
*************************************************
*Below is the code to be written in driver program
**************************************************
&----
*& Module pool Z9_TBCTRL_PRASH *
*& *
&----
*& *
*& *
&----
program z9_tbctrl_prash.
data: it_ekko type standard table of z9ekko_prash.
data: it_ekpo type standard table of z9ekpo_prash.
data: it_ekpo_del type standard table of z9ekpo_prash.
data: wa_ekko type z9ekko_prash.
data: wa_ekpo type z9ekpo_prash.
data: wa_ekpo_del type z9ekpo_prash.
data: ok_code_0100 like sy-ucomm.
data: ok_code_0101 like sy-ucomm.
controls: tab_ctrl type tableview using screen 0101.
&----
*& Module POPULATE_IT OUTPUT
&----
text
----
module populate_it output.
clear it_ekpo.
refresh it_ekpo.
clear it_ekko.
refresh it_ekko.
select single ebeln bukrs aedat ernam lifnr ekorg ekgrp waers
into corresponding fields of wa_ekko
from z9ekko_prash where ebeln = wa_ekko-ebeln.
append wa_ekko to it_ekko.
clear wa_ekko.
select ebeln ebelp matnr werks lgort menge meins
into corresponding fields of wa_ekpo
from z9ekpo_prash where ebeln = wa_ekko-ebeln.
append wa_ekpo to it_ekpo.
clear wa_ekpo.
endselect.
*
endmodule. " POPULATE_IT OUTPUT
&----
*& Module STATUS_0101 OUTPUT
&----
text
----
module status_0101 output.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'xxx'.
read table it_ekpo into wa_ekpo index tab_ctrl-current_line.
endmodule. " STATUS_0101 OUTPUT
&----
*& Module validate_ebeln INPUT
&----
text
----
module validate_ebeln input.
if wa_ekko-ebeln <> ' '.
call screen 0101.
endif.
endmodule. " validate_ebeln INPUT
&----
*& Module MODIFY_MOD INPUT
&----
text
----
module modify_mod input.
modify it_ekpo from wa_ekpo index tab_ctrl-current_line.
endmodule. " MODIFY_MOD INPUT
&----
*& Module MODIFY_TTAB INPUT
&----
text
----
module modify_ttab input.
case ok_code_0101.
when 'MODI'.
modify z9ekpo_prash from table it_ekpo.
call screen 0100.
when 'DELE'.
call screen 0100.
endcase.
endmodule. " MODIFY_TTAB INPUT
&----
*& Module MOD_DEL INPUT
&----
text
----
module mod_del input.
case ok_code_0101.
when 'DELE'.
refresh it_ekpo_del.
loop at it_ekpo into wa_ekpo.
if wa_ekpo-mark = 'X'.
move-corresponding wa_ekpo to wa_ekpo_del.
append wa_ekpo_del to it_ekpo_del.
endif.
endloop.
delete z9ekpo_prash from table it_ekpo_del.
endcase.
This code involves deletion from database table also
Hope this will solve ur query
Reward points if it does
‎2007 Oct 25 11:23 AM
hi kamal,
check this links.....
http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbac1d35c111d1829f0000e829fbfe/frameset.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/dbac1d35c111d1829f0000e829fbfe/frameset.htm
I hope it helps.
<b>reward for useful answers</b>
Regards,
Sunil kumar.