terça-feira, 9 de março de 2010

How to create a Control Table

In the program top, you have to declare the table control and the screen in witch it apears:

CONTROLS table_con TYPE TABLEVIEW USING SCREEN 200.

t_tc is the internal table with the actual content of the table control.
tc is the name of the container of the colums of the table control.

In the screen flow:


PROCESS BEFORE OUTPUT.
MODULE status_0100.

LOOP AT t_tc WITH CONTROL table_con.
MODULE actualiza_tc.
ENDLOOP.
*
PROCESS AFTER INPUT.

LOOP AT t_tc.
MODULE actualiza_t_tc.
ENDLOOP.

MODULE user_command_0200.


*&---------------------------------------------------------------------*
*& Module actualiza_t_tc INPUT
*&---------------------------------------------------------------------*
MODULE actualiza_t_tc INPUT.

READ TABLE t_tc INDEX table_con-current_line.
IF sy-subrc = 0.
MODIFY t_tc FROM tc INDEX table_con-current_line.
ELSE.
APPEND tc TO t_tc.
ENDIF.


*&---------------------------------------------------------------------*
*& Module actualiza_tc OUTPUT
*&---------------------------------------------------------------------*
MODULE actualiza_tc OUTPUT.

MOVE-CORRESPONDING t_tc TO tc.

ENDMODULE. " actualiza_tc OUTPUT

Sem comentários:

Enviar um comentário