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 Control

Former Member
0 Likes
807

i have problem in table control..

i have created one table control in module pool and i am displaying data in it.

now the visible lines in table control is 10.

total lines in table control are 20.

whenever i scroll down to view other lines..it calls the other screen of the program.

i dont want to switch to the other screen while scrolling...

whats the solution for this ??

thanks.

Naresh

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
637

hi Naresh

check the tcode SAPBC410A_TC1

u wil get an idea..

the table control also depends on the screen resolution.. so chk the screen resolution of ur system..

thanks

5 REPLIES 5
Read only

Former Member
0 Likes
638

hi Naresh

check the tcode SAPBC410A_TC1

u wil get an idea..

the table control also depends on the screen resolution.. so chk the screen resolution of ur system..

thanks

Read only

Former Member
0 Likes
637

Hi Naresh,

Check ur code in PAI, i think u have used a function code that corelate with function code of scrolling (same as scrolling function code).

I think it will solve ur problem.

Regards

Krishnendu

Read only

Former Member
0 Likes
637

hi

Read only

0 Likes
637

Hi

While writing code for u PAI and write your coding for scroll option

Try like this

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. 

A resizable table control called FLIGHTS is defined. The fields of the table control are transferred from the structure DEMO_CONN in the ABAP Dictionary. The first two columns are lead columns. The corresponding fields are output fields. A title bar, column headers, and a selection column are created. The component MARK of type character with length 1 from structure DEMO_CONN is assigned to the selection column. You can select one column and several lines.

It has the following flow 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.

The system executes a loop at PBO and PAI using the table control FLIGHTS. During the PBO loop, a module is called to fill the table control from table ITAB of the ABAP program. During the PAI loop, a module is called to modify table ITAB.

Before the PBO loop, in the module STATUS_0100 the current number of lines of the internal table ITAB is placed in component LINES of control structure FLIGHTS. This helps the system to correctly install the scroll bar of the table control.

During the PBO loop, in the module FILL_TABLE_CONTROL the work area DEMO_CONN is filled with values from the internal table, where the row index corresponds to the current row of the table control.

During the PAI loop, in the module READ_TABLE_CONTROL the current number of the loop SY-LOOPC in the table control is placed an auxiliary variable. The number is dependent on the size of the screen. The rows of the internal table, whose row index corresponds to the current row of the table control, are overwritten with the contents of the work area DEMO_CONN. User input is transferred from the input fields of the control to the internal table. In particular, the internal table also contains a flag in the column MARK to indicate whether the row of the table control is selected or not.

After the PAI loop, user input is processed in the module USER_COMMAND. The GUI status SCREEN_100 provides the appropriate function codes. You can scroll line by line or page by page, or Goto the first or last page. You can implement scrolling by setting the component TOP_LINE of control structure FLIGHTS. For page-by-page scrolling the auxiliary variable that is filled in the PAI loop by SY-LOOPC is used as the step size.

Check this link

http://www.sap-img.com/ab031.htm

Regards

Pavan

Message was edited by:

Pavan praveen

Read only

varma_narayana
Active Contributor
0 Likes
637

Hi Naresh..

For table control Vertical scrolling Triggers the PAI event.

You might have given the Next Screen or Coded some statement like

SET Screen

or

Leave to Screen.

So it will automatically take you to next screen when the Vertical scrolling is done.

To avoid this in Screen Attributes set the NEXT SCREEN as the Same screen itself.

This should help.

<b>Reward if Helpful.</b>