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

logic in a internal table

Former Member
0 Likes
562

hi experts , i need a logic

i have a internal table itab_equi in that i am getting 11 values when i pass this internal table to another table using for all entries i will get 4 values in int_bmgkobj . i need logic for how to get the deleted values i.e 9 values deleted . i need that value 9 values ..

SELECT matnr
           sernr
           kunde
           objnr FROM equi
           INTO TABLE itab_equi  " i am getting 11 values here 
           WHERE kunde = kunde .
IF itab_equi[] IS NOT INITIAL.
      SELECT j_objnr
                   gwldt
                   gwlen FROM bgmkobj
                   INTO TABLE itab_bgmkobj " i am getting 4 values here 
                   FOR ALL ENTRIES IN itab_equi
                   WHERE j_objnr = itab_equi-objnr .

i need the deleted 9 values in a seperate internal table ..

plz help me for this logic

regards

chinnaiya P

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
506

HI,

Check this ..

SELECT matnr
           sernr
           kunde
           objnr FROM equi
           INTO TABLE itab_equi  " i am getting 11 values here 
           WHERE kunde = kunde .
IF itab_equi[] IS NOT INITIAL.
      SELECT j_objnr
                   gwldt
                   gwlen FROM bgmkobj
                   INTO TABLE itab_bgmkobj " i am getting 4 values here 
                   FOR ALL ENTRIES IN itab_equi
                   WHERE j_objnr NE itab_equi-objnr .  "--> Check here

Or

Select all the data from bgmkobj into internal table  itab_bgmkobj.
Loop the  itab_bgmkobj and check the entry using entries in internal table itab_equi..if found delete ..the left entries are what you required

3 REPLIES 3
Read only

Former Member
0 Likes
506

select the whole second table into anothe internal table, loop on it and read itab_bgmkobj with the apropiate key to locate a match. If found, delete that record from your new internal table. At the end of this loop you'll have the entries separated in the two tables.

You could also loop at itab_bgmkobj and read the new table, deleting there, this could work faster for this case, although with this ammount of data, it's almost non mesurable.

Read only

Former Member
0 Likes
507

HI,

Check this ..

SELECT matnr
           sernr
           kunde
           objnr FROM equi
           INTO TABLE itab_equi  " i am getting 11 values here 
           WHERE kunde = kunde .
IF itab_equi[] IS NOT INITIAL.
      SELECT j_objnr
                   gwldt
                   gwlen FROM bgmkobj
                   INTO TABLE itab_bgmkobj " i am getting 4 values here 
                   FOR ALL ENTRIES IN itab_equi
                   WHERE j_objnr NE itab_equi-objnr .  "--> Check here

Or

Select all the data from bgmkobj into internal table  itab_bgmkobj.
Loop the  itab_bgmkobj and check the entry using entries in internal table itab_equi..if found delete ..the left entries are what you required

Read only

Former Member
0 Likes
506

It's generally not a good idea to select all entries into an internal table and then filter them. This can cause performance problems.

Here, the problem is likely due to the fact that FOR ALL ENTRIES eliminates duplicates according to the fields used in the WHERE clause.

This is documented in SELECT. Have a look at it.

Rob