Posted: Sat Sep 15, 2007 9:06 pm Post subject: Text Elements: display, download, upload, fix
Code:
report z message-id 38 line-size 255.
parameters: program like trdir-name memory id rid,
language like t002-spras memory id spr default 'EN',
display radiobutton group rad1,
download radiobutton group rad1,
upload radiobutton group rad1,
fix radiobutton group rad1, "just rebuild text elements
generate as checkbox, "generate report
pc_file(128) type c lower case.
data: begin of i_textpool occurs 0.
include structure textpool.
data: end of i_textpool.
data: begin of it_text occurs 0,
id like i_textpool-id,
key like i_textpool-key,
entry like i_textpool-entry,
slen(3) type n,
end of it_text.
data w_line(255) type c.
*------------------------------------------------*
at selection-screen on value-request for pc_file.
*- - - - - - - - - - - - - - - - - - - - - - - - *
call function 'WS_FILENAME_GET'
exporting
mask = ',*.*,*.*.'
importing
filename = pc_file
exceptions
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
others = 5.
if sy-subrc <> 0.
case sy-subrc.
when 1 or 4 or 5. message s899(mm) with 'Cannot select file name'.
when 2. "impossible
when 3. "no actions
endcase.
endif.
*------------------------------------------------*
start-of-selection.
*- - - - - - - - - - - - - - - - - - - - - - - - *
if upload is initial.
write: / '... Reading Textpool...'.
read textpool program into i_textpool language language.
if sy-subrc <> 0.
message e000 with 'Textpool for' program
'does not exist for language' language.
else.
write: / 'Read Ok'.
endif.
endif.
*------------------------------------------------*
end-of-selection.
*- - - - - - - - - - - - - - - - - - - - - - - - *
if not download is initial or
not display is initial.
loop at i_textpool.
it_text-id = i_textpool-id.
it_text-key = i_textpool-key.
it_text-entry = i_textpool-entry.
it_text-slen = i_textpool-length.
append it_text.
clear it_text.
endloop.
endif.
if not display is initial.
write: / '... Displaying Textpool...'.
loop at it_text.
concatenate it_text-id it_text-key it_text-slen it_text-entry
into w_line separated by space.
write: / w_line.
endloop.
endif.
if not download is initial.
write: / '... Downloading Textpool to the File', pc_file.
call function 'WS_DOWNLOAD'
exporting
filename = pc_file
filetype = 'ASC'
tables
data_tab = it_text
exceptions
file_open_error = 1
file_write_error = 2
invalid_filesize = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
others = 10.
if sy-subrc <> 0.
message e000 with 'Cannot download to file' pc_file
'return code = ' sy-subrc.
else.
write: / 'Downloaded Ok'.
endif.
endif.
if not upload is initial or
not fix is initial.
write: / '... Deleting Textpool...'.
delete textpool program language language.
if sy-subrc <> 0.
message e000 with 'Deletion of textpool failed'.
else.
write: / 'Deleted Ok'.
endif.
write: / '... Inserting Textpool...'.
insert textpool program from i_textpool language language.
if sy-subrc <> 0.
message e000 with 'Insertion of textpool failed'.
else.
write: / 'Inserted Ok'.
write: / 'Textpool for program', program,
'has been rebuild for language', language.
endif.
endif.
if not generate is initial.
write: / '... Generating Report...'.
generate report program.
if sy-subrc = 0.
write: / 'Generated Ok'.
else.
write: / 'Unable to generate report'.
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.