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

File processing in ABAP...

Former Member
0 Likes
468

Hi,

I have one excel file A which has couple of records and another excel file B with couple of records. Now I want

to read each record of excel file A and see if it is in B. If it is in B then create a new excel file Cexcluding that

entry and keep only those records from file A which are not in B. How can I do this in ABAP ?

Excel A:

Mary 13 walnut st

John 17 Anderson Ave

Tim 20 Cooper house

Excel B:

John

Jack

So the new excel file C should have only following:

Mary 13 Walnut st

Tim 29 Cooper house

Regards,

Rajesh.

3 REPLIES 3
Read only

Former Member
0 Likes
447

Upload Excel File A to internal table ITABA.

Upload Excel File B to internal table ITABB.

LOOP AT ITABA.

CHECK IF RECORD IS PRESENT IN ITABB.

IF NO

POPULATE ITABC.

ENDIF.

ENDLOOP.

Download ITABC as a new Excel fiile.

You can use following function module to upload Excel file to ABAP

call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'

exporting

filename = file

i_begin_col = '1'

i_begin_row = '1'

i_end_col = '200'

i_end_row = '5000'

tables

intern = xcel

exceptions

inconsistent_parameters = 1

upload_ole = 2

others = 3.

Message was edited by:

Ashish Gundawar

Read only

0 Likes
447

Any inputs....

Read only

0 Likes
447

Hi,

Try like this.

Save excel files as txt files and use gui_upload FM.Populate two internal tables say ITAB1 TAB2.

LOOP AT ITAB1.

READ TABLE ITAB2 WITH KEY NAME = ITAB1-NAME.

IF SY-SUBRC = 0.

MOVE ITAB1 TO ITAB3.

ENDIF.

THEN USE GUI_DOWNLOAD TO create new excel file