2009 Feb 11 8:03 AM
Hi Experts,
I am working on module pool program, iam facing a problem with table controle while scrolling the tab down an d again up its removeng the values of the top line but the data in internal table.
iam displaying the data from data base to fill the some additionl data corresponding which i ll save in ztable.
Please sort out the issue regarding scrolling.
Thanks in advance.
D Tarun Kumar
2009 Feb 11 8:44 AM
Hi,
What you need to do is to modify the internal table whenever user performs any action.
Use this code, its working:-
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...
At screen flow-logic
PROCESS BEFORE OUTPUT.
* MODULE status_8003.
LOOP WITH CONTROL po_tb.
MODULE read_data.
ENDLOOP.
PROCESS AFTER INPUT.
* MODULE user_command_8003.
LOOP WITH CONTROL po_tb.
MODULE modify_data.
ENDLOOP.
MODULE save_data.
In PBO
*&---------------------------------------------------------------------*
*& Module READ_DATA OUTPUT
*&---------------------------------------------------------------------*
MODULE read_data OUTPUT.
READ TABLE it_zekpo INTO wa_zekpo INDEX po_tb-current_line. "po_tab is table control name
data : line_count type i.
describe it_zekpo
lines line_count.
po_tb-lines = line_count + 10.
"to increase the number of lines in table control dynamically
ENDMODULE. " READ_DATA OUTPUT
In PAI
*&---------------------------------------------------------------------*
*& Module MODIFY_DATA INPUT
*&---------------------------------------------------------------------*
MODULE MODIFY_DATA INPUT.
MODIFY IT_ZEKPO FROM WA_ZEKPO INDEX po_tb-currentline.
"this will insert a new line
"and will modify the contents of existing line
ENDMODULE. " MODIFY_DATA INPUT
*&---------------------------------------------------------------------*
*& Module SAVE_DATA INPUT
*&---------------------------------------------------------------------*
" when user presses SAVE button then all the records are
" modified into the z datanbase table
MODULE SAVE_DATA INPUT.
DATA : A LIKE SY-DBCNT.
OK_CODE = SY-UCOMM.
CASE OK_CODE.
WHEN 'SAVE'.
MODIFY ZEKPO FROM TABLE IT_ZEKPO. "update db table from internal table
A = SY-DBCNT.
IF SY-SUBRC = 0.
MESSAGE S008 WITH A. "success message with no of records modified
ENDIF.
ENDCASE.
ENDMODULE. " SAVE_DATA INPUT
Hope this solves your problem.
Thanks & Regards,
Tarun Gambhir
Edited by: Tarun Gambhir on Feb 11, 2009 2:14 PM
2009 Feb 11 8:05 AM
try to keep a break point and check if yuor internal table gets cleared on scrolling
2009 Feb 11 8:18 AM
2009 Feb 11 8:23 AM
ur internal table might be getting cleared. Please clear/refresh only after all d data is copied into the table control.
Remove clear statements after PAI module that is called on action scrolling.
Check if the maximum number of rows has been set/reset in the table control for display and increase that.
2009 Feb 11 8:21 AM
Hi,
In both PBO and PAI write the following code.
PBO.
LOOP AT <itab> INTO <wa> WITH CONTROL <TC>.
ENDLOOP.
PAI.
LOOP AT <itab>.
Endloop.
Best Regards,
Surendar Reddy.
2009 Feb 11 8:23 AM
Already i have wrote.
PROCESS BEFORE OUTPUT.
MODULE STATUS_9991.
MODULE TABLE_LINES_9991.
LOOP AT T_SCTI INTO W_SCTI WITH CONTROL TC1 CURSOR TC1-current_LINE .
ENDLOOP.
MODULE ACTION_BEFORE_OUTPUT_9991.
*
************************
PROCESS AFTER INPUT.
************************
MODULE EXIT_FROM_PROG AT EXIT-COMMAND.
LOOP.
MODULE GET_REMAINING_DATA_9991.
ENDLOOP.
MODULE MODIFY_DATABASE_9991.
MODULE ACTION_ON_SELECTION_KEY_9002.
********************************************************
Even internal table lines are less than table controle.
Edited by: Devalla T Kumar on Feb 11, 2009 9:24 AM
2009 Feb 11 8:35 AM
Hi,
LOOP AT T_SCTI INTO W_SCTI WITH CONTROL TC1 CURSOR TC1-current_LINE .
TC1-lines = TC1-lines + 1.
ENDLOOP.
PAI.
LOOP.
MODULE GET_REMAINING_DATA_9991.
MODULE UPDATE_ITAB.
ENDLOOP.
MODULE UPDATE_ITAB.
MODIFY itab FROM wa INDEX tc-current_line.
Or
APPEND wa TO itab.
ENDMODULE.
best regards,
Surendar Reddy.
Edited by: suredarreddy pulimamidi on Feb 11, 2009 2:09 PM
2009 Feb 11 8:42 AM
Hi,
DATA: h_line TYPE i.
SELECT iwerk revnr revtx revab INTO TABLE it_revision FROM t352r ORDER BY revnr ASCENDING.
DESCRIBE TABLE it_revision LINES h_line.
tab_clc-lines = h_line + 5.
Thanks
Arun
Edited by: Arun Kayal on Feb 11, 2009 9:42 AM
2009 Feb 11 8:44 AM
Hi,
What you need to do is to modify the internal table whenever user performs any action.
Use this code, its working:-
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...
At screen flow-logic
PROCESS BEFORE OUTPUT.
* MODULE status_8003.
LOOP WITH CONTROL po_tb.
MODULE read_data.
ENDLOOP.
PROCESS AFTER INPUT.
* MODULE user_command_8003.
LOOP WITH CONTROL po_tb.
MODULE modify_data.
ENDLOOP.
MODULE save_data.
In PBO
*&---------------------------------------------------------------------*
*& Module READ_DATA OUTPUT
*&---------------------------------------------------------------------*
MODULE read_data OUTPUT.
READ TABLE it_zekpo INTO wa_zekpo INDEX po_tb-current_line. "po_tab is table control name
data : line_count type i.
describe it_zekpo
lines line_count.
po_tb-lines = line_count + 10.
"to increase the number of lines in table control dynamically
ENDMODULE. " READ_DATA OUTPUT
In PAI
*&---------------------------------------------------------------------*
*& Module MODIFY_DATA INPUT
*&---------------------------------------------------------------------*
MODULE MODIFY_DATA INPUT.
MODIFY IT_ZEKPO FROM WA_ZEKPO INDEX po_tb-currentline.
"this will insert a new line
"and will modify the contents of existing line
ENDMODULE. " MODIFY_DATA INPUT
*&---------------------------------------------------------------------*
*& Module SAVE_DATA INPUT
*&---------------------------------------------------------------------*
" when user presses SAVE button then all the records are
" modified into the z datanbase table
MODULE SAVE_DATA INPUT.
DATA : A LIKE SY-DBCNT.
OK_CODE = SY-UCOMM.
CASE OK_CODE.
WHEN 'SAVE'.
MODIFY ZEKPO FROM TABLE IT_ZEKPO. "update db table from internal table
A = SY-DBCNT.
IF SY-SUBRC = 0.
MESSAGE S008 WITH A. "success message with no of records modified
ENDIF.
ENDCASE.
ENDMODULE. " SAVE_DATA INPUT
Hope this solves your problem.
Thanks & Regards,
Tarun Gambhir
Edited by: Tarun Gambhir on Feb 11, 2009 2:14 PM
2009 Feb 11 8:44 AM
Hi,
For module pool table control,
In your screen having table control's flow logic,
you have to write:
In PBO.
loop with control tabc(table control name).
module get_data.
endloop.
In PAI.
loop with control tabc.
module modify_itab.
endloop.
And in Get_data module,
READ TABLE ITAB(internal table name) INDEX TABC-CURRENT_LINE. "this will read the contents of your internal table into table control
And in modify_itab module,
MODIFY itab INDEX tabc-current_line. " this will modify your internal table if any operations are performed on the table control
Hope it helps.
Regrds
Mansi
2009 Feb 11 9:02 AM
Thanks to all for suggetion but my main prob is that suppose table size of 14 lines
and in my internal table have just 3 lines than while i am scrolling down than all table data disapiers
i cant undersant what happens.
2009 Feb 11 9:13 AM
Hi,
To dynamically increase the number of rows of table control in the table control screen's PBO event,
you can write:
DATA : LIN TYPE I.
DESCRIBE TABLE ITAB LINES LIN.
TABC-LINES = LIN + 5. "this will increase 5 lines whenever the control reaches the end row of table control
And about values getting dissappeared, with Read and Modify statements they should remain in the output screen.
Try a break point where this thing is happening.
Regrds
Mansi
2009 Apr 02 3:09 PM
2015 Jan 26 4:58 PM
Hi,
Just clear okcode or sy-ucomm as the entries may be resetting every time because of okcode,
2016 Mar 03 7:27 AM
Hi Tarun,
Use This code
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'PF_STATUS1'.
SET TITLEBAR 'TITLE'.
DESCRIBE TABLE it_tab.
TABLE1-LINES = SY-TFILL.
ENDMODULE.
These two lines will make your table scrollable-
DESCRIBE TABLE it_tab.
TABLE1-LINES = SY-TFILL.
And TABLE1 is table name which you define in the TOP Module like -
CONTROLS TABLE1 TYPE TABLEVIEW USING SCREEN 100.
I think it will help you.
It's woorking in my project .