‎2009 Aug 04 12:30 PM
I am creating table control for user input ....
When i fill 1 row and press enter all data vanishes ...
How to avoid this problem..
Thanks
Ashish
‎2009 Aug 04 3:41 PM
Hi Ashish,
You must have written a loop .. endloop statement in the PBO and PAI. In the PBO between loop and endloop you are reading the internal table that populates the table control. In between the loop and endloop in the PAI you will need to modify the internal table with entries that you make in the table control before you press enter. What is happening is that when you press enter the PBO is being called again and the loop .. endloop statement is executed and the internal table is read which does not have the modified values so it displays the same contents minus the entries that you made in the table control. Write the modify statement to modify the internal table from which your table control has data.
modify itab from wa index <tablecontrol>-current_line.
Hope this helps.
Regards,
Sachin
‎2009 Aug 04 12:41 PM
‎2009 Aug 04 2:10 PM
Hi Ashish,
you need to append to the internal table,see below example,
IF NOT x_assignment-employee_id IS INITIAL AND NOT x_assignment-activity IS INITIAL.
MODIFY t_assignment FROM x_assignment INDEX tablecontrol-current_line.
IF sy-subrc NE 0.
APPEND x_assignment TO t_assignment.
ENDIF.
ENDIF.
use this module inside the pai loop and endloop.
‎2009 Aug 04 2:17 PM
Hi,
The problem could be because, after the PAI is triggered once ENTER is pressed, the PBO of the screen is called (provided you havent given any CALL SCREEN or LEAVE TO SCREEN statements in the PAI).
Try to repopulate the screen elements with the data from the internal table in the PBO. That could be one of the reasons why you data vanishes once ENTER is pressed.
Please try to check the happenings in Debug mode. You will get a clearer picture.
Please check if your internal table is populated with data. Check if you have cleared the internal table somewhere in the PBO that restricts it from displaying the data on the screen.
‎2009 Aug 04 2:46 PM
Hi Ashish,
You need to append the value in Internal table in PAI and then PBO It loop the Internal table with the table control to display the record..
PROCESS BEFORE OUTPUT.
MODULE status_0103.
MODULE get_data.
MODULE tc_data1_change_tc_attr.
LOOP AT it_gl
INTO lw_gl
WITH CONTROL tc_data1
CURSOR tc_data1-current_line.
MODULE tc_data1_get_lines.
ENDLOOP.
MODULE clear.
PROCESS AFTER INPUT.
LOOP AT it_gl .
CHAIN.
FIELD lw_gl-umskz .
FIELD lw_gl-bschl.
FIELD lw_gl-saknr.
FIELD lw_gl-wrbtr.
FIELD lw_gl-gsber.
FIELD lw_gl-kostl.
MODULE tc_data1_modify.
ENDCHAIN.
ENDLOOP.
MODULE tc_data1_modify INPUT.
IF sy-ucomm = ' '.
read table it_gl into lw_gl1 with index tc_data-current_line.
if sy-subrc <> 0.
APPEND lw_gl TO it_gl.
ENDIF.
endif.
ENDMODULE.
‎2009 Aug 04 3:41 PM
Hi Ashish,
You must have written a loop .. endloop statement in the PBO and PAI. In the PBO between loop and endloop you are reading the internal table that populates the table control. In between the loop and endloop in the PAI you will need to modify the internal table with entries that you make in the table control before you press enter. What is happening is that when you press enter the PBO is being called again and the loop .. endloop statement is executed and the internal table is read which does not have the modified values so it displays the same contents minus the entries that you made in the table control. Write the modify statement to modify the internal table from which your table control has data.
modify itab from wa index <tablecontrol>-current_line.
Hope this helps.
Regards,
Sachin
‎2009 Aug 04 4:11 PM
Hi Ashish,
<li>Flow logic of the screen
<li>Write code for MODULE read_table_control.
PROCESS BEFORE OUTPUT.
MODULE status_0100.
LOOP AT itab INTO demo_conn WITH CONTROL flights."Flights -Table control name
ENDLOOP.
PROCESS AFTER INPUT.
MODULE cancel AT EXIT-COMMAND.
LOOP AT itab.
MODULE read_table_control.
ENDLOOP.
MODULE user_command_0100.
Thanks
Venkat.O
MODULE read_table_control INPUT.
MODIFY itab FROM demo_conn INDEX flights-current_line. "Flights -Table control name
"The above statement keeps the record on table control. It does not vanish data.
ENDMODULE.
‎2009 Aug 04 8:38 PM
Hi,
You need to modify your internal table in PAI at every action you perform.
Refer:-
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.
ENDLOOP.
PROCESS AFTER INPUT.
* MODULE user_command_8003.
LOOP WITH CONTROL po_tab.
MODULE modify_data.
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
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
Hope this helps you.
Regards,
Tarun
‎2009 Aug 05 7:46 AM
Hi,
Ashish Bhide
Two flow logic events are important , PBO and PAI.
In PBO event data from the program move to the screen
In this event you must have written code to place a data from internal table.
In PAI event data from the screen moves to the program.
In this event data from table control will move to program
you have to save the data into the internal table .
Again PBO runs so it takes the data from the internal table and display in screen.
if you have not saved the values entered in table control in PAI , no data in internal table
so it disappears.
when you press enter this what happen
‎2009 Aug 06 4:19 AM
Hi Ashish,
When you enter a value in the table control it has to transferred to the itab in the program
in PAI
loop at itab.
module modify_tab.
endloop.
in Module
module modify_tab.
describe table itab lines tc-lines. -
> This gives the number of rows in the itab
if tc-lines <= tc-current_line.
modify itab index tc-current_line. -->if already row exists it modifies the row
else.
append itab.----> if row is not there at row position in the table control it appends
endmodule.
Regards
Ramchander Rao.K
‎2009 Aug 06 6:11 AM
Hi Ashish,
The only reason for it is that
in PBO you have to put loop on the internal table and transfer the data to the respective fields in table control.
in PAI you have to again put a loop and transfer the data from respective fields of table control to Internal table fields.
and in your case you are doing in reverse order or your internal table and fields in table control are not same.
Plz check and confirm. if you need it's coding too then tell me, I will send it
‎2010 Feb 12 10:15 AM