*&---------------------------------------------------------------------*
*& Report ZDOWNLOAD *
*& *
*&---------------------------------------------------------------------*
*& This program uses the new function GUI_DOWNLOAD *
*& Output will be TAB delimited and include MANDT *
*& It can be opened directly by Microsoft Excel *
*& To use this program for any Database Table replace ZTEST with *
*& new table name. *
*&---------------------------------------------------------------------*
*& AUTHOR: Sheila Titchener - abap at iconet-ltd.co.uk *
*& Date: February 2004 *
*&---------------------------------------------------------------------*
REPORT zdownload MESSAGE-ID bd.
DATA: w_tab TYPE ztest.
DATA: i_tab TYPE STANDARD TABLE OF ztest.
DATA: v_subrc(2),
v_recswritten(6).
PARAMETERS: p_file(80)
DEFAULT 'D:\\ICONET\\SAP\\ZTEST.DAT'.
DATA: filename TYPE string.
filename = p_file.
SELECT * FROM ztest INTO TABLE I_TAB.
* If text fields appear right justified or columns not lined up in output set
* TRUNC_TRAILING_BLANKS to X
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
filename = filename
* FILETYPE = 'ASC'
* APPEND = ' '
WRITE_FIELD_SEPARATOR = 'X'
* HEADER = '00'
TRUNC_TRAILING_BLANKS = 'X '
* WRITE_LF = 'X'
* COL_SELECT = ' '
* COL_SELECT_MASK = ' '
* IMPORTING
* FILELENGTH =
tables
data_tab = I_TAB
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
.
* SYST FIELDS ARE NOT SET BY THIS FUNCTION SO DISPLAY THE ERROR CODE *
IF sy-subrc <> 0.
v_subrc = sy-subrc.
MESSAGE e899 WITH 'File Open Error' v_subrc.
ENDIF.
DESCRIBE TABLE i_tab LINES v_recswritten.
MESSAGE i899 WITH v_recswritten 'Records Written from ZTEST'.
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
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