‎2007 May 15 3:32 PM
Hi guys,
Please can you suggest me, how to come out this problem.
I have one Ztable around 10 fields, I was designed one screen using same fields, I want fetch each record from the Ztable and modify the record again update the same record to my Ztable.
Please suggest me how to do this one, if possible please send some similar coding, it will help me lot. Otherwise suggest some examples in the SDN.
Thanks
Gourisankar
‎2007 May 16 11:33 AM
hi Gouri ,
I have an example with the similar requirement ...
here you go with the sample codes ....
IN FLOW logic of the screen ...
process before output.
module status_3000.
loop at g_tab_con_01_itab
into g_tab_con_01_wa
with control tab_con
cursor tab_con-current_line.
module tab_con_move.
endloop.
process after input.
module exit at exit-command.
module user_command_3000.
module clear_ok_code.
loop at g_tab_con_01_itab.
module read_tab_con.
endloop.
in the module pool program ....
include z_tab_ctrl_top ( do the declarations )
module status_3000 output.
set pf-status 'ST100'.
set titlebar 'T100'.
endmodule.
module update_table_control input.
describe table g_tab_con_01_itab lines tab_con-lines.
endmodule.
module exit input.
ok_code = sy-ucomm.
if ok_code eq 'BACK' or ok_code eq 'EXIT' or ok_code eq 'CANCEL'.
leave program .
endif.
endmodule.
module user_command_3000 input.
ok_code = sy-ucomm.
endmodule.
module clear_ok_code input.
clear ok_code.
endmodule.
module fill_tab_con output.
read table g_tab_con_01_itab into zsflight index tab_con-current_line.
endmodule.
module read_tab_con input.
*lines = sy-loopc.
read table g_tab_con_01_itab into g_tab_con_01_wa index tab_con-current_line.
if sy-subrc eq 0.
move-corresponding sflight to g_tab_con_01_wa.
modify g_tab_con_01_itab from g_tab_con_01_wa index tab_con-current_line.
else.
move-corresponding sflight to g_tab_con_01_wa.
append g_tab_con_01_wa to g_tab_con_01_itab.
endif.
endmodule.
module tab_con_move output.
move-corresponding g_tab_con_01_wa to sflight.
endmodule.
module tab_con_get_lines output.
g_tab_con_01_lines = sy-loopc.
endmodule.
module tab_con_modify input.
move-corresponding sflight to g_tab_con_01_wa.
modify g_tab_con_01_itab
from g_tab_con_01_wa
index tab_con-current_line.
endmodule.
This will surely help you with your problem ...
Reward for helpful answers ....
Regards,
Ranjita
‎2007 May 15 3:33 PM
u can make use of table control
u can get good examples on table control in tcode ABAPDOCU and DWDM
Examples
demo_dynpro_tabcont_loop
demo_dynpro_tabcont_loop_at
null
‎2007 May 15 3:37 PM
Hi ,
Write the select query for retrieving the data and using PBO move them to screen .
Then update the data in the screen and click on the update button if u have any .
In the PAI read the records and move them to database table .
‎2007 May 15 3:39 PM
Hi,
Flow for ur Screen is as follows
PBO of screen>Screen>PAI of screen.
In PBO,Fetch the record from Ztable and display it on ur screen and
In PAI, Modify or Update ur Ztable.
Do reply me if u need any clarification.
Regards,
Ranjit Thakur.
<b>Please Mark The Helpful Answer.</b>
‎2007 May 16 11:16 AM
Hi Ranjit,
Please can you provide some coding, if you have.
Thanks,
Gourisankar.
‎2007 May 16 11:24 AM
Hi,
REPORT ZBHMOD1 .
DATA:OKCODE1 LIKE SY-UCOMM,
OKCODE2 LIKE SY-UCOMM.
DATA:N1(10) TYPE N,N2(10) TYPE N,RES(12) TYPE N.
MODULE USER_COMMAND_1000 INPUT.
CASE OKCODE1.
WHEN 'NEXT'.
RES = N1 + N2.
SET SCREEN 1001.
WHEN 'CLEA'.
CLEAR:N1,N2.
WHEN 'BACK'.
SET SCREEN '0'.
ENDCASE.
ENDMODULE. " USER_COMMAND_1000 INPUT
MODULE STATUS_1000 OUTPUT.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'TIT1'.
ENDMODULE. " STATUS_1000 OUTPUT
MODULE USER_COMMAND_1001 INPUT.
CASE OKCODE2.
WHEN 'BACK'.
SET SCREEN 1000.
ENDCASE.
ENDMODULE. " USER_COMMAND_1001 INPUT
MODULE STATUS_1001 OUTPUT.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'TIT2'.
ENDMODULE. " STATUS_1001 OUTPUT
FLOW LOGIC:
PROCESS BEFORE OUTPUT.
MODULE STATUS_1000.
*
PROCESS AFTER INPUT.
MODULE USER_COMMAND_1000.
PROCESS BEFORE OUTPUT.
MODULE STATUS_1001.
*
PROCESS AFTER INPUT.
MODULE USER_COMMAND_1001.
rgds,
bharat.
‎2007 May 16 11:33 AM
hi Gouri ,
I have an example with the similar requirement ...
here you go with the sample codes ....
IN FLOW logic of the screen ...
process before output.
module status_3000.
loop at g_tab_con_01_itab
into g_tab_con_01_wa
with control tab_con
cursor tab_con-current_line.
module tab_con_move.
endloop.
process after input.
module exit at exit-command.
module user_command_3000.
module clear_ok_code.
loop at g_tab_con_01_itab.
module read_tab_con.
endloop.
in the module pool program ....
include z_tab_ctrl_top ( do the declarations )
module status_3000 output.
set pf-status 'ST100'.
set titlebar 'T100'.
endmodule.
module update_table_control input.
describe table g_tab_con_01_itab lines tab_con-lines.
endmodule.
module exit input.
ok_code = sy-ucomm.
if ok_code eq 'BACK' or ok_code eq 'EXIT' or ok_code eq 'CANCEL'.
leave program .
endif.
endmodule.
module user_command_3000 input.
ok_code = sy-ucomm.
endmodule.
module clear_ok_code input.
clear ok_code.
endmodule.
module fill_tab_con output.
read table g_tab_con_01_itab into zsflight index tab_con-current_line.
endmodule.
module read_tab_con input.
*lines = sy-loopc.
read table g_tab_con_01_itab into g_tab_con_01_wa index tab_con-current_line.
if sy-subrc eq 0.
move-corresponding sflight to g_tab_con_01_wa.
modify g_tab_con_01_itab from g_tab_con_01_wa index tab_con-current_line.
else.
move-corresponding sflight to g_tab_con_01_wa.
append g_tab_con_01_wa to g_tab_con_01_itab.
endif.
endmodule.
module tab_con_move output.
move-corresponding g_tab_con_01_wa to sflight.
endmodule.
module tab_con_get_lines output.
g_tab_con_01_lines = sy-loopc.
endmodule.
module tab_con_modify input.
move-corresponding sflight to g_tab_con_01_wa.
modify g_tab_con_01_itab
from g_tab_con_01_wa
index tab_con-current_line.
endmodule.
This will surely help you with your problem ...
Reward for helpful answers ....
Regards,
Ranjita
‎2007 May 16 11:47 AM
hi gouri,
in screen painter -> goto -> select get from dictionay ->ok -> select required fileds -> place then in screen -> activate -> back.
in top include module or in pbo module
declare the work area [zstud] for database table
as
data: zstud like zstud.
create buttons like select insert update modfy in screen by giving function codes
in pbo event.
case sy-ucomm.
when 'select' . [function code of select button]
select * from zstud into zstud.
when 'modify'. [function code of modify button]
modify zstud.
when 'update'. [function code of update button]
update zstud.
when 'clear'.
zstud-t1 = ' '.
zstud-t2 = ' '.
zstud-t3 = ' '.
........
......
endcase.
if helpful reward some points.
with regards,
suresh babu aluri.
when '