08-13-2007 2:12 PM
Hi ...I want to open .TXT format file ....I used following FM's to open Xcel sheet...but i don't know what are the values should pass for "key" and "section"
in the FM "REGISTRY_GET" to open TXT format file.
CALL FUNCTION 'REGISTRY_GET'
EXPORTING
key = 'protocol\StdFileEditing\Server'
section = 'ExcelSheet'
IMPORTING
value = excel_command.
CONCATENATE '"' dw_file1 '"' INTO dw_file1.
CALL FUNCTION 'WS_EXECUTE'
EXPORTING
commandline = dw_file1
program = excel_command
EXCEPTIONS
frontend_error = 1
no_batch = 2
prog_not_found = 3
illegal_option = 4
OTHERS = 5.
Please help me how to open TXT format file
08-13-2007 2:17 PM
08-13-2007 2:46 PM
HI Prashant....I am saving data to Txt format file...it is saving fine...but after saving I like open that .Txt file automatically on screen...Please help me inthat...
Thanks in advance..
Rama
08-13-2007 2:53 PM
Hi Rama,
Here is the code to read the .txt file... Just go through this...
report zpstest1 .
Bosch ATMO: Der R2 Materialkurztext wird als 2-teilig betrachtet;
19 Stellen + 21 Stellen. Im R3 sollen die ersten 19 Stellen in MAKT-
MAKTX verbleiben und der Rest an den Anfang des Grunddatentextes
(Langtext) geschoben werden.
tables: stxh, makt.
data: zeilen like tline occurs 20 with header line,
header like thead,
text2(21).
data: t_makt like makt occurs 10000 with header line.
data: z type i,
zeile2 like zeilen,
zeile3 like zeilen.
select-options: s_matnr for makt-matnr.
select * from makt into table t_makt where matnr in s_matnr
and spras <> 'S'.
loop at t_makt.
clear zeilen.
refresh zeilen.
select single * from stxh where tdobject = 'MATERIAL'
and tdname = t_makt-matnr
and tdid = 'GRUN'
and tdspras = t_makt-spras.
if sy-subrc = 0.
call function 'READ_TEXT'
exporting
client = sy-mandt
id = 'GRUN'
language = stxh-tdspras
name = stxh-tdname
object = 'MATERIAL'
ARCHIVE_HANDLE = 0
LOCAL_CAT = ' '
importing
header = header
tables
lines = zeilen.
if sy-subrc = 0.
read table zeilen index 1.
if zeilen-tdline+131(1) <> '.'.
zeilen-tdline+131(1) = '.'.
modify zeilen index 1.
read table zeilen index 2 into zeile2.
if sy-subrc = 0.
if zeile2-tdline <> ' '.
zeilen-tdline = ' '.
zeilen-tdformat = '*'.
insert zeilen index 2.
insert zeilen index 2.
else.
read table zeilen index 3 into zeile3.
if sy-subrc = 0.
if zeile3-tdline <> ' '.
zeilen-tdline = ' '.
zeilen-tdformat = '*'.
insert zeilen index 3.
endif.
else.
zeilen-tdline = ' '.
zeilen-tdformat = '*'.
insert zeilen index 3.
endif.
endif.
else.
zeilen-tdline = ' '.
zeilen-tdformat = '*'.
insert zeilen index 2.
insert zeilen index 2.
endif.
concatenate text2 zeilen-tdline into zeilen-tdline
separated by space.
modify zeilen index 1.
endif.
endif.
else.
zeilen-tdline+131(1) = '.'.
zeilen-tdformat = '*'.
append zeilen.
zeilen-tdline = ' '.
zeilen-tdformat = '*'.
append zeilen.
append zeilen.
header-tdobject = 'MATERIAL'.
header-tdname = t_makt-matnr.
header-tdid = 'GRUN'.
header-tdspras = t_makt-spras.
endif.
call function 'SAVE_TEXT'
exporting
client = sy-mandt
header = header
insert = ' '
savemode_direct = 'X'
owner_specified = 'X '
LOCAL_CAT = ' '
IMPORTING
FUNCTION =
NEWHEADER =
tables
lines = zeilen.
if sy-subrc = 0.
add 1 to z.
endif.
clear: header,
zeilen.
refresh zeilen.
endif.
endloop.
write: / z.
Reward If Helpful
Regards
--
Sasidhar Reddy Matli.