02-22-2019 12:35 PM
I am getting a dump when I use the functional call sometimes. Sometimes it works correctly.
CALL FUNCTION 'SAP_CONVERT_TO_TEX_FORMAT'
EXPORTING
I_FIELD_SEPERATOR = '|'
"I_LINE_HEADER = I_LINE_HEADER
I_FILENAME = fname
TABLES
I_TAB_SAP_DATA = <fs_temp_data_standard>
CHANGING
I_TAB_CONVERTED_DATA = conv_data
EXCEPTIONS
CONVERSION_FAILED = 1
OTHERS = 2.
2019-02-22-07-34-03-abap-runtime-errors.png
'In this case, the operand "op1" has the non-character-type "I". The current program is flagged as a Unicode program. In the Unicode context, type X fields are seen as non-character-type, as are structures that contain non-character-type components.'
How do I correct it, or should I build the csv files manually?
I wonder if this is related, I imported a table from memory into a table I made dynamically. This is the data I'm trying to convert. I wonder if a mismatch error were to happen and I ignore it it may cause problems later. When I remove 'IGNORING STRUCTURE BOUNDARIES' the import fails.
IMPORT sel_tab TO <fs_data> ind_empty TO flag
FROM MEMORY ID me->report_name IGNORING STRUCTURE BOUNDARIES.
02-25-2019 9:42 AM
I think you'll have to create the CSV manually as Simon suggests. To convert from numeric to character, WRITE is usually a good option. You need to know the types of each field, so that you can know when to use the field value directly, and when they might need converting to character. You can get this through RTTS.
02-22-2019 1:32 PM
The dump is self speaking: you need a table with all fields character type while you have a field (OP1?) type I.
If you use the table for more works/things, i'd choose to manually write the CSV file (not big deal nor hug work at all) so i avoid to create a specular table with all the fields char type
02-22-2019 1:34 PM
I am dynamically creating this table, is there a way to change the fields after it is created?
02-25-2019 8:40 AM
What's your SAP version, did you search and find a note such as 1855878 - Supplement to SAP_CONVERT_TO_TEX_FORMAT (where 'I' was added)
02-25-2019 2:10 PM
02-25-2019 2:23 PM
When you work on such an old version, it's better to provide this information in initial post 😉
02-26-2019 3:31 PM
When I manually create the CSV files without using SAP_CONVERT_TO_TEX_FORMAT, the date fields and timestamp fields no longer have there format.
I want yyyy-mm-dd and HH:mm:ss, however the dashes and colons are only present if I use the function module, not if I create it manually. I guess i will look into the note for SAP_CONVERT_TO_TEX_FORMAT but I don't have hope it will work with such an old system.
02-25-2019 9:41 AM
02-25-2019 9:42 AM
I think you'll have to create the CSV manually as Simon suggests. To convert from numeric to character, WRITE is usually a good option. You need to know the types of each field, so that you can know when to use the field value directly, and when they might need converting to character. You can get this through RTTS.
02-25-2019 10:48 AM
I just tested SAP_CONVERT_TO_TEX_FORMAT and it works "fine" for many types like X, P and F, only the type I was handled lately by note 1855878 as stated by Raymond. Anyway, this function module is not released to customers, so that's a good advice to write our own custom solution (and that's a simple algorithm so no excuse).
02-25-2019 11:03 AM
I've always written my own anyway - SAP_CONVERT_TO_TEX_FORMAT is an R/3 FM, not available in BW and other SAP systems.