‎2007 Oct 04 1:46 AM
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.
‎2007 Oct 04 1:50 AM
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
‎2007 Oct 04 1:49 PM
‎2007 Oct 04 2:06 PM
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