‎2007 Mar 06 8:58 AM
Hi folks,
i am doing a module pool where my internal table (itab) data is comming to table ontrol(ctrl).then i need to select one record in table control & then i press REFRESH push button.
after putting the refresh button, some new records are comming to that same internal table.then i need to display the modified internal table (some new records are added) data in the table control.
The modified internal table data is comming to the table control but to the last of table control, some records are repeating.
before comming to table control, i checked the modified itab. it contains correct data.i.e it contains 15 records.(previously i have 5 records.after REFRESH button 10 more records are added.). but when this table is comming to table control, it contains some 100 record.i should get only 15 record.
why these records r repeting. how to delete the duplicate records from table control?
plz suggest me where i am doing mistake.
correct answer will be rewarded
Thanks & Regards
‎2007 Mar 06 9:03 AM
in PBO
DELETE ADJACENT DUPLICATES FROM ITAB COMPARING ALL FIELDS.
and also REFRESH ur internal table before populating the data to that
‎2007 Mar 06 9:03 AM
in PBO
DELETE ADJACENT DUPLICATES FROM ITAB COMPARING ALL FIELDS.
and also REFRESH ur internal table before populating the data to that
‎2007 Mar 06 9:03 AM
Hi,
It seems that the Internal Table is not getting refreshed properly.
After displaying the records first refresh the int table. so that next time only fresh records will come into it and displayed.
Regards,
Anji
‎2007 Mar 06 9:15 AM
Hi Pabitra,
I think you have not refresh your internal table as a result the data is ambigous.
In PAI----
Refresh your internal table.
I guess this is the actual problem
************Reward point if helpful----
‎2007 Mar 06 10:39 AM
Hi ,
Thanks for ur help. but i should not refresh the internal table as some records r already present.after putting the REFRESH button, some new records r appending to this existing table.then i am going to display the previous records & the new records as well.
i checked the internal table after modification.it contains actual number of records. but after comming to table control , more records r comming.
is this the problem with scrolling or waht?
plz suggest where i am doing mistake.i am giving my coding below.
PROCESS BEFORE OUTPUT.
MODULE STATUS_0200.
module tc_shelf_change_tc_attr.
loop at object_tab1
with control tablctrl
cursor tablctrl-current_line.
module tc_shelf_get_lines.
endloop.
PROCESS AFTER INPUT.
module set_exit AT EXIT-COMMAND.
loop at object_tab1.
chain.
field: object_tab1-prueflos,
object_tab1-matnr.
module shelf_modify on chain-request.
endchain.
field object_tab1-idx
module shelf_mark on request.
endloop.
module shelf_user_command.
module user_command_0200.
----
***INCLUDE Y_RQEEAL10_STATUS_0200O01 .
----
&----
*& Module STATUS_0200 OUTPUT
&----
text
----
MODULE STATUS_0200 OUTPUT.
SET PF-STATUS 'MAIN'.
SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0200 OUTPUT
&----
*& Module tc_shelf_change_tc_attr OUTPUT
&----
text
----
MODULE tc_shelf_change_tc_attr OUTPUT.
delete adjacent duplicates from object_tab1 comparing prueflos matnr.
describe table object_tab1 lines tablctrl-lines.
ENDMODULE. " tc_shelf_change_tc_attr OUTPUT
&----
*& Module tc_shelf_get_lines OUTPUT
&----
text
----
MODULE tc_shelf_get_lines OUTPUT.
data: g_tc_shelf_lines like sy-loopc.
if tablctrl-current_line > tablctrl-lines.
stop.
endif.
g_tc_tablctrl_lines = sy-loopc.
*refresh control tablctrl from screen 0200.
ENDMODULE. " tc_shelf_get_lines OUTPUT
***INCLUDE Y_RQEEAL10_SHELF_MODIFYI01 .
----
&----
*& Module shelf_modify INPUT
&----
text
----
MODULE shelf_modify INPUT.
modify object_tab1
index tablctrl-current_line.
ENDMODULE. " shelf_modify INPUT
&----
*& Module set_exit INPUT
&----
text
----
module set_exit INPUT.
leave program.
endmodule. " set_exit INPUT
&----
*& Module shelf_mark INPUT
&----
text
----
MODULE shelf_mark INPUT.
data: g_shelf_wa2 like line of object_tab1.
if tablctrl-line_sel_mode = 1
and object_tab1-idx = 'X'.
loop at object_tab1 into g_shelf_wa2
where idx = 'X'.
g_shelf_wa2-idx = ''.
modify object_tab1
from g_shelf_wa2
transporting idx.
endloop.
endif.
modify object_tab1
index tablctrl-current_line
transporting idx plnty plnnr plnal.
ENDMODULE. " shelf_mark INPUT
&----
*& Module shelf_user_command INPUT
&----
text
----
MODULE shelf_user_command INPUT.
ok_code = sy-ucomm.
perform user_ok_tc using 'TABLCTRL'
'OBJECT_TAB1'
changing ok_code.
sy-ucomm = ok_code.
ENDMODULE. " shelf_user_command INPUT
&----
*& Module user_command_0100 INPUT
&----
text
----
MODULE user_command_0200 INPUT.
data:v_line(3).
case OK_CODE.
when 'LAST'.
read table object_tab1 with key idx = 'X'.
if sy-subrc = 0.
select * from qals
where enstehdat <= object_tab1-enstehdat
and plnty ne space
and plnnr ne space
and plnal ne space.
if sy-dbcnt > 0.
if qals-enstehdat = object_tab1-enstehdat.
check qals-entstezeit < object_tab1-entstezeit.
move-corresponding qals to object_tab2.
append object_tab2.
else.
move-corresponding qals to object_tab2.
append object_tab2.
endif.
endif.
endselect.
sort object_tab2 by enstehdat entstezeit descending.
loop at object_tab2 to 25.
if not object_tab2-prueflos is initial.
append object_tab2 to object_tab1.
endif.
clear object_tab2.
endloop.
endif.
when 'SAVE'.
loop at object_tab1 where idx = 'X'.
if ( not object_tab1-plnty is initial and
not object_tab1-plnnr is initial and
not object_tab1-plnal is initial ).
select single * from qals into corresponding fields of wa_qals
where prueflos = object_tab1-prueflos.
if sy-subrc = 0.
wa_qals-plnty = object_tab1-plnty.
wa_qals-plnnr = object_tab1-plnnr.
wa_qals-plnal = object_tab1-plnal.
update qals from wa_qals.
if sy-subrc <> 0.
Message E001 with 'plan is not assigned to lot in sap(updation)'.
else.
v_line = tablctrl-current_line - ( tablctrl-current_line - 1 ).
delete object_tab1.
endif.
endif.
endif.
endloop.
when 'BACK'.
leave program.
when 'NEXT'.
call screen 300.
ENDCASE.
----
***INCLUDE Y_RQEEAL10_USER_OK_TCF01 .
----
&----
*& Form user_ok_tc
&----
text
----
-->P_0078 text
-->P_0079 text
<--P_OK_CODE text
----
form user_ok_tc using p_tc_name type dynfnam
p_table_name
changing p_ok_code like sy-ucomm.
data: l_ok type sy-ucomm,
l_offset type i.
search p_ok_code for p_tc_name.
if sy-subrc <> 0.
exit.
endif.
l_offset = strlen( p_tc_name ) + 1.
l_ok = p_ok_code+l_offset.
case l_ok.
when 'P--' or "top of list
'P-' or "previous page
'P+' or "next page
'P++'. "bottom of list
perform compute_scrolling_in_tc using p_tc_name
l_ok.
clear p_ok_code.
endcase.
endform. " user_ok_tc
&----
*& Form compute_scrolling_in_tc
&----
text
----
-->P_P_TC_NAME text
-->P_L_OK text
----
form compute_scrolling_in_tc using p_tc_name
p_ok_code.
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.
assign (p_tc_name) to <tc>.
concatenate 'G_' p_tc_name '_LINES' into l_tc_lines_name.
assign (l_tc_lines_name) to <lines>.
if <tc>-lines = 0.
l_tc_new_top_line = 1.
else.
call function 'SCROLLING_IN_TABLE'
exporting
entry_act = <tc>-top_line
entry_from = 1
entry_to = <tc>-lines
last_page_full = 'X'
loops = <lines>
ok_code = p_ok_code
overlapping = 'X'
importing
entry_new = l_tc_new_top_line
exceptions
others = 0.
endif.
get cursor field l_tc_field_name
area l_tc_name.
if syst-subrc = 0.
if l_tc_name = p_tc_name.
set cursor field l_tc_field_name line 1.
endif.
endif.
<tc>-top_line = l_tc_new_top_line.
endform. " COMPUTE_SCROLLING_IN_TC
Thanks
‎2007 Mar 06 12:41 PM
Object_tab1 is the table which you are using for displaying into table control right?
When exactly are you checking the number of records into object_tab1?
‎2007 Mar 06 1:19 PM
Hi sweta,
Thanks very much.u r right.i am checking the number of records in object_tab, in PBO before populating into table control.here i am getting correct number of records.but after passing this table to table control in PBO, i am getting more records(duplicate) in the table control on the screen.
is there any way to delete duplicate records from the screen(table control).
in pbo, i am putting sy-loopc inside the loop .i am getting sy-loopc = 13 always.
i think sy-loopc should change for every loop pass.
after refreshing internal table also, i am getting same result.
plz suggest where i am doing mistake.
Thanks& regards
‎2007 Mar 06 12:21 PM
Hi Pabitra,
U need to first refresh ur internal table every time the data is eneterd into ur ITAB., i.e after ur population of ITAB add :
REFRESH ITAB.
And also if this does not resolve ur issue try this
In the PBO part of the program , add the following code :
DELETE ADJACENT DUPLICATES FROM ITAB COMPARING ALL FIELDS.
OR
DELETE ADJACENT DUPLICATES FROM ITAB COMPARING F1 F2.
Hope this resolves ur issue. Reward if helpful and also close this thread if problem is solved.
Regards