‎2009 Jun 02 11:35 AM
Hi All,
My requirement is to save the string "abcd 23432423 asdada" to the text file in the application server.
I have written like this. but its not getting saved properly in the text file. Please help.
constants X_LINESIZE type I value 128.
types X_LINETYPE type X length X_LINESIZE.
data: WA_TAB_X type X_LINETYPE.
data: str1(64) type C.
data: WA_TAB_X_HDR1 type xstring.
str1 = 'abcd 23432423 asdada'.
CONVERT TEXT STR1 INTO SORTABLE CODE WA_TAB_X_HDR1.
concatenate F_FILENAME1 SY-SYSID F_FILENAME2 '/' TAB_REGUT-TSNAM '.TXT' into F_FILENAME1.
open dataset F_FILENAME1 for output in binary mode .
if SY-SUBRC = 0.
transfer WA_TAB_X_HDR to F_FILENAME1.
loop at TAB_X into WA_TAB_X.
transfer WA_TAB_X to F_FILENAME1.
endloop.
endif.
close dataset F_FILENAME1.
Edited by: madhuri sonawane on Jun 2, 2009 4:05 PM
‎2009 Jun 02 11:39 AM
Hi Madhuri,
try with
OPEN DATASET FILENAME FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
CLOSE DATASET.
‎2009 Jun 02 11:41 AM
Hi Kishor,
I cannot open the text file in text mode since the other data which contains TAB_X table is in byte mode.
I need to convert that string into byte mode which is not happening I think. Is there any other solution?
Rgds,
Madhuri
‎2009 Jun 03 7:09 AM
HI,
constants X_LINESIZE type I value 128.
types X_LINETYPE type X length X_LINESIZE.
data: WA_TAB_X type X_LINETYPE.
data: str1(64) type C.
data: WA_TAB_X_HDR1 type xstring.
data : file (1000) type c.
str1 = 'abcd 23432423 asdada'.
CONVERT TEXT STR1 INTO SORTABLE CODE WA_TAB_X_HDR1.
concatenate F_FILENAME1 SY-SYSID F_FILENAME2 '/' TAB_REGUT-TSNAM '.TXT' into F_FILENAME1.
open dataset file for output in binary mode .
if SY-SUBRC = 0.
transfer WA_TAB_X_HDR to file.
loop at TAB_X into WA_TAB_X.
transfer WA_TAB_X to file
endloop.
endif.
close dataset file.
regards,
Munibabu.k