12-19-2007 1:40 PM
tables: BUT000.
types: t_but000 type but000.
data: it_but000 type standard table of t_but000,
wa_but000 type t_but000.
data : BP_file(1000) type c.
constants: path_directory(18) type c value '/usr/sap/tmp/Bn_I7'.
START-OF-SELECTION.
select * from but000
into table it_but000
where type = '1' and
crdat = sy-datum.
concatenate path_directory SY-DATUM into BP_file.
OPEN DATASET bp_file IN BINARY MODE FOR OUTPUT ENCODING DEFAULT.
if sy-subrc <> 0.
write: 'not able to open the file'.
endif.
loop at it_but000 into wa_but000.
*transfer the data
TRANSFER wa_but000 TO bp_file.
endloop.
Hi guys,
Above is my code when i run that it go to dump
my program got activated
when I press F8
1. my program go to dump with message
error analysis
For the statement
"TRANSFER f TO ..."
only character-type data objects are supported at the argument position
"f".
In this case. the operand "f" has the non-character-type "T_BUT000". The
current program is a Unicode program. In the Unicode context, the type
'X' or structures containing not only character-type components are
regarded as non-character-type.
2.I can see the file in application server, but when I go to open that file I get message as UNABLE TO DISPLAY THIS FILE
12-19-2007 2:07 PM
1. tranfer statement works olny for character values. if u ahve any values other than charater type, convert those values into character type.
2. close the opened close with
close dataset bp_file statement.
and file type should be of type sxpgcolist-parameters.
bp_file TYPE sxpgcolist-parameters
12-19-2007 2:14 PM
how can I convert the files datatype I have total 100 fields
and I extracted saying select * how can I find which is of not char type.
12-19-2007 2:26 PM
Hi ,
One long way is , TRANSFER each field to the file using offsets
TRANSFER : wa_BUT00-field1 to bp_file+0(10),
wa_BUT00-field2 to bp_file+10(10),
wa_BUT00-field3 to bp_file+20(10),
..........................
Another way is concatenate all the fields into a field of char type and TRANSFER that Field to the file
Loop at itab.
concatenate itab-field1 itab-field2 ...........into V_CHAR.
TRANSFER V_CHAR to bp_file
Endloop.