REPORT ZBROWSE MESSAGE-ID Z1
NO STANDARD PAGE HEADING
* LINE-COUNT 65
LINE-SIZE 255.
*---------------------------------------------------------------------*
* Topic: Browse a file on the appication server
* *
* 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.
DATA: MESS(50).
*-------------------------------------------------------------------*
* Parameters. *
*-------------------------------------------------------------------*
SELECTION-SCREEN SKIP 2.
PARAMETERS: PARCOM1(55) TYPE C LOWER CASE.
* parcom2(55) type c lower case,
* parcom3 like rlgrap-filename,
* parcom4 like rlgrap-filename ,
* p_pc radiobutton group one,
*8 p_unix radiobutton group one.
*-------------------------------------------------------------------*
* Parameter validation *
*-------------------------------------------------------------------*
*-------------------------------------------------------------------*
* TOP-OF-PAGE. *
*-------------------------------------------------------------------*
TOP-OF-PAGE.
PERFORM WRITE_PAGE_HEADING.
*-------------------------------------------------------------------*
* INITIALIZATION. *
*-------------------------------------------------------------------*
INITIALIZATION.
PARCOM1 = '\\sapdev1\export\'.
*-------------------------------------------------------------------*
* START-OF-SELECTION. *
*-------------------------------------------------------------------*
START-OF-SELECTION.
PERFORM COLLECT_DATA.
PERFORM WRITE_FILE_CONTENT.
*---------------------------------------------------------------------*
* FORM COLLECT_DATA. *
*---------------------------------------------------------------------*
FORM COLLECT_DATA.
OPEN DATASET PARCOM1 FOR INPUT IN TEXT MODE MESSAGE MESS.
IF SY-SUBRC NE 0.
WRITE: 'Unable to open', PARCOM1.
WRITE: / MESS.
ELSE.
DO.
READ DATASET PARCOM1 INTO TAB1.
IF SY-SUBRC NE 0.
EXIT.
ENDIF.
APPEND TAB1.
ENDDO.
CLOSE DATASET PARCOM1.
ENDIF.
ENDFORM.
*-------------------------------------------------------------------*
* FORM WRITE_FILE_CONTENT. *
*-------------------------------------------------------------------*
FORM WRITE_FILE_CONTENT.
DATA: E LIKE SY-FDPOS.
LOOP AT TAB1.
E = STRLEN( TAB1-LINE ).
IF E GE 0.
PERFORM COLORLINE USING ' 0' TAB1-LINE+0(99).
PERFORM STREGER_3.
ENDIF.
IF E GE 100.
PERFORM COLORLINE USING '100' TAB1-LINE+99(100).
PERFORM STREGER_3.
ENDIF.
* write: /10 tab1.
*
ENDLOOP.
ENDFORM.
*-------------------------------------------------------------------*
* FORM WRITE_PAGE_HEADING. *
*-------------------------------------------------------------------*
FORM WRITE_PAGE_HEADING.
WRITE:/1(110) SY-ULINE.
PERFORM STREGER_2.
FORMAT INTENSIFIED.
WRITE: / PARCOM1 COLOR 1.
PERFORM STREGER_2.
WRITE:/1(110) SY-ULINE.
PERFORM STREGER_2.
FORMAT INTENSIFIED.
WRITE: /2(109) SPACE COLOR 3.
WRITE: 2 'Offset' COLOR 3,
10 '0....+....1....+....2....+....3....+....' COLOR 3,
50 '4....+....5....+....6....+....7....+....' COLOR 3,
90 '8....+....9....+....' COLOR 3.
PERFORM STREGER_3.
FORMAT RESET.
WRITE:/1(110) 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 ' ' 110.
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.
ABAP/4,ABAP report,Interactive Report Example,ALV grid Example,ALV list,IDOC,User Exit,RFC,Smartform,sapscript,ABAP Performance,Remote Function Module( RFC ),Function Module,ABAP Sample Code,ABAP tools,ALV report Generator,ABAP Interview Questions,BDC,BAPI,ALE,BADI,EDI,InternalTable,Data Structure,LSMW,Domain,DataElement,Basis and Administration,ABAP HR development,ABAPDebugger,BW,Exception Handling,Download FI, CO, MM, PP, SD, PM, PS, QM, SM, HR, BW, APO,ABAP Tutorial
Thursday, October 18, 2007
Subscribe to:
Post Comments (Atom)
Sample ABAP Code
- Sample ABAP Program to Upload table using new function GUI_UPLOAD
- Sample ABAP Program for Submitting report with selection table
- Sample ABAP Program for Sending SAP Mail
- Sample ABAP Program for Search Layout sets for given String
- Sample ABAP Program for Sapscript PerForm Module
- Sample ABAP Program for Create IDOC
- Sample ABAP Program for Output file to application server then send mail with Download details
- Sample ABAP Program for Module Pool Skeleton
- Sample ABAP Program for Module Pool containing screen loop processing
- Sample ABAP Program for MB1B Call Transaction
- Sample ABAP Program of Function Module to Convert Work Center into Personnel Number
- Sample ABAP Program of FTP Function Module
- Sample ABAP Program to EXPORT LIST TO MEMORY
- Sample ABAP Program to Execute Unix command from within SAP
- Sample ABAP Program to Get Output in EXCEL
- Sample ABAP Program to Implement EDI
- Sample Program to dynamically change upload/download program for any Table
- Sample ABAP Program to download table using new function GUI_DOWNLOAD
- Sample ABAP Program to Download file to Presentation Server
- Sample ABAP Program to display pop message to avoid abort
- 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 application server
- Sample ABAP Program to Compare to Unix or PC files and print differences
- Sample ABAP Program to Colour cells in ALV
- Sample ABAP Program to Calculate difference between date/times in hours
- Sample ABAP Program of BW User Exit
- Sample ABAP Program of ALV Grid control using OO methods
- Browse a file on the application server
No comments:
Post a Comment