REPORT Ycompare MESSAGE-ID Z1
NO STANDARD PAGE HEADING
* LINE-COUNT 65
LINE-SIZE 255.
*---------------------------------------------------------------------*
* Topic: Compare 2 unix or pc files and print the differences*
* *
* Author: Sheila Titchener
* *
*---------------------------------------------------------------------*
DATA: BEGIN OF TAB1 OCCURS 0,
LINE(5000),
END OF TAB1.
DATA: BEGIN OF TAB2 OCCURS 0,
LINE(5000),
END OF TAB2.
DATA: PARCOM_LOC(100) TYPE C.
DATA: COLOR TYPE I.
DATA: COUNT(16) TYPE C.
*-------------------------------------------------------------------*
* Parameters. *
*-------------------------------------------------------------------*
SELECTION-SCREEN SKIP 2.
PARAMETERS: PARCOM1(45) TYPE C LOWER CASE,
PARCOM2(45) TYPE C LOWER CASE,
PARCOM3 LIKE RLGRAP-FILENAME,
PARCOM4 LIKE RLGRAP-FILENAME ,
P_PC RADIOBUTTON GROUP ONE,
P_UNIX RADIOBUTTON GROUP ONE.
*-------------------------------------------------------------------*
* Parameter validation *
*-------------------------------------------------------------------*
*-------------------------------------------------------------------*
* TOP-OF-PAGE. *
*-------------------------------------------------------------------*
TOP-OF-PAGE.
PERFORM WRITE_PAGE_HEADING.
*-------------------------------------------------------------------*
* INITIALIZATION. *
*-------------------------------------------------------------------*
INITIALIZATION.
PARCOM1 = '/usr/sap/trans/* '.
PARCOM2 = '/usr/sap/trans/* '.
PARCOM3 = 'C:\TEMP\'.
PARCOM4 = 'C:\TEMP\'.
*-------------------------------------------------------------------*
* START-OF-SELECTION. *
*-------------------------------------------------------------------*
START-OF-SELECTION.
IF P_UNIX = 'X'.
PERFORM COLLECT_DATA.
ELSE.
PERFORM COLLECT_PC_DATA.
ENDIF.
PERFORM WRITE_FILE_CONTENT.
* perform write_number_of_content.
*---------------------------------------------------------------------*
* FORM COLLECT_DATA. *
*---------------------------------------------------------------------*
FORM COLLECT_DATA.
OPEN DATASET PARCOM1 FOR INPUT IN TEXT MODE.
DO.
READ DATASET PARCOM1 INTO TAB1.
IF SY-SUBRC NE 0.
EXIT.
ENDIF.
APPEND TAB1.
ENDDO.
CLOSE DATASET PARCOM1.
OPEN DATASET PARCOM2 FOR INPUT IN TEXT MODE.
DO.
READ DATASET PARCOM2 INTO TAB2.
IF SY-SUBRC NE 0.
EXIT.
ENDIF.
APPEND TAB2.
ENDDO.
CLOSE DATASET PARCOM2.
ENDFORM.
*-------------------------------------------------------------------*
* FORM WRITE_FILE_CONTENT. *
*-------------------------------------------------------------------*
FORM WRITE_FILE_CONTENT.
LOOP AT TAB1.
READ TABLE TAB2 INDEX SY-TABIX.
IF TAB1(7) = 'Element'.
WRITE: / TAB1.
ENDIF.
IF TAB1 NE TAB2 .
WRITE: / SY-TABIX NO-GAP, TAB1.
WRITE: / TAB2.
WRITE:/1(80) SY-ULINE.
ENDIF.
ENDLOOP.
ENDFORM.
*-------------------------------------------------------------------*
* FORM WRITE_PAGE_HEADING. *
*-------------------------------------------------------------------*
FORM WRITE_PAGE_HEADING.
WRITE:/1(80) SY-ULINE.
PERFORM STREGER_2.
FORMAT INTENSIFIED.
WRITE: /2(79) SPACE COLOR 1.
WRITE: 2 SY-DATUM COLOR 1.
IF P_UNIX = 'x'.
WRITE: / PARCOM1 COLOR 1.
WRITE: 45 PARCOM2 COLOR 1.
ELSE.
WRITE: / PARCOM3 COLOR 1.
WRITE: 45 PARCOM4 COLOR 1.
ENDIF.
PERFORM STREGER_2.
WRITE:/1(80) SY-ULINE.
PERFORM STREGER_2.
FORMAT INTENSIFIED.
WRITE: /2(79) SPACE COLOR 3.
WRITE: 2 'Offset' COLOR 3,
10 '0....+....1....+....2....+....3....+....' COLOR 3,
50 '4....+....5....+....6....+....' COLOR 3.
PERFORM STREGER_3.
FORMAT RESET.
WRITE:/1(80) SY-ULINE.
ENDFORM.
*-------------------------------------------------------------------*
* FORM STREGER_2. *
*-------------------------------------------------------------------*
FORM STREGER_2.
PERFORM WRITE_VLINE USING ' ' 1.
PERFORM WRITE_VLINE USING ' ' 80.
ENDFORM.
*-------------------------------------------------------------------*
* FORM STREGER_3. *
*-------------------------------------------------------------------*
FORM STREGER_3.
PERFORM WRITE_VLINE USING ' ' 1.
PERFORM WRITE_VLINE USING ' ' 9.
PERFORM WRITE_VLINE USING ' ' 80.
ENDFORM.
*-------------------------------------------------------------------*
* WRITE_VLINE. *
*-------------------------------------------------------------------*
FORM WRITE_VLINE USING MODE POS.
IF MODE NE 'T'.
FORMAT INTENSIFIED.
ENDIF.
POSITION POS.
WRITE: SY-VLINE.
IF MODE NE 'T'.
FORMAT RESET.
ENDIF.
ENDFORM.
*-------------------------------------------------------------------*
* FORM COLORLINE. *
*-------------------------------------------------------------------*
FORM COLORLINE USING TEXT1 TEXT2.
ON CHANGE OF SY-TABIX.
COLOR = COLOR + 1.
COLOR = COLOR MOD 2.
ENDON.
FORMAT RESET.
IF COLOR = 1.
WRITE: /2(79) SPACE COLOR 2.
IF TEXT1 = ' 0'.
WRITE: 3 TEXT1 COLOR 2, 11 TEXT2 COLOR 2.
ELSE.
WRITE: 3 TEXT1 COLOR 2, 10 TEXT2 COLOR 2.
ENDIF.
ELSE.
WRITE: /2(79) SPACE COLOR 4.
IF TEXT1 = ' 0'.
WRITE: 3 TEXT1 COLOR 4, 11 TEXT2 COLOR 4.
ELSE.
WRITE: 3 TEXT1 COLOR 4, 10 TEXT2 COLOR 4.
ENDIF.
ENDIF.
ENDFORM.
*-------------------------------------------------------------------*
* FORM WRITE_NUMBER_OF_CONTENT. *
*-------------------------------------------------------------------*
FORM WRITE_NUMBER_OF_CONTENT.
DESCRIBE TABLE TAB1 LINES COUNT.
FORMAT RESET. CONDENSE COUNT.
RESERVE 3 LINES.
WRITE:/1(80) SY-ULINE.
WRITE: /2(79) SPACE COLOR 2.
WRITE: 2 'Number of records in file:' COLOR 2,
29 COUNT COLOR 2.
PERFORM STREGER_2.
WRITE:/1(80) SY-ULINE.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form COLLECT_PC_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM COLLECT_PC_DATA.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
* CODEPAGE = ' '
FILENAME = PARCOM3
* FILETYPE = ' '
* HEADLEN = ' '
* LINE_EXIT = ' '
* TRUNCLEN = ' '
* USER_FORM = ' '
* USER_PROG = ' '
* IMPORTING
* FILELENGTH =
TABLES
DATA_TAB = TAB1
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TABLE_WIDTH = 4
INVALID_TYPE = 5
NO_BATCH = 6
UNKNOWN_ERROR = 7
OTHERS = 8.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
* CODEPAGE = ' '
FILENAME = PARCOM4
* FILETYPE = ' '
* HEADLEN = ' '
* LINE_EXIT = ' '
* TRUNCLEN = ' '
* USER_FORM = ' '
* USER_PROG = ' '
* IMPORTING
* FILELENGTH =
TABLES
DATA_TAB = TAB2
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TABLE_WIDTH = 4
INVALID_TYPE = 5
NO_BATCH = 6
UNKNOWN_ERROR = 7
OTHERS = 8.
ENDFORM. " COLLECT_PC_DATA
Tuesday, May 6, 2008
Sample ABAP Program to Compare to Unix or PC files and print differences
Labels:
Sample ABAP Code Programs
Subscribe to:
Post Comments (Atom)
Blog Archive
-
▼
2008
(300)
-
▼
May
(80)
- Object oriented programming (OOP) All Steps
- Object oriented programming (OOP) Step2
- Object oriented programming (OOP) Step-by-step
- Object oriented programming (OOP) explained with a...
- Interview Question on BAPI, RFC, ABAP Objects, Tables
- The Other 50 ABAP Interview Faq's
- More than 100 ABAP Interview Faq's
- Events in Report
- Example: The IDoc Type ORDERS01
- Program for Outbound IDOC
- Basic Configuration in IDOC
- Sample ABAP Program to Upload table using new func...
- Sample ABAP Program for Submitting report with sel...
- Sample ABAP Program for Submitting report with sel...
- Sample ABAP Program for Sending SAP Mail
- Sample ABAP Program for Search Layout sets for giv...
- Sample ABAP Program for Sapscript PerForm Module
- Sample ABAP Program for Create IDOC
- Sample ABAP Program for Output file to application...
- Sample ABAP Program for Module Pool Skeleton
- Sample ABAP Program for Module Pool containing scr...
- Sample ABAP Program for MB1B Call Transaction
- Sample ABAP Program of Function Module to Convert ...
- Sample ABAP Program of FTP Function Module
- Sample ABAP Program to EXPORT LIST TO MEMORY
- Sample ABAP Program to Execute Unix command from w...
- Sample ABAP Program to Get Output in EXCEL
- Sample ABAP Program to Implement EDI
- Sample Program to dynamically change upload/downlo...
- Sample ABAP Program to download table using new fu...
- Sample ABAP Program to Download file to Presentati...
- Sample ABAP Program to display pop message to avoi...
- Sample ABAP Program of ALV Grid
- Sample ABAP Program of Dialogue Module Pool
- Sample ABAP Program to DIALOGUE FLOW LOGIC
- Sample ABAP Program to Delete a file from the appl...
- Sample ABAP Program to Compare to Unix or PC files...
- Sample ABAP Program to Colour cells in ALV
- Sample ABAP Program to Calculate difference betwee...
- Sample ABAP Program of BW User Exit
- Sample SAP ABAP Program to Browse a file on the ap...
- Sample SAP ABAP Program of ALV Grid control using ...
- SE30 - Runtime Analysis Tool
- List of System fields
- Write a report that displays the text 'Hello world...
- HR (Human Resource) Tutorials Free downloads
- FI (Financial) Tutorials Free downloads
- PM (Plant Maintenance) Tutorials Free downloads
- WM (Warehouse Management) Tutorials Free downloads
- QM (Quality Management) Tutorials Free downloads
- PP (Production Planning) Tutorials Free downloads
- SD (Sales and Distribution) Tutorials Free downloads
- MM (Material Management) Tutorials Free downloads
- IDOC INTRODUCTION & STRUCTURE
- Step-by-Step Guide for using LSMW to Update Custom...
- LIST of TABLES
- Transporting Objects and Standard Text from one cl...
- SAP R/3 INTERVIEW ARCHITECTURE QUESTIONS
- SAP TRANSACTIONS INTERVIEW QUESTIONS
- SAP MODULARIZATION INTERVIEW QUESTIONS
- SAP LOGICAL DATABASE INTERVIEW QUESTIONS
- SAP R/3 DATA DICTIONARY INTERVIEW QUESTIONS
- SAP BDC INTERVIEW QUESTIONS & ANSWERS
- SAP ABAP MENU PAINTER & SCREEN PAINTER Tutorials
- SAP ABAP WORKFLOW Tutorials PDF Free downloads
- SAP ABAP ITS Tutorials PDF Free downloads
- SAP ABAP EDI Tutorials PDF Free downloads
- SAP ABAP BAPI Tutorials PDF Free downloads
- SAP ABAP Change&Transport System Tutorials PDF Fre...
- SAP ABAP OBJECTS Tutorials PDF Free downloads
- SAP ABAP USER EXITS Tutorials PDF Free downloads
- SAP ABAP ALE Tutorials PDF Free downloads
- SAP ABAP IDOC Tutorials PDF Free downloads
- SAP ABAP LSMW Tutorials PDF Free downloads
- SAP ABAP BDC (Batch Data Communication) Tutorials ...
- SAP ABAP SAPSCRIPTS Tutorials Free downloads
- ALV Grid free download
- SAP ABAP INTERACTIVE REPORTING FAQs
- SAP ABAP REPORTING GENERAL
- SAP REPORTS FAQ
-
▼
May
(80)
No comments:
Post a Comment