2007 Jun 25 7:37 PM
Helo experts,
I created a class to select data from scustom, spfli, sflight and sbook into txt files for each table. But mt code only works with the scustom table. I tried to execute for all tables, for each table, but always occurs the same dump - except for scustom.
Please, help me.
&----
*& Report ZCL01 *
&----
REPORT zcl01 .
*----- Class itab definition
CLASS itab DEFINITION.
PUBLIC SECTION.
*----- Methods
METHODS: read_tab IMPORTING itab TYPE table,
write_tab,
txt_data IMPORTING patch TYPE string.
PRIVATE SECTION.
TYPES: BEGIN OF st,
field TYPE string,
END OF st.
DATA: struct TYPE TABLE OF st,
linha LIKE LINE OF struct.
ENDCLASS. "itab DEFINITION
*----- Class itab implementation
CLASS itab IMPLEMENTATION.
*----- method txt data
METHOD txt_data.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = patch
TABLES
data_tab = struct.
ENDMETHOD. "itab
*----- method read itab
METHOD read_tab.
FIELD-SYMBOLS: <it> TYPE table,
<wa> TYPE ANY.
ASSIGN itab TO <it>.
REFRESH struct.
LOOP AT <it> ASSIGNING <wa>.
CLEAR linha.
linha-field = <wa>.
APPEND linha TO struct.
ENDLOOP.
ENDMETHOD. "itab
*----- method write itab
METHOD write_tab.
ULINE.
LOOP AT struct INTO linha.
WRITE: / linha-field.
ENDLOOP.
ULINE.
ENDMETHOD. "itab
ENDCLASS. "itab IMPLEMENTATION
START-OF-SELECTION.
DATA: it TYPE REF TO itab,
ti_scustom TYPE STANDARD TABLE OF scustom,
ti_spfli TYPE STANDARD TABLE OF spfli,
ti_sflight TYPE STANDARD TABLE OF sflight,
ti_sbook TYPE STANDARD TABLE OF sbook.
SELECT * FROM scustom INTO TABLE ti_scustom.
PERFORM gera_txt USING 'c:\sap\ti_scustom.txt' ti_scustom.
SELECT * FROM spfli INTO TABLE ti_spfli.
PERFORM gera_txt USING 'c:\sap\ti_spfli.txt' ti_spfli.
SELECT * FROM sflight INTO TABLE ti_sflight.
PERFORM gera_txt USING 'c:\sap\ti_sflight.txt' ti_sflight.
SELECT * FROM sbook INTO TABLE ti_sbook.
PERFORM gera_txt USING 'c:\sap\ti_sbook.txt' ti_sbook.
END-OF-SELECTION.
----
FORM gera_txt
----
*
----
--> P_ARQUIVO
--> P_TABLE
----
FORM gera_txt USING p_arquivo
p_table.
IF sy-subrc EQ 0.
IF it IS INITIAL.
CREATE OBJECT it.
ENDIF.
CALL METHOD it->read_tab( p_table ).
CALL METHOD it->write_tab.
CALL METHOD it->txt_data( p_arquivo ).
ENDIF.
FREE it.
ENDFORM. "gera_txt
2007 Jun 25 7:49 PM
2007 Jun 25 7:43 PM
2007 Jun 25 7:49 PM
2007 Jun 25 7:55 PM
If you are still having issues with your program, you may want to implement the changes that I've done to your READ method.
*----- method read itab
method read_tab.
field-symbols: <it> type table,
<wa> type any.
assign itab to <it>.
refresh struct.
field-symbols: <fs> type any.
data: str type string.
loop at <it> assigning <wa>.
clear linha.
do.
assign component sy-index of structure <wa> to <fs>.
if sy-subrc <> 0.
exit.
endif.
str = <fs>.
if sy-index = 1.
linha-field = str.
else.
concatenate linha-field str into linha-field.
endif.
enddo.
append linha to struct.
endloop.
endmethod. "itab
Regards,
Rich Heilman
2007 Jun 25 8:03 PM
Thanks to the answers, the dum msg is:
Runtime errors UC_OBJECTS_NOT_CONVERTIBLE
Occurred on 25.06.2007 at 16:06:50
Data objects in a Unicode program are not convertible.
What happened?
Error in ABAP application program.
The current ABAP program "!CL01 " had to be terminated because one of the
statements could not be executed.
This is probably due to an error in the ABAP program.
What can you do?
Print out the error message (using the "Print" function)
and make a note of the actions and input that caused the
error.
To resolve the problem, contact your SAP system administrator.
You can use transaction ST22 (ABAP Dump Analysis) to view and administer
termination messages, especially those beyond their normal deletion
date.
Transaction ST22 allows you to display and manage short dumps. It
is especially useful if you want to keep a particular message.
Error analysis
The statement
"MOVE src TO dst"
requires the operands "dst" and "src" to be comvertible.
Since this statement occurs in a Unicode program, the special
convertibility rules for Unicode programs apply. In this case, the
following rules have been broken:
How to correct the error
Make sure the operands "dst" and "src" are comparable in the statement
"MOVE src TO dst".
Probably the only way to eliminate the error is to correct the program.
-
You may able to find an interim solution to the problem
in the SAP note system. If you have access to the note system yourself,
use the following search criteria:
"UC_OBJECTS_NOT_CONVERTIBLE" C
"!CL01 " or "!CL01 "
"READ_TAB"
If you cannot solve the problem yourself, please send the
following documents to SAP:
1. A hard copy print describing the problem.
To obtain this, select the "Print" function on the current screen.
2. A suitable hardcopy prinout of the system log.
To obtain this, call the system log with Transaction SM21
and select the "Print" function to print out the relevant
part.
3. If the programs are your own programs or modified SAP programs,
supply the source code.
To do this, you can either use the "PRINT" command in the editor or
print the programs using the report RSINCL00.
4. Details regarding the conditions under which the error occurred
or which actions and input led to the error.
System environment
SAP Release.............. "610"
Application server....... "GTCDES13"
Network address.......... "169.254.25.129"
Operating system......... "Windows NT"
Release.................. "5.1"
Hardware type............ "2x Intel 801586"
Database server.......... "GTCDES13"
Database type............ "ADABAS D"
Database name............ "WA1"
Database owner........... "SAPR3"
-
Thanks Rich, your code works so fine!
Message was edited by:
Rodrigo Paisante
2007 Jun 25 8:13 PM