2008 Nov 25 10:14 AM
Hi Gurus,
I have developed a module pool program.In that i have a screen with a table control which is editable.
Now i have entered some values in the table control and when i press the save button the data is need to be updated in DB table.
Can anyone send Reference programs for such type of requirement??
Thanks in advance......
Hi Madan,
This has been discussed several times in SDN. You can use the search button to get the results.
https://www.sdn.sap.com/irj/scn/advancedsearch?cat=sdn_all&query=howtoupdatedatabasetablefromtable+control&adv=false&sortby=cm_rnd_rankvalue
Cheers
VJ
2008 Nov 25 10:18 AM
Hi ,
U will have to use....
PAI.
case sy-ucomm.
when 'save'.
modify ....
endcase.
2008 Nov 25 10:18 AM
Hi Madan,
This has been discussed several times in SDN. You can use the search button to get the results.
https://www.sdn.sap.com/irj/scn/advancedsearch?cat=sdn_all&query=howtoupdatedatabasetablefromtable+control&adv=false&sortby=cm_rnd_rankvalue
Cheers
VJ
2008 Nov 25 10:22 AM
Refer this link:
http://help.sap.com/saphelp_nw04/helpdata/EN/9f/dbac5e35c111d1829f0000e829fbfe/content.htm
Regards
Neha
2008 Nov 25 10:24 AM
In PAI of your prog
Use SY-UCOMM
When its SAVE
Write a subroutine MODULE...
In this module use
MODIFY dbtab FROM warea.
This will help
Regards,
Prashant
2008 Nov 25 6:40 PM
Hi,
Assuming that you have written the modify statement for internal table in PAI in the loop ( ie your internal table has latest updated values ) , all you need to do is is to add the following code to your function code save.:
modify DB-rabname from table itab.
and you have to add SAVE button to you rPF status too.
regards
Suzie
2008 Dec 11 11:14 AM
program zmodpl2.
tables : ztable.
data : it_table type table of ztable with header line.
controls : tabcntrl type tableview using screen 100.
data : ok_code type sy-ucomm.
&----
*& Module STATUS_0100 OUTPUT
&----
text
----
module status_0100 output.
set pf-status '0100'.
set titlebar '100'.
move-corresponding it_table to ztable.
endmodule. " STATUS_0100 OUTPUT
&----
*& Module USER_COMMAND_0100 INPUT
&----
text
----
module user_command_0100 input.
case ok_code.
when 'INS'.
it_table-carrier = ztable-carrier .
it_table-personnelno = ztable-personnelno.
it_table-flightname = ztable-flightname.
it_table-flightdate = ztable-flightdate.
it_table-f_name = ztable-f_name.
it_table-l_name = ztable-l_name.
it_table-rol_emp = ztable-rol_emp.
it_table-telephone = ztable-telephone.
it_table-city_dept = ztable-city_dept.
it_table-city_arrv = ztable-city_arrv.
append it_table.
insert into ztable values it_table.
message 'SUCCESSFUL INSERTION OF DATA' type 'S' .
when 'EXIT'.
leave program.
endcase.
endmodule. " USER_COMMAND_0100 INPUT
*********************************************************************************************
and the flow logic will be :
process before output.
loop at it_table with control tabcntrl.
module status_0100.
endloop.
process after input.
loop at it_table .
module user_command_0100.
endloop.
2008 Dec 11 11:23 AM
2008 Dec 11 3:18 PM
Hi,
MODULE check INPUT.
MODIFY it_zmara INDEX t_ctrl-current_line.
IF t_ctrl-current_line GT ln.
READ TABLE it_zmara WITH KEY matnr = it_zmara-matnr.
IF sy-subrc NE 0.
*INSERTING REC IF IT DOES NOT EXIST
APPEND it_zmara.
ELSE.
MESSAGE i005 WITH 'MATERIAL NO.' it_zmara-matnr
'ALREADY EXIST'.
ENDIF.
ENDIF.
ENDMODULE. " CHECK INPUT
MODULE user_command_1000 INPUT.
DATA: ok_code_ans(1) TYPE c. "STORING ANSWER OF OK_CODE
IF ok_code = 'PF_CAN'.
LEAVE TO SCREEN 0.
ENDIF.
IF ok_code = 'CB_SAV'.
MODIFY zmara FROM TABLE it_zmara.
ENDIF.
end module.
Thanks,
Krishna...
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |