Posted: Mon Feb 25, 2008 1:21 pm Post subject: Read SAP IMG into Text File
Code:
report zexp_get_img no standard page heading.
***********************************************************
* Read SAP IMG into Text File
*
* This is freeware. Please read the terms of use.
* Written by Urs Rohner, Rohner IT Consulting & Engineering
*
* Contact Author: Urs Rohner
*
***********************************************************
constants:
_outline like tcusp-outline value 'SIMG_ALL',
_view like tcusp-main_view value 'STANDARD'.
data:
_head like dsyah,
_header like dsyah occurs 0,
_org_vers like dsyah,
_mod_vers like dsyah,
_i_hier like hitab occurs 0,
_o_hier like hitab occurs 0 with header line,
_indent type i,
begin of _data occurs 0,
seq type i,
level type i,
node type c,
info type c,
text like hitab-text,
end of _data.
parameters:
_file like rlgrap-filename default 'c:\temp\img.txt'.
*
* P A I ( )
*
start-of-selection.
" get header data of IMG
call function 'TOCX_READ_DISPLAY_VERSION'
exporting
outline = _outline
spras = sy-langu
viewname = _view
tables
hierarchy = _i_hier[]
exceptions
missing_parameters = 1
not_found = 2
others = 3.
if sy-subrc is initial.
call function 'TOCX_GET_HEADER'
exporting
language = sy-langu
outline = _outline
importing
newest_modified_version = _mod_vers
newest_original_version = _org_vers
tables
header_data = _header[]
exceptions
no_language_given = 1
no_outline_given = 2
outline_exists_not = 3
others = 4.
if sy-subrc is initial.
if _mod_vers-version eq _org_vers-version.
move _mod_vers to _head.
else.
move _org_vers to _head.
endif.
call function 'TOCX_INSERT_INCLUDED_BOOKS'
exporting
header_data = _head
include_type = 'BIBL'
viewname = _view
tables
input_hierarchy = _i_hier[]
output_hierarchy = _o_hier[].
clear _data[].
loop at _o_hier[] into _o_hier.
clear _data.
_data-seq = sy-tabix.
_data-level = _o_hier-ebene.
if not _o_hier-attributes is initial.
_data-node = 'X'.
endif.
_data-info = _o_hier-got_info.
_data-text = _o_hier-text.
_indent = ( _data-level - 1 ) * 2.
shift _data-text right by _indent places.
append _data to _data[].
endloop.
call function 'WS_DOWNLOAD'
exporting
filename = _file
filetype = 'DAT'
tables
data_tab = _data[]
exceptions
file_open_error = 1
file_write_error = 2
invalid_filesize = 3
invalid_table_width = 4
invalid_type = 5
no_batch = 6
unknown_error = 7
gui_refuse_filetransfer = 8
others = 9.
if sy-subrc is initial.
message s208(00) with 'completed'.
endif.
endif.
endif.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.