‎2008 May 07 10:50 AM
hi gurus
can anyone suggest me
how to do table controls in dialog programming
thanks®ards
kals.
‎2008 May 07 10:52 AM
Refer the folloeing code:
Screen logic:
process before output.
module status_0100.
loop with control flights.
module fill_table_control.
endloop.
process after input.
module cancel at exit-command.
loop with control flights.
module read_table_control.
endloop.
module user_command_0100.
ABAP Logic:
REPORT demo_dynpro_tabcont_loop.
CONTROLS flights TYPE TABLEVIEW USING SCREEN 100.
DATA: ok_code TYPE sy-ucomm,
save_ok TYPE sy-ucomm.
DATA: itab TYPE TABLE OF demo_conn,
fill TYPE i.
TABLES demo_conn.
DATA: lines TYPE i,
limit TYPE i.
SELECT * FROM spfli INTO CORRESPONDING FIELDS OF TABLE itab.
CALL SCREEN 100.
MODULE status_0100 OUTPUT.
SET PF-STATUS 'SCREEN_100'.
DESCRIBE TABLE itab LINES fill.
flights-lines = fill.
ENDMODULE.
MODULE fill_table_control OUTPUT.
READ TABLE itab INTO demo_conn INDEX flights-current_line.
ENDMODULE.
MODULE cancel INPUT.
LEAVE PROGRAM.
ENDMODULE.
MODULE read_table_control INPUT.
lines = sy-loopc.
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 'NEXT_LINE'.
flights-top_line = flights-top_line + 1.
limit = fill - lines + 1.
IF flights-top_line > limit.
flights-top_line = limit.
ENDIF.
WHEN 'PREV_LINE'.
flights-top_line = flights-top_line - 1.
IF flights-top_line < 0.
flights-top_line = 0.
ENDIF.
WHEN 'NEXT_PAGE'.
flights-top_line = flights-top_line + lines.
limit = fill - lines + 1.
IF flights-top_line > limit.
flights-top_line = limit.
ENDIF.
WHEN 'PREV_PAGE'.
flights-top_line = flights-top_line - lines.
IF flights-top_line < 0.
flights-top_line = 0.
ENDIF.
WHEN 'LAST_PAGE'.
flights-top_line = fill - lines + 1.
WHEN 'FIRST_PAGE'.
flights-top_line = 0.
ENDCASE.
ENDMODULE.
‎2008 May 07 11:11 AM
Hi kals.
I think the easiest way to get started with table controls is that you create a small test program with an internal table that you read some data into.
Then your program should call a screen. (I guess you know how to create and call a simple screen.)
In the screen painter you now use the table control wizard to create the table control.
Choose the table control wizard from the element toolbar.
Define the table control area on the screen.
The wizard is now started in a separate dialog box.
The wizard now takes you through the steps required to generate a working table control. The process consists of seven dialogs in which you define the attributes of the table controls and the ABAP code that needs to be generated. You can navigate between the dialogs using the Continue and Back buttons. When you choose Finish, the table control is generated.
Best regards
Thomas Madsen Nielsen