‎2007 May 07 12:37 PM
hi friends,
i have two text field and a button in a screen.if give the value and click the button it should get updated in the table control which is in the next screen.plz
help me with some sample coding.
‎2007 May 07 1:42 PM
REPORT DEMO.
TABLES SSCRFIELDS.
DATA FLAG.
SELECTION-SCREEN:
BEGIN OF SCREEN 500 AS WINDOW TITLE TIT,
BEGIN OF LINE,
PUSHBUTTON 2(10) BUT1 USER-COMMAND CLI1,
PUSHBUTTON 12(10) TEXT-020 USER-COMMAND CLI2,
END OF LINE,
BEGIN OF LINE,
PUSHBUTTON 2(10) BUT3 USER-COMMAND CLI3,
PUSHBUTTON 12(10) TEXT-040 USER-COMMAND CLI4,
END OF LINE,
END OF SCREEN 500.
AT SELECTION-SCREEN.
CASE SSCRFIELDS.
WHEN 'CLI1'.
FLAG = '1'.
WHEN 'CLI2'.
FLAG = '2'.
WHEN 'CLI3'.
FLAG = '3'.
WHEN 'CLI4'.
FLAG = '4'.
ENDCASE.
START-OF-SELECTION.
TIT = 'Four Buttons'.
BUT1 = 'Button 1'.
BUT3 = 'Button 3'.
CALL SELECTION-SCREEN 500 STARTING AT 10 10.
CASE FLAG.
WHEN '1'.
WRITE / 'Button 1 was clicked'.
WHEN '2'.
WRITE / 'Button 2 was clicked'.
WHEN '3'.
WRITE / 'Button 3 was clicked'.
WHEN '4'.
WRITE / 'Button 4 was clicked'.
WHEN OTHERS.
WRITE / 'No Button was clicked'.
ENDCASE.
award point if this is useful
‎2007 May 07 12:42 PM
Hi,
For table control we will have the internal table, so when you press that button, move that value to that table control Internal table
Regards
Sudheer
‎2007 May 08 5:44 AM
can you give an example regarding moving internal table to table control..
‎2007 May 08 6:51 AM
Hi,
GO through the below programs.
demo_dynpro_tabcont_loop_at
demo_dynpro_tabcont_loop
<b>Reward if useful</b>
Sudheer
‎2007 May 08 8:43 AM
hi Karthik ,
Here you go with the sample coding of moving internal table values to table control on module pool programs :
in screen painter flow-logic ............
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 your program .............
include z_tab_ctrl_top . " global Data
program z_tab_ctrl.
tables : sflight,sbook,zsflight.
types:begin of t_tab_con_01 ,
carrid like sflight-carrid,
connid like sflight-connid,
sel type c,
end of t_tab_con_01.
data: g_tab_con_01_itab type t_tab_con_01 occurs 0 with header line,
g_tab_con_01_wa type t_tab_con_01,
g_tab_con_01_copied ,
g_tab_con_01_lines like sy-loopc,
ok_code like sy-ucomm,
lines type i,
init ,
fill type i.
controls: tab_con type tableview using screen 3000.
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 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. " fill_tab_con OUTPUT
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.
module tab_con_move output.
move-corresponding g_tab_con_01_wa to sflight.
endmodule. " tab_con_move OUTPUT
module tab_con_get_lines output.
g_tab_con_01_lines = sy-loopc.
endmodule. " tab_con_get_lines OUTPUT
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. " tab_con_modify INPUT
module populate_tab_ctrl input.
if sy-subrc eq 0.
endif.
endmodule.
Look at the following modules in the above program ....
fill_tab_con
tab_con_modify
tab_con_get_lines
update_table_control
This will definately solve your problem or give an idea for solution ....
reward if helpful,
Regards,
Ranjita
‎2007 May 07 1:42 PM
REPORT DEMO.
TABLES SSCRFIELDS.
DATA FLAG.
SELECTION-SCREEN:
BEGIN OF SCREEN 500 AS WINDOW TITLE TIT,
BEGIN OF LINE,
PUSHBUTTON 2(10) BUT1 USER-COMMAND CLI1,
PUSHBUTTON 12(10) TEXT-020 USER-COMMAND CLI2,
END OF LINE,
BEGIN OF LINE,
PUSHBUTTON 2(10) BUT3 USER-COMMAND CLI3,
PUSHBUTTON 12(10) TEXT-040 USER-COMMAND CLI4,
END OF LINE,
END OF SCREEN 500.
AT SELECTION-SCREEN.
CASE SSCRFIELDS.
WHEN 'CLI1'.
FLAG = '1'.
WHEN 'CLI2'.
FLAG = '2'.
WHEN 'CLI3'.
FLAG = '3'.
WHEN 'CLI4'.
FLAG = '4'.
ENDCASE.
START-OF-SELECTION.
TIT = 'Four Buttons'.
BUT1 = 'Button 1'.
BUT3 = 'Button 3'.
CALL SELECTION-SCREEN 500 STARTING AT 10 10.
CASE FLAG.
WHEN '1'.
WRITE / 'Button 1 was clicked'.
WHEN '2'.
WRITE / 'Button 2 was clicked'.
WHEN '3'.
WRITE / 'Button 3 was clicked'.
WHEN '4'.
WRITE / 'Button 4 was clicked'.
WHEN OTHERS.
WRITE / 'No Button was clicked'.
ENDCASE.
award point if this is useful
‎2007 May 09 5:57 AM