Table Control In Dialog Program

How to implement table controls in dialog?

Follow these steps:
- Create a structure in SE11
- In the program:
  - Declare the structure in the TABLES statement
  - Declare an internal table of the same size of the structure.
  - Declare the table control:
    - CONTROLS <table_control_name> TYPE TABLEVIEW USING SCREEN <screen_number>.
 - In the Screen
  - Insert the table control with the name used in the topic above as <table_control_name>
  - Insert the fields of the structure into the table control
  - declare status_<screen_number> MODULE
  - do a loop statement like this:
  LOOP AT <internal_table> WITH CONTROL <table_control_name>.
    MODULE table_to_screen_<screen_number>.
  ENDLOOP.
- In the PBO
  - describe the number of lines of your internal table to the control:
MODULE status_<screen_number> OUTPUT.
* SET PF-STATUS 'xxxxxxxx'.
* SET TITLEBAR 'xxx'.

- Move the values from the internal table to the structure:
MODULE table_to_screen_<screen_number> OUTPUT.
  move <internal_table_header> to <structure>.
ENDMODULE.

- In the PAI
  - do a loop statement like this
  LOOP AT <internal_table>.
    MODULE screen_to_table<screen_number>.
  ENDLOOP.

MODULE table_to_screen_<screen_number> OUTPUT.
  DESCRIBE TABLE <internal_table> LINES g_lines.

  move <structure> to <internal_table_header>

  IF g_lines < <table_control_name>-current_line.
    APPEND <internal_table>.
  ELSE.
    MODIFY <internal_table> INDEX <table_control_name>.-current_line.
  ENDIF.
ENDMODULE.

More Abapers Questions:

ABAP Books List
ABAP/4 Certification, Programming and Object Oriented Programming Books

Smart Forms
SAP Smartforms

ABAP Menu:
ABAP Example Hints and Tips

Return to Index:-
SAP ABAP/4 Programming, Basis Administration, Configuration Hints and Tips

(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
All product names are trademarks of their respective companies.  The site www.gotothings.com is in no way affiliated with SAP AG.
Any unauthorised copying or mirroring is prohibited.