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

Help regarding Vertical Scrolling in Table Control.

Former Member
0 Likes
2,793

Hello experts,

Thanks for answering my previous question very quickly. Once again I came up here to clear my doubt in Table controls.

Can anyone send me a link which will explain the Table controls vertical scrolling easily and with understandable example. Iam very much confused with different answers in this forum regarding vertical scrolling.

Actually my problem is that Iam able to enable the vertical scroll bar in table control . However, If iam moving the scroll bar up and down my data is vanishing and at last empty table control is looking at my face to add some data into it.

Thanks in advance and if possible send me some video links to clear of my mind.

Hello experts,

Thanks for answering my previous question very quickly. Once again I came up here to clear my doubt in Table controls.

Can anyone send me a link which will explain the Table controls vertical scrolling easily and with understandable example. Iam very much confused with different answers in this forum regarding vertical scrolling.

Actually my problem is that Iam able to enable the vertical scroll bar in table control . However, If iam moving the scroll bar up and down my data is vanishing and at last empty table control is looking at my face to add some data into it.

Thanks in advance and if possible send me some video links to clear of my mind.

7 REPLIES 7
Read only

Former Member
0 Likes
1,791

Hi,

Please check this link

Please search threads before you posting

Thanks and regards

Durga.K

Read only

0 Likes
1,791

Thank you,

My code is as follows

DATA: BEGIN OF IT_PO OCCURS 0,

SL_NO LIKE EKPO-BNFPO,

SAPCODE LIKE EKPO-MATNR,

DESCRIPTION LIKE EKPO-TXZ01,

UOM LIKE EKPO-MEINS,

EBELP LIKE EKPO-EBELP,

BALANCE_QTY TYPE P DECIMALS 2,"LIKE EKET-WEMNG,

CHALLAN_QTY TYPE P DECIMALS 2,"LIKE EKET-WEMNG,

END OF IT_PO.

DATA: IT_PO_CHLN like IT_PO OCCURS 0 WITH HEADER LINE.

SCREEN' S FLOW LOGIC

*********************************************************************

PROCESS BEFORE OUTPUT.

MODULE STATUS_0002.

LOOP AT IT_PO WITH CONTROL SCR2_TAB_CTRL.

ENDLOOP.

PROCESS AFTER INPUT.

LOOP AT IT_PO.

MODULE SCR2GET_DATA4M_TABLE.

ENDLOOP.

MODULE EXIT_SCREEN AT EXIT-COMMAND.

MODULE USER_COMMAND_0002.

*********************************************************************

PBO

MODULE STATUS_0002 OUTPUT.

SET PF-STATUS 'ZPFSTATUS_SCR9999'.

DESCRIBE TABLE IT_PO LINES SCR2_TAB_CTRL-LINES.

ENDMODULE.

*********************************************************************

PAI :-

CASE SAVE_OK.

WHEN 'GET_DATA'.

          • for button provided on screen to get data regarding a key *******

I have written code to get data into IT_PO .

WHEN 'ENTER'.

REFRESH: IT_PO.

SORT IT_PO_CHLN.

DELETE ADJACENT DUPLICATES FROM IT_PO_CHLN.

LOOP AT IT_PO_CHLN.

MOVE-CORRESPONDING IT_PO_CHLN TO IT_PO.

APPEND IT_PO.

ENDLOOP.

CLEAR: IT_PO_CHLN.

REFRESH: IT_PO_CHLN.

LEAVE TO SCREEN 3.

ENDCASE.

**********************************************************************

MODULE SCR2GET_DATA4M_TABLE INPUT.

MOVE-CORRESPONDING IT_PO TO IT_PO_CHLN.

APPEND IT_PO_CHLN.

ENDMODULE.

Read only

former_member203501
Active Contributor
0 Likes
1,791

did you searched for the same ....i can see many answers for the same ..

look some of them may be useful for you....i am not sure...

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
1,791

Hi,

What you need to do is to modify the internal table from table control whenever a user action is performed.

Follow:-

it_zekpo is my internal table w/o header line,

wa_zekpo is work area.

Name of input/output fields on screen are:-

wa_zekpo-field1,

wa_zekpo-field2, and so on...

Use code:-

At screen logic:-


PROCESS BEFORE OUTPUT.
*  MODULE status_8003.
 
  LOOP WITH CONTROL po_tab. "po_tab is table control on screen 8003
    MODULE read_data. "<--read internal table into table control
  ENDLOOP.
 
PROCESS AFTER INPUT.
*  MODULE user_command_8003.
 
  LOOP WITH CONTROL po_tab.
    MODULE modify_data. "<--modify internal table from table control
  ENDLOOP.

In PBO:-


*&---------------------------------------------------------------------*
*&      Module  READ_DATA  OUTPUT
*&---------------------------------------------------------------------*
MODULE read_data OUTPUT.
  READ TABLE it_zekpo INTO wa_zekpo INDEX po_tab-current_line. "po_tab is table control name
 
  data : line_count type i.
 
  describe it_zekpo
  lines line_count.
 
  po_tab-lines = line_count + 10.
  "to increase the number of lines in table control dynamically and enable vertical scroll bar
 
ENDMODULE.                 " READ_DATA  OUTPUT

In PAI:-


*&---------------------------------------------------------------------*
*&      Module  MODIFY_DATA  INPUT
*&---------------------------------------------------------------------*
MODULE MODIFY_DATA INPUT.
  MODIFY IT_ZEKPO FROM WA_ZEKPO INDEX po_tab-currentline.
  "this will modify the contents of existing line
