09-26-2005 6:27 PM
Hi,
we tried to write a program exporting the results of Quick-Viewer-Reports into a file while batch processing. This worked out fine with the coding below.
But as soon as there are currency-fields SAP aborts with "UC_OBJECTS_NOT_CHARLIKE".
-
DATA: filename LIKE rlgrap-filename.
IF list_id = 'G00'.
filename = '/usr/sap/trans/tmp/'.
filename+19 = program.
filename+120 = sy-datum.
REPLACE ALL OCCURRENCES OF '=' IN filename WITH ' '.
CONDENSE filename NO-GAPS.
OPEN DATASET filename FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc = 0.
LOOP AT datatab.
TRANSFER datatab TO filename.
ENDLOOP.
CLOSE DATASET filename.
ELSE.
MESSAGE w111(z1) WITH filename.
ENDIF.
ENDIF.
-
Wie tried various kinds of "open dataset... encoding utf-8/non-unicode... ignoring conversion errors..." but nothing worked. Binary mode isn't helpful because the data in the file have to be useful for the user instantly.
Who can help?
Thanks in advance!
09-26-2005 6:37 PM
Hi
You could use only string to transfer data to file, so:
DATA STRING TYPE STRING.
LOOP AT datatab.
move datatab to string
TRANSFER string TO filename.
ENDLOOP.
Max
Message was edited by: max bianchi
09-26-2005 6:37 PM
Hi
You could use only string to transfer data to file, so:
DATA STRING TYPE STRING.
LOOP AT datatab.
move datatab to string
TRANSFER string TO filename.
ENDLOOP.
Max
Message was edited by: max bianchi
09-26-2005 6:38 PM
What is the structure of datatab. Replace all currency fields with char fields of same name and then try to do a transfer . You can use move or write to for moving currency fields to char fields. It should work.
Cheeers
09-26-2005 10:08 PM
You are getting an error due to the fact that you have Unicode checks active checked on the program attributes screen.
In SE38, you can edit the attributes and uncheck this flag. Unicode has very strict data validation.
Good luck,
JOhn
09-27-2005 10:35 AM
Thanks for your ideas so far. I tried a lot, but again nothing worked. Using string does work, but still only without currency fields. And before I can even change the type of currency fields, the program aborts.
As far as I have learned now, the problem is, that I have a unicode program, but our system ist non-unicode. And I can't change program attribute to no unicode checks, because it's an inlcude in SAP-exit SQUE0001 (SAP Note 537735, executed while using Quick Viewer or SAP Query). In an include, I can't change this attribute, and I can't edit the program because it's SAP original.
Any ideas? I've got no more...
09-27-2005 10:05 PM
I'm not sure why you can't reformat the data before writing to the dataset. Create a new structure with the same fields as your itab, only define them all as CHARACTER! ie)
data: begin of file_layout,
field1(20),
field2(10),
currency_field1(20),
end of file_layout.
Loop at itab.
move-corresponding itab to file_layout.
write itab-currency_field1 to file_layout-currency_field1.
transfer file_layout to file.
endloop.
Good luck,
John
09-27-2005 10:18 PM
11-28-2005 7:57 PM
11-28-2005 8:09 PM
Hi Felicitas,
TRANSFER f TO dsn.
Effect
Transfers the field f (usually a field string) to the sequential file specified in dsn
In your case, modify your datatab, so that the currency fields are moved to char fields of suitable length.
Later loop on your internal table and transfer to file on application server.
Regards,
Rajasekhar
11-29-2005 6:07 AM
Hi,
'Transfer To' didn't work at all.
We also tried every kind of Mode, text, binary, legacy - either it didn't work or the result was unusable.
At least, an OSS-Message obviously helped. Using "assign component" helps to transfer f. e. currency fields. It's kind of long winded and the result ist not as fine as we intended to have, because the records are without separators, you have to define it by field length, but it works - at least.
Anyhow, thanks for your ideas
Felicitas
11-29-2005 6:21 AM
Try to COnvert your Currency into Char foramt and Then transfer the data.
regards
vijay
11-29-2005 6:31 AM
Hi,
yes that's what we were trying from the beginning, but it wasn't possible to do anything with currency fields because everytime you address this field anyhow, a shortdump was created (or in binary/legacy mode the value of these fields was kind of "#$"... no way to get the value). So there was no possibility to change field type.
It only seems to be possible with "assign component"...
Thanks
Felicitas
-
Try to COnvert your Currency into Char foramt and Then transfer the data.
regards
vijay
-
11-29-2005 6:50 AM
I have faced the same Problem
Move the currency field to some Char field and use in the Internal table then Transfer data
U can transfer only char fields to File.
01-06-2006 4:34 PM
This works, but a bit late :
Regards Meinhart:
FIELD-SYMBOLS: <file_name> TYPE ANY.
fiELD-SYMBOLS: <ftab> TYPE ANY,
<field> type any.
DATA: it_table TYPE fieldname VALUE '(RSAQEXCE)%pathname'.
ASSIGN (it_table) TO <file_name>.
data : tp_tab(1) type x value '09',
tp_lf(2) type x value '0D0A'.
data : tp_file(128) .
data : tp_field(256).
data : tp_length type i.
tp_file = <file_name>.
OPEN DATASET tp_file FOR output IN binary mode.
if sy-subrc ne 0.
message e001(38) with 'Cannot open dataset' tp_file .
endif.
*
loop at datatab assigning <ftab>.
loop at LISTDESC.
ASSIGN COMPONENT listdesc-FNAMEINT OF STRUCTURE <ftab> TO <field>.
write <field> to tp_field.
SHIFT tp_field LEFT DELETING LEADING space.
tp_length = strlen( tp_field ) .
transfer tp_field to tp_file length tp_length.
transfer tp_tab to tp_file.
endloop.
transfer tp_lf to tp_file.
endloop.
close dataset tp_file.
02-13-2006 1:23 AM
I need to write to an output file data that has both characters and packed field. The amount field must be packed. I have unicode set in my program attributes. When I do a TRANSFER f to dsn i get an error uc_objects_not_charlike.
All the replies says to convert the packed field to char. How do i handle a field that must be packed?
Need help ASAP. Thanks.
02-13-2006 1:25 AM