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

internal table validation

Former Member
0 Likes
664

Hi,

i have a situation like this.

db table

CODE........NAME

-


A123 | AAA

B234 | BBB

internal table 1 is

code | name| group|

-


A123 | AAA | M

A123 | AAA | N

B234 | BBB | M

B234 | BBB | N

B234 | BBc | L

B234 | abc | L

C234 | ccc | K

INTERNAL TABLE 3 IS EMPTY

after validating internal table with my db table, 2nd internal table would contain all the matching records with db table only though other fields are different.

INTERNAL TABLE 3

code name group

-


A123 | AAA | M

A123 | AAA | N

B234 | BBB | M

B234 | BBB | N

your help would be appreciated.

thanks,

kranthi.

3 REPLIES 3
Read only

Former Member
0 Likes
528

select all ur data base entries in to itab_data base.

add one more field in your first internal table (itab1)

say it will look like this.

code

name

group

flag

loop at itab_data.

itab1-flag = 'X'.

modify itab1 where

code = itab_data-code

name = itab_data-name.

endloop.

delete itab1 where flag = space.

you will be left with only entries which are in your data base.

I am sure you can do it many (better??) ways , jst an idea while sipping my tea .-)

I hope you like too :-).

Rgds,

Mano Sri

Read only

Former Member
0 Likes
528

Hi kranthi,

as suggested by mano sri you can carry out the operation, this is also another simple way which is shown below.

i_tab1 - internal table entries

i_tab2 - Database entries.

loop at i_tab1.

ws_tabix = sy-tabix.

read table i_tab2 with key name = i_tab1-name

code = i_tab1-code.

if sy-subrc ne 0.

delete i_tab1 index ws_tabix.

endif.

endloop.

Regards,

Jagath.

Read only

0 Likes
528

Hi,

Select * from db into table itab_db.

loop at itab_db into wa_db.

*itab1 is internal table 1

loop at itab1 into wa1 where code = wa_db-code

and name = wa_name.

move-corresponding wa1 into wa3.

*itab3 is output internal table 3

append wa3 to itab3.

endloop.

endloop.

Hope this helps.