Duplicate Entries in Internal Tables
Hallo Friends,
It Would be nice if some one let me know, if there is a way in ABAP to select the duplicates records in an internal tables.
Lets say I have two internal tabels, itabA have following structure:
BNAME | WORKAREA | ROLES
abc | wa1 | ro1
cde | wa1 | ro1
cde | wa3 | rol..
abc | wa2 | rol2
xyz | wa1 | rol3
xyz | wa3 | rol2..
the itabB have the following structure:
WORKAREA | ROLES|
wa1 | rol1
wa2 | rol1
wa3 | rol1
wa4 | rol1
Now problem is, I need to select the common WorkAreas from itabA ( which is commom in all BNAME ) in above example it will be workarea wa1. as it is commom in all i.e ( abc ,cde and xyz). I need to select this commom workarea, and then mark it with some flage in itabB ( to display that this workarea is common among the users...)
Would be nice if some one let me know, is there any way I can select the duplicate rows in an internal table or I have to go one by one and then do some kind of comparision.
Many thanks,
Thx in advance....
Haider
Hi marek,
below information might help you.
The first criterion for comparing internal tables is the number of lines they contain. The more lines an internal table contains, the larger it is. If two internal tables contain the same number of lines, they are compared line by line, component by component. If components of the table lines are themselves internal tables, they are compared recursively. If you are testing internal tables for anything other than equality, the comparison stops when it reaches the first pair of components that are unequal, and returns the corresponding result.
DATA: BEGIN OF LINE,
COL1 TYPE I,
COL2 TYPE I,
END OF LINE.
DATA: ITAB LIKE TABLE OF LINE,
JTAB LIKE TABLE OF LINE.
DO 3 TIMES.
LINE-COL1 = SY-INDEX.
LINE-COL2 = SY-INDEX ** 2.
APPEND LINE TO ITAB.
ENDDO.
MOVE ITAB TO JTAB.
LINE-COL1 = 10. LINE-COL2 = 20.
APPEND LINE TO ITAB.
IF ITAB GT JTAB.
WRITE / 'ITAB GT JTAB'.
ENDIF.
APPEND LINE TO JTAB.
IF ITAB EQ JTAB.
WRITE / 'ITAB EQ JTAB'.
ENDIF.
LINE-COL1 = 30. LINE-COL2 = 80.
APPEND LINE TO ITAB.
IF JTAB LE ITAB.
WRITE / 'JTAB LE ITAB'.
ENDIF.
LINE-COL1 = 50. LINE-COL2 = 60.
APPEND LINE TO JTAB.
IF ITAB NE JTAB.
WRITE / 'ITAB NE JTAB'.
ENDIF.
IF ITAB LT JTAB.
WRITE / 'ITAB LT JTAB'.
ENDIF.
The output is:
ITAB GT JTAB
ITAB EQ JTAB
JTAB LE ITAB
ITAB NE JTAB
ITAB LT JTAB
This example creates two standard tables, ITAB and JTAB. ITAB is filled with 3 lines and copied to JTAB. Then, another line is appended to ITAB and the first logical expression tests whether ITAB is greater than JTAB. After appending the same line to JTAB, the second logical expression tests whether both tables are equal. Then, another line is appended to ITAB and the third logical expressions tests whether JTAB is less than or equal to ITAB. Next, another line is appended to JTAB. Its contents are unequal to the contents of the last line of ITAB. The next logical expressions test whether ITAB is not equal to JTAB. The first table field whose contents are different in ITAB and JTAB is COL1 in the last line of the table: 30 in ITAB and 50 in JTAB. Therefore, in the last logical expression, ITAB is less than JTAB.
reward with points and close the thread if your question is solved
regards,
venu.
Similar Messages
-
How to check duplicate entries in internal table??
Dear Friends,
How to check duplicate entries in internal table??
Exp: In my internal table if I am having the same records more then ones then I need to print the error message, here I am using steploop for selecting the values from screen, and the values are coming into my internal table if user enter the same value more then ones I need to print the error message.
Thanks,
SridharHi,
After storing the data into internal table say ITAb, move the data into another internal table.
t_dup[] = itab[].
LOOP AT itab.
count1 = count1 + 1.
itab-count1 = count1.
MODIFY itab.
ENDLOOP.
LOOP AT t_dup.
count2 = count2 + 1.
t_dup-count2 = count2.
MODIFY t_dup.
ENDLOOP.
DELETE ADJACENT DUPLICATES FROM itab.
LOOP AT t_dup.
record_dup = 'N'.
READ TABLE itab WITH KEY count1 = t_dup-count2.
IF sy-subrc = 0.
record_dup = 'Y'.
ENDIF.
IF record_dup NE 'Y'.
t_dup-message = 'DUPLICATE ENTRY'.
t_dup-flag = 1.
MODIFY t_dup.
ENDIF.
ENDLOOP.
Use this sample code.
Reward pts if it is helpfull.
Regards
Srimanta -
Duplicate Entries in Internal table
Hi All,
As per my requirement
1. The internal table is the input.
2. I need the duplicate records of the internal table with the combination of 2 key fields.
3. I should not use SORT because i need the index number in order as per in the table .
EX : Take Table MSEG.
Take key fields as MBLNR and WERKS.
I want the duplicate records of the combination of these 2 key fields.
The *Index Number * should not to be changed as per the table entry. ( So i avoided sorting the internal table)
Kindly give some solutions.
Thanks,
Pradeep.
Moderator message : Duplicate post locked,follow forum Rules of Engagement. Thread locked.
Edited by: Vinod Kumar on Mar 1, 2012 4:59 PMHi Pradeep,
Try this...
first you copy your internal table to another temporary table of same type.
itab_temp[] = itab[].
sort itab_temp[].
DELETE ADJACENT DUPLICATES FROM ITAB COMPARING MBLNR WERKS.
LOOP AT ITAB_TEMP INTO WA_ITAB1.
DO.
READ TABLE ITAB INTO WA_ITAB2 WITH KEY MBLNR = WA_ITAB1-MBLNR AND WERKS = WA_ITAB1-WERKS.
IF SY-SUBRC EQ 0.
APPEND WA_ITAB2 TO ITAB_NEW.
ELSE.
EXIT.
ENDIF.
ENDDO.
ENDLOOP.
you may get the duplicate records in itab_new. -
Deleting entry from internal table
Hi Experts,
i have the following internal table:
data : it_result1 TYPE crmt_object_guid_tab
and work area
data : wa_result1 type crmt_object_guid.
i have to delete a guid from internal table based on some condition.
loop at it_resul1 into wa_result1
if lv_priority eq priority.
delete this entry from internal table.
endif.
endloop..
i tried using delete table it_result with table key CRMT_OBJECT_GUID = wa_result. but this is giving syntax error.
what should be done to delete the entry?
Thanks and regards
ShilpiHi
Check Syntax for DELETE operator on pressing F1
1. DELETE itab.
2. DELETE TABLE itab WITH TABLE KEY k1 = v1 ... kn = vn.
3. DELETE TABLE itab [FROM wa].
4. DELETE itab INDEX idx.
5. DELETE itab FROM idx1 TO idx2.
6. DELETE itab WHERE logexp.
7. DELETE ADJACENT DUPLICATES FROM itab.
delete table it_result with table key CRMT_OBJECT_GUID = wa_result
this is wrong
delete it_result where CRMT_OBJECT_GUID = wa_result
Edited by: Lavanya K on Apr 22, 2009 10:20 AM -
Short dumop in J2I5 (provide duplicate entry in Standard table)
Hello Expert ,
We have a problem in T.Code J2I5 ( Excise Register Extraction) input entry is lelect Excise group 20 . and a date from 04.08.09 onwards. and select the register RG23D . it shows the run time error ( Eg The ABAP/4 Open SQL array insert results in duplicate database record ) . but in the standard Tcode is there possible to provide duplicate entry in Standard table
Thaks & regards
Aditya Kr TripathiRuntime Errors SAPSQL_ARRAY_INSERT_DUPREC
Except. CX_SY_OPEN_SQL_DB
Date and Time 29.01.2010 10:57:09
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
problem occurs in this code :
assign I_RG23D_TAB-I_RG23D_TYP to <x_rg23dtyp> casting.
<x_extrctdata> = <x_rg23dtyp>.
class CL_ABAP_CONTAINER_UTILITIES definition load.
call method CL_ABAP_CONTAINER_UTILITIES=>FILL_CONTAINER_C
EXPORTING
IM_VALUE = i_rg23d_tab-i_rg23d_typ
IMPORTING
EX_CONTAINER = i_report_tab-extrctdata
EXCEPTIONS
ILLEGAL_PARAMETER_TYPE = 1
others = 2.
I_REPORT_TAB-EXTRCTDATA = I_RG23D_TAB-I_RG23D_TYP.
COMPUTE I_REPORT_TAB-EXTRCTLNGT = STRLEN( I_REPORT_TAB-EXTRCTDATA ).
APPEND I_REPORT_TAB.
ENDLOOP.
IF M_EXTRACTED = 'X'.
LOOP AT I_RG23D_KEY.
DELETE
FROM J_2IEXTRCT
WHERE BUDAT = I_RG23D_KEY-BUDAT
AND SERIALNO = I_RG23D_KEY-SERIALNO
AND REGISTER = I_RG23D_KEY-REGISTER
AND EXGRP = I_RG23D_KEY-EXGRP.
ENDLOOP.
ENDIF.
Control table check here for data Extraction
INSERT J_2IEXTRCT FROM TABLE I_REPORT_TAB.
If the insertion of the extract table is successfull then the table
for Extraction is Inserted
IF SY-SUBRC EQ 0.
PERFORM FILL_EXTDT USING C_RG23D M_EXTRACTED.
ENDIF.
ENDFORM. " RG23D
*& Form RG23CPART1
Purpose : RG23C Part I extraction logic
FORM RG23CPART1.
DATA: $PART1 TYPE PART1_TYP,
$LINCNT LIKE SY-LINCT,
M_EXTRACTED VALUE '',
$RC LIKE SY-SUBRC.
*********************************************************************************************8 -
Removing duplicates in the Internal Table
Dear friends,
Could any one of you kindly help me with a code to delete the duplicates in the internal table, but each duplicate should be counted, how many times that appeared and should be displayed again as a report with the messages and no of times that message appeared.
Thank you,
Best Regards,
subramanyeshwerYou can try something like this.
report zrich_0001.
data: begin of itab1 occurs 0,
fld1 type c,
fld2 type c,
fld3 type c,
end of itab1.
data: begin of itab2 occurs 0,
fld1 type c,
fld2 type c,
fld3 type c,
end of itab2.
data: counter type i.
itab1 = 'ABC'. append itab1.
itab1 = 'DEF'. append itab1.
itab1 = 'GHI'. append itab1.
itab1 = 'DEF'. append itab1.
itab1 = 'GHI'. append itab1.
itab1 = 'DEF'. append itab1.
itab2[] = itab1[].
sort itab1 ascending.
delete adjacent duplicates from itab1.
loop at itab1.
clear counter.
loop at itab2 where fld1 = itab1-fld1
and fld2 = itab1-fld2
and fld3 = itab1-fld3.
counter = counter + 1.
endloop.
write:/ itab1-fld1, itab1-fld2, itab1-fld3,
'Number of occurances:', counter.
endloop.
Regards,
Rich Heilman -
Middleware Settings - Duplicate entries in the Table TCURC
Hi Experts,
I am doing middleware settings for integrating SAP CRM 5.0 with SAP R/3 4.7.
Before replicating the customizing objects, i found duplicate entries for ISO Codes in the table TCURC (Field name-ISOCD).
Following are those entries
MANDT WAERS ISOCD ALTWR GDATU XPRIMARY LTEXT KTEXT
949 CFP XPF 953 00.00.0000 French Franc (Pacific Islands) Fr. Frank (Pac)
949 CNY CNY 156 00.00.0000 X Chinese Renminbi Renminbi
949 DEM DEM 280 00.00.0000 X German Mark German Mark
949 DEM3 DEM 280 00.00.0000 (Internal) German Mark (3 dec.places) (Int.) DEM 3 DP
949 RMB CNY 156 00.00.0000 Chinese Yuan Renminbi Yuan Renminbi
949 USD USD 840 00.00.0000 X United States Dollar US Dollar
949 USDN USD 840 00.00.0000 (Internal) United States Dollar (5 Dec.) US Dollar
949 XPF XPF 953 00.00.0000 X CFP Franc Franc
Duplicate entries are in the third column.
Please kindly let me know what is the impact and what should i do now.
Points will be rewarded for the helpful answers.
Thanks in advance
Nadh.RHi Murali,
Thanks for your reply.
But i didnt find anything related to the issue in that note.
Do you have any other solution.
Thanks
Nadh. -
Hi everyone
I am a little confused by a situtation I have come across in one of our bespoke tables. I was under the impression that all fields in a table that are marked as Key form a Primary Key and therefore it is <b>impossible</b> to create records where these key fields contain duplciate data. However, I have found a bespoke table that is used for logging exception messages that appears to hold records with duplicates in the Key fields. Has anyone else come across this or have any idea how it might be happening? When creating a table is possible to specify a non-unique key in the same way you might for an internal table?! If it is relevant, the table is updated from a program that locks and unlocks the table before and afer the insert takes place and can be caused by both batch and manual changes.
Thanks
AndyThanks Roopesh
I understood the [ACCEPTING DUPLICATE KEYS] flag to mean that a a 'bulk' insert would not fail if a duplicate entry was identified but instead would set subrc to 4, skip the record in question and continue with subsequent records. If this is the case it still should not actually create duplciate entries - surely in doing so referential integrity is being violated...
Here is the section of code that performs the insert if that helps at all:
*lock table and insert processing log details
CALL FUNCTION 'ENQUEUE_EZLG_T024E'
EXPORTING
MODE_ZLG_T024 = 'E'
MANDT = SY-MANDT
EMPLOYER_REG_NO = zlg_t024-EMPLOYER_REG_NO
GRANT_CLAIM_NO = zlg_t024-GRANT_CLAIM_NO
ITEM = zlg_t024-ITEM
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
insert zlg_t024.
* unlock table.
CALL FUNCTION 'DEQUEUE_EZLG_T024E'
EXPORTING
MODE_ZLG_T024 = 'E'
MANDT = SY-MANDT
EMPLOYER_REG_NO = zlg_t024-EMPLOYER_REG_NO
GRANT_CLAIM_NO = zlg_t024-GRANT_CLAIM_NO
ITEM = zlg_t024-ITEM
Kind regards
Andy -
Deleting Duplicate entries from Internal tbale
Hi All,
I have used this code to delete duplicate entries from an internal table.
DELETE ADJACENT DUPLICATES FROM IT_KOSTL COMPARING KOSTL hours.
After this statment, still the internal table will remain with a duplicate row.
Earlier table content before the delete statement:
Lno KOSTL PRCTR hours hours1
1 2081010205 0000208101 5525.000 1574.500
2 2081010105 0000208101 105162.000 73854.750
3 2081010105 0000208101 105162.000 73854.750
4 2081010205 0000208101 5525.000 1574.500
The Table gets modified after execution of DELETE statement as follows.
Lno KOSTL PRCTR hours hours1
1 2081010205 0000208101 5525.000 1574.500
2 2081010105 0000208101 105162.000 73854.750
3 2081010205 0000208101 5525.000 1574.500
Why the line 3 is still present in the table?
I hope as per that syntax, this line too should get delete.... Is it right?
Basically i would like to delete both line 3 and line 4 from....
How to resolve this issue?
Please help me out....
Regards
Pavan
What might be the reason?>
Pavan Sanganal wrote:
> DELETE ADJACENT DUPLICATES FROM IT_KOSTL COMPARING KOSTL hours.
> Why the line 3 is still present in the table?
>
> I hope as per that syntax, this line too should get delete.... Is it right?
>
Let me answer you all doubts.
Why the line 3 is still present in the table?
Actually it's not 3rd line, it's 2nd line.3rd line were deleted.
when delete adjecent duplicates trigger than it would delete lower line(3rd in your case) not upper line.
I hope as per that syntax, this line too should get delete.... Is it right?
NO. -
Duplicate records in Internal table
Hi All,
I want to find out the duplicate entry in the internal table. I have used,
Delete Adjacent duplicates from itab.
It is straight away deleting the record.
I want the user to correct that duplicate record.
May be some error message.
I have tried, with read,
Read table itab with key bzirk = itab-bzirk vkorg = itab-vkorg kunnr = itab-kunnr
matnr = itab-matnr comparing bzirk vkorg kunnr matnr.
But it's giving sy-subrc = 0 for the first record also.
Even, I have tried like, but it's giving syntax error.
Loop at itab where bzirk = itab-bzirk vkorg = itab-vkorg kunnr = itab-kunnr
matnr = itab-matnr.
Endloop.
Any method in case on Table control entries.
Thanks & Regards,
Kalyan Chandramouli
SAP ConsultantHi,
Create a new internal table and assign the all the records of itab1 to itab2.
1.Sort Itab2.
2.delete adjacent duplicates.
3. loop at itab2.
loop at itab1 where <conditon you want....>
count = count + 1.
endloop.
if count GT 1.
append the iatb2 records for user correction....
endif.
endloop.
If the hint is useful Say thanks by reward .
Regards,
Prabhu Rajesh -
Sample code to find duplicated entries in internal table and mark them?
We have one internal table called itab1 which contains the following fields:
f1 (key field)
f2 (non-key field)
f3 (non-key field)
The business scenario is f1, f2, and f3 are one to one relationship to each other, or in other word, f2 or f3 can't be duplicated with the the same values for different f1 (key field) records. We will move the check result of the duplication into another internal table itab2 which contains f1, f2, f3, f4, and f5 where f1, f2, and f3 are the same ones as in itab1, f4 will get the value "Yes" to mark duplicated for f2 (or "No" to mark non-duplicated), and f5 will get the value "Yes" to mark duplicated for f3 (or "No" to mark non-duplicated).
We know that through the loop of itab1, the above logic can be done to fill in f4 and f5 value for each row with either "Yes" or "No".
Just give an example of how itab2 will look like after the coding:
f1----f2--f3--f4(f2 duplicated?)---f5(f3 duplicated?)
A----01-X0YesNo--
B----01-X1YesYes--
C----02-X1NoYes--
Could any ABAP expert here show us the sample code to generate itab2 in loop of itab1 to find the duplicated entries of f2 and f3 and then populated the corresponding row values for f4 and f5 with "Yes" or "No"? We will give you reward points!TYPES: BEGIN OF ty_1,
f1,
f2(2),
f3(2),
f4,
f5,
END OF ty_1.
TYPES: BEGIN OF ty_2,
type(2),
value(2),
END OF ty_2.
DATA: itab1 TYPE STANDARD TABLE OF ty_1 WITH HEADER LINE,
itab2 TYPE TABLE OF ty_2 WITH HEADER LINE.
DATA: f2_c TYPE sy-tabix VALUE 0,
f3_c TYPE sy-tabix VALUE 0,
curr_f2 LIKE itab1-f2,
curr_f3 LIKE itab1-f3.
itab1-f1 = 'A'.
itab1-f2 = '01'.
itab1-f3 = 'X0'.
APPEND itab1.
itab1-f1 = 'B'.
itab1-f2 = '01'.
itab1-f3 = 'X1'.
APPEND itab1.
itab1-f1 = 'C'.
itab1-f2 = '02'.
itab1-f3 = 'X1'.
APPEND itab1.
SORT itab1 BY f1 f2 f3 AS TEXT.
LOOP AT itab1.
IF sy-tabix EQ 1.
curr_f2 = itab1-f2.
curr_f3 = itab1-f3.
ENDIF.
IF itab1-f2 NE curr_f2.
f2_c = 0.
curr_f2 = itab1-f2.
ENDIF.
IF itab1-f3 NE curr_f3.
f3_c = 0.
curr_f3 = itab1-f3.
ENDIF.
f2_c = f2_c + 1.
f3_c = f3_c + 1.
IF f2_c > 1.
itab1-f4 = 'X'.
MODIFY itab1.
itab2-type = 'f2'.
itab2-value = itab1-f2.
APPEND itab2.
ENDIF.
IF f3_c > 1.
itab1-f5 = 'X'.
MODIFY itab1.
itab2-type = 'f3'.
itab2-value = itab1-f3.
APPEND itab2.
ENDIF.
ENDLOOP.
DELETE ADJACENT DUPLICATES FROM itab2.
LOOP AT itab2.
IF itab2-type = 'f2'.
LOOP AT itab1 WHERE f2 = itab2-value AND f4 NE 'X'.
itab1-f4 = 'X'.
MODIFY itab1.
ENDLOOP.
ELSE.
LOOP AT itab1 WHERE f3 = itab2-value AND f5 NE 'X'.
itab1-f5 = 'X'.
MODIFY itab1.
ENDLOOP.
ENDIF.
ENDLOOP.
Edited by: Ramiro Escamilla on Apr 5, 2008 1:45 AM
changed the code, now should work -
Regarding Delete duplicates adjacent in internal table
hey
In my report i tried to delete the adjacent datas as
below from table itab_rbusa.but it is not deleting. why
code------
append lines of itab_glt0[] to itab_rbusa.
delete adjacent duplicates from itab_rbusa comparing all fields.
endof code----
if internal table has below values
011F
316A
789B
789B
131B
132B
302B
i get the same values as output after using the delete statement why?(789B-Business Area is not deleting)
could you please guide me.
ambichan.Hi,
You can use the addition FOR ALL ENTRIES rather than issuing SELECT in a loop. Try something like:
SELECT [DISTINCT] rbusa
FROM glt0
INTO TABLE itab_glt0
FOR ALL ENTRIES IN TABLE itab_t001
WHERE bukrs EQ itab_t001-bukrs
AND <other fields>...
APPEND LINES OF itab_t001[] TO itab_rbusa....
If DISTINCT does not serve the purpose, then you will need:
SORT itab_rbusa.
DELETE ADJACENT DUPLICATES FROM...
Regards
Message was edited by: Shehryar Khan -
Checking the entries in internal table with Ztable
Hi ,
Please go through the below requirement and please give me the code.
I am having an internal table ITAB with 5 entries and also having a Ztable with 10 entries. I should check weather any of the entry in the internal table ITAB is present in the Ztable or not?
Please give me the code
Thanks in advance,
AjaySelect f1 f2 f3 from ztable into itab1 "say ur ztab entries
*now say ur itab contents are in itab2.
sort itab2 by f1 " set the primary key in both .
delete adjacent duplicates from itab2 comparing f1.
Loop at itab2.
read table itab1 with key f1 = itab2-f1.
if sy-subrc eq 0 .
write:/ 'Entry exists '.
endif.
endloop.
On every sy-subrc hit i.e eq 0 write statement tells u a hit and no of times = number of the entries.
Vijay. -
How to delete the entries in internal table
Hi Experts,
I have 2 internal tables ,
if i find any same entries of 2 internal tables, i have to delete that entries in first internal table.
Regards,
Srinivasuhi check this..
report .
data:begin of itab occurs 0,
f1 type c ,
f2 type i,
end of itab .
data:begin of itab1 occurs 0,
f1 type c ,
end of itab1 .
itab-f1 = 'A'.
itab-f2 = 12.
append itab .
itab-f1 = 'b'.
itab-f2 = 12.
append itab .
itab-f1 = 'c'.
itab-f2 = 12.
append itab .
itab1-f1 = 'A'.
append itab1 .
loop at itab1 .
read table itab with key f1 = itab1-f1 .
if sy-subrc = 0.
delete itab where f1 = itab1-f1 .
endif .
endloop.
loop at itab.
write:/ itab-f1,itab-f2.
endloop. -
Problem in deleting entries from internal table
i am selecting
vrgar
perio
paobjnr
belnr
gjahr
perde
budat
kndnr
artnr
frwae
kursf
rec_waers
kaufn
kdpos
bukrs
kokrs
werks
gsber
vkorg
vtweg
spart
rbeln
rposn
prctr
pprctr
kunnr
land1
regio
kunwe
kvgr1
wwpmg
zterm
wwcst
wwrst
mvgr3
wwseg
wwcls
wwesa
prdha
wwbun
wwexd
wwph1
wwph2
wwph3
wwph4
prat1
prat2
vrprs
vv510
vv508
vv509
vvqt2
vv515
INTO TABLE ct_ce11000 FROM ce11000
WHERE paledger EQ gv_ledbo AND
vrgar EQ lc_vrgar AND
belnr GT uv_belnr AND
gjahr EQ pa_gjahr AND
perde EQ pa_perd AND
bukrs EQ pa_bukrs.
now i awant to delete all those entries from my internal table ct_ce11000 where my plant (WEKRS) and company code (BUKRS)
i am writting
loop at ct_ce11000 into wa_ce11000.
if wa_ce11000-werks ne wa_ce11000-bukrs.
now how can i delete all the entries from nmy internal table (ct_ce11000) when plant and company code is not same
pls help me with logic.
thank you for helping meHello Guys,
It is not advisable to delete the entries from the internal table you are looping upon. See this thread: [Sy-tabix in loop : Doubt|Sy-tabix in loop : Doubt]
And to answer the OP's question select data into some local internal table & based on the condition populate your final table. Creating a local table of the same type as the final table will not create too much performance overhead
Cheers,
Suhas
Maybe you are looking for
-
PDF files no longer open in browsers. 10.6.8 and 10.7.4
Some time ago my Safari and Firefox sites stopped opening PDF's in 10.6.8. I went to a genius who said there were no viruses, but he couldn't figure out what to do. Today, I upgraded to 10.7.4; but I still have the same problem on my MAcBook Air.
-
Windows phone lumia 620 not recognised by probook 450 under windows 7 profesisonal
Cannot get connected through USB cable, although it does still work with my older laptop
-
Pop-up with Message Log and ability to correct
Hi All, I am working on a Dialog Program which gets the messages that occur on validating the fields of this program into a message table. I am able to display the messages one after the other by looping through the message table. Is there a way that
-
DB adapter returning 0 rows = Error
Im using the database adapter to recieve multiple rows. The BPEL process works ok when the supplied ID has records (ie when the procedure call returns rows in the table). When there are no records returned however, my db adapter call gives me an erro
-
Netprotect, IE 9 and Win 7
When I run Winprotect from the desktop shortcut I get a white rectangle where the window ought to be. I've looked in several forums and some suggest that it's because I've got IE9. A BT Care forum said it was because IE9 is not supported because IE