ENDMODULE.                 " MODIFY_DATA  INPUT

Now when you add some records into table control and perform any user action, the records will retain.

Hope this helps you.

Regards,

Tarun

Read only

Former Member
0 Likes
1,791

see the following example:

FORM compute_scrolling_in_tc USING p_tc_name

p_ok.

&SPWIZARD: BEGIN OF LOCAL DATA

DATA l_tc_new_top_line TYPE i.

DATA l_tc_name LIKE feld-name.

DATA l_tc_lines_name LIKE feld-name.

DATA l_tc_field_name LIKE feld-name.

FIELD-SYMBOLS <tc> TYPE cxtab_control.

FIELD-SYMBOLS <lines> TYPE i.

&SPWIZARD: END OF LOCAL DATA

ASSIGN (p_tc_name) TO <tc>.

*&SPWIZARD: get looplines of TableControl *

CONCATENATE 'G_' p_tc_name '_LINES' INTO l_tc_lines_name.

ASSIGN (l_tc_lines_name) TO <lines>.

*&SPWIZARD: is no line filled? *

IF <tc>-lines = 0.

*&SPWIZARD: yes, ... *

l_tc_new_top_line = 1.

ELSE.

*&SPWIZARD: no, ... *

CALL FUNCTION 'SCROLLING_IN_TABLE'

EXPORTING

entry_act = <tc>-top_line

entry_from = 1

entry_to = <tc>-lines

last_page_full = c_x

loops = <lines>

ok_code = p_ok

overlapping = c_x

IMPORTING

entry_new = l_tc_new_top_line

EXCEPTIONS

  • NO_ENTRY_OR_PAGE_ACT = 01

  • NO_ENTRY_TO = 02

  • NO_OK_CODE_OR_PAGE_GO = 03

OTHERS = 0.

ENDIF.

*&SPWIZARD: get actual tc and column *

GET CURSOR FIELD l_tc_field_name

AREA l_tc_name.

IF syst-subrc = 0.

IF l_tc_name = p_tc_name.

*&SPWIZARD: et actual column *

SET CURSOR FIELD l_tc_field_name LINE 1.

ENDIF.

ENDIF.

*&SPWIZARD: set the new top line *

<tc>-top_line = l_tc_new_top_line.

ENDFORM. " COMPUTE_SCROLLING_IN_TC

Read only

0 Likes
1,791

Please go through my code and suggest me solution.

In my table control Iam displaying as well as getting data to update.

So I have written code for "Enter" like it will get data to another internal table IT_PO_CHLN when enter was pressed with changes that was done in table control and while displaying it will upload the changes compltly to table which was used in table control(IT_PO).

So, after I scroll down at IT_PO on screen and press enter my lines that come first in IT_PO are disappearing when I scroll it up again.

Just like that after few scrolls all the data in Table control is disapperaing.

Thanks Experts I resolved it myself. I used following code,I hope this may be helpful for someone in need

-


Flow Logic

-


PROCESS BEFORE OUTPUT.

MODULE STATUS_0001.

LOOP AT IT_TABLE WITH CONTROL TABLE_CONTROL CURSOR

TABLE_CONTROL-CURRENT_LINE.

ENDLOOP.

PROCESS AFTER INPUT.

LOOP AT IT_TABLE.

MODULE GET_DATA4M_SCREEN.

ENDLOOP.

MODULE USER_COMMAND_0001.

-


Program

-


REPORT ZTABCTRL.

TABLES: SFLIGHT.

CONTROLS: TABLE_CONTROL TYPE TABLEVIEW USING SCREEN 1.

DATA: BEGIN OF IT_TABLE OCCURS 0,

ID TYPE I,

COL1 LIKE SFLIGHT-CARRID,

COL2 LIKE SFLIGHT-CONNID,

END OF IT_TABLE.

DATA: OK_CODE TYPE SY-UCOMM,SAVE_OK LIKE OK_CODE.

----


MODULE STATUS_0001 OUTPUT.

SET PF-STATUS 'ZSCR1'.

DESCRIBE TABLE IT_TABLE LINES TABLE_CONTROL-LINES.

ENDMODULE. "STATUS_0001 OUTPUT

----


MODULE USER_COMMAND_0001 INPUT.

SAVE_OK = OK_CODE.

CLEAR: OK_CODE.

CASE SAVE_OK.

WHEN 'ENTER'.

LEAVE TO SCREEN 1.

WHEN 'GET_DATA'.

REFRESH: IT_TABLE.

IT_TABLE-ID = 0.

SELECT CARRID CONNID INTO (IT_TABLE-COL1,IT_TABLE-COL2) FROM SFLIGHT WHERE CARRID = 'AA'.

IT_TABLE-ID = IT_TABLE-ID + 1.

APPEND IT_TABLE.

ENDSELECT.

LEAVE TO SCREEN 1.

WHEN 'BACK' OR 'CANCEL' OR 'EXIT'.

LEAVE PROGRAM.

WHEN OTHERS.

ENDCASE.

ENDMODULE. "USER_COMMAND_0001 INPUT

----


MODULE GET_DATA4M_SCREEN INPUT.

MODIFY IT_TABLE FROM IT_TABLE INDEX TABLE_CONTROL-CURRENT_LINE.

ENDMODULE. "GET_DATA4M_SCREEN INPUT

----


Read only

Former Member
0 Likes
1,791

Plese chek then one standard report DEMO_DYNPRO_TABLE_CONTROL_2