Skip to Content
0
Former Member
Sep 17, 2014 at 05:13 AM

comparison of 2 internal tables and pass the values in new internal tables?

32 Views

hi all

one problem am facing in abap

please any one solve this...

am having 2 files in desktop i upload that files by using gui_upload,

that 2 flies having data that 2 flies data i can transfer to 2 internal tables,

ex: file1 having

customer sortl

110 yb03

139 yb04

150 yb03

2nd file having

customer sortl

110 yb03

149 yb05

160 yb04

same values i don't want in 3 and 4 internal table

pls any one help me these is my coding where was the mistake i don't no...

DATA : BEGIN OF str1,

customer TYPE kna1-kunnr,

search TYPE kna1-sortl,

* loevm TYPE kna1-loevm,

END OF str1.

DATA : BEGIN OF str2,

customer TYPE kna1-kunnr,

search TYPE kna1-sortl,

* loevm TYPE kna1-loevm,

END OF str2.

DATA: it_upload LIKE TABLE OF str1,

it_upload1 LIKE TABLE OF str2,

it_1 LIKE TABLE OF str1,

it_2 LIKE TABLE OF str2,

wa_1 LIKE str1,

wa_2 LIKE str2.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = 'C:\Users\RR\Desktop\headr.txt'

HAS_FIELD_SEPARATOR = 'X'

TABLES

data_tab = it_upload.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = 'C:\Users\RR\Desktop\headr1.txt'

HAS_FIELD_SEPARATOR = 'X'

TABLES

data_tab = it_upload1

loop at it_upload INTO wa_1.

read table it_upload1 INTO wa_2 with key search = wa_1-search.

APPEND wa_1 to it_1.

endloop.

loop at it_upload1 INTO wa_2.

read table it_upload1 INTO wa_1 with key search = wa_2-search.

APPEND wa_2 to it_2.

endloop.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = 'C:\Users\RR\Desktop\DOWNLOAD.txt' "filepath

filetype = 'DAT'

write_field_separator = 'X'

TABLES

data_tab = it_1

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = 'C:\Users\RR\Desktop\DOWNLOAD1.txt' "filepath

filetype = 'DAT'

write_field_separator = 'X'

TABLES

data_tab = it_2