Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Table contorl

Former Member
0 Likes
487

Hi all,

How can I change table control attributes dynamically?

Thanks in Advance,

K P

3 REPLIES 3
Read only

Former Member
0 Likes
469

Here is a list of the changeable attributes of a table control (From SAP F1 help):

Structure CXTAB_CONTROL

FIXED_COLS Number of lead columns. Start value is taken from the definition of the table control in screen dynnr.

LINES Controls the vertical scroll bar of the table control. If the LOOP is executed in the screen flow logic without reference to an internal table, that start value of LINES is 0 and must be set in the program so that the scroll bar can be used. With reference to an internal table, LINES is set to the current number of rows in the internal table if the table control is being processed for the first time. However, since this time is not defined, the value of LINES should also be explicitly set to the number of rows of the internal table before the PBO processing in this case.

TOP_LINE Topmost displayed row for next PBO PBO. Set at time of PAI by the position of the vertical slider box.

CURRENT_LINE Current row during a LOOP in the screen flow logic. If the FROM addition to the LOOP statement is not specified, the value of CURRENT_LINE corresponds to the result of sy-stepl + (TOP_LINE - 1).

LEFT_COL Number of first horizontally scrollable column displayed after the lead columns. Is set at time of PAI by the position of the horizontal slider box.

LINE_SEL_MODE Row selection mode: "0" if no rows can be selected , "1" if one row, "2" if several rows. Start value is taken from the definition of the table control in screen dynnr.

COL_SEL_MODE Column selection mode: "0" if no columns can be selected , "1" if one column, "2" if several columns. Start value is taken from the definition of the table control in screen dynnr.

LINE_SELECTOR Flag ("X" or " ") whether there is a selection column. Start value is taken from the definition of the table control in screen dynnr.

H_GRID Flag ("X" or " ") whether there are horizontal separators. Start value is taken from the definition of the table control in screen dynnr.

V_GRID Flag ("X" or " ") whether there are vertical separators. Start value is taken from the definition of the table control in screen dynnr.

COLS Control table for individual columns of structure CXTAB_COLUMN.

INVISIBLE Flag ("X" or " ") whether or not the table control is visible in the window or not.

Structure CXTAB_COLUMN

SCREEN Structure for the attributes of the screen element of the current column. The components can be set for the values described there either directly or using MODIFY SCREEN . The latter overwrites a direct value assignment.

INDEX Current position of the column in the table control. Start value is taken from the definition of the table control in the screen dynnr. Is set to the current value at time of PAI.

SELECTED Flag ("X" or " ") whether or not column is selected. Is set to current value at time of PAI.

VISLENGTH Visible length of column. Start value is taken from the definition of the table control in screen dynnr.

INVISIBLE Flag ("X" or " ") whether or not the column is visible in the table control.

Hope this helps.

Sudha

Read only

vinod_gunaware2
Active Contributor
0 Likes
469

hi

I think u can do that,

Coding on Screen DYNPRO

*PBO----


PROCESS BEFORE OUTPUT.

*----


LOOP AT screen_itab WITH CONTROL TC

CURSOR TC-CURRENT_LINE.

ENDLOOP.

*PAI----


PROCESS AFTER INPUT.

*----


LOOP AT screen_itab.

MODULE USER_COMMAND_9000.

ENDLOOP.

Definition of the Table Control in the TOP INCLUDE

----


  • TABLE CONTROL

----


CONTROLS: TC TYPE TABLEVIEW USING SCREEN 9000.

Hope this will be useful.

regards

vinod

Read only

0 Likes
469

Hi ,

Do check this samples code.

Screen 601 has a table control named CTRL_ANVSTED.

The table should be filled with records from the table zanvstedm

For this purpose you use an internal table called TBL_ANVSTED

  • Declare the table control

CONTROLS CTRL_ANVSTED TYPE TABLEVIEW USING SCREEN 601.

*Internal table used to hold data

DATA: TBL_ANVSTED LIKE ZANVSTEDM OCCURS 100 WITH HEADER LINE,

  • Flag for initial reading

Data: FLAG_INITIAL TYPE I VALUE 0.

PROCESS BEFORE OUTPUT.

*----

-


  • Read data into the table control and the internal table

*----

-


  • PF status etc.

MODULE INITIALIZE_601.

  • Read data from table anvstedm into internal table tbl_anvsted.

MODULE INIT_TBL_ANVSTED.

  • Fill control with data from ythe internal table

LOOP WITH CONTROL CTRL_ANVSTED.

MODULE FILL_CTRL_ANVSTED.

ENDLOOP.

MODULE INIT_TBL_ANVSTED OUTPUT.

  • Read data from table anvstedm into internal table tbl_anvsted.

IF FLAG_INITIAL = 0.

FLAG_INITIAL = 1.

SELECT * FROM ZANVSTEDM INTO TABLE TBL_ANVSTED.

ENDIF.

ENDMODULE.

MODULE FILL_CTRL_ANVSTED OUTPUT.

  • Fill control with data from the internal table

READ TABLE TBL_ANVSTED INDEX CTRL_ANVSTED-CURRENT_LINE.

IF SY-SUBRC NE 0.

EXIT FROM STEP-LOOP.

ENDIF.

ENDMODULE.

PROCESS AFTER INPUT.

  • Write changes in table control to internal table

LOOP WITH CONTROL CTRL_ANVSTED.

MODULE CTRL_ANVSTED.

ENDLOOP.

MODULE CTRL_ANVSTED INPUT.

  • Write changes in table control to internal table

MODIFY TBL_ANVSTED INDEX CTRL_ANVSTED-CURRENT_LINE.

ENDMODULE.

Please go through this link.

http://www.planetsap.com/online_pgm_main_page.htm

Remember few things:

In the table control, take the first field as a BUTTON.

(the button will appear in all rows,and hence act as a RECORD SELECTOR ) --- > give fcode to it „³ IN PAI use the above said logic .

Cheers

Sunny

reward point, if found helpful