05-13-2011 7:39 AM
hi all, i hava a problem. this is my code:
TYPES: BEGIN OF mytype,
f1(14) TYPE C,
f2(24) TYPE C,
f3(9) TYPE C,
f4(6) TYPE C,
f5(4) TYPE N,
f6(5) TYPE N,
Myfield (8) TYPE F,
END OF mytype.
DATA: mylocaltable TYPE TABLE OF mytype WITH HEADER LINE.
.............................
read data from CSV file and put it to mylocaltable, it works fine ))), but next:
DATA: OUTPUT TYPE TABLE OF DEEP_STRUCTURE_TYPE WITH HEADER LINE.
DATA: deepstructure LIKE LINE OF OUTPUT-message_type-line.
LOOP AT mylocaltable.
MOVE-CORRESPONDING mylocaltable to deepstructure.
APPEND deepstructure TO OUTPUT-message_type-line.
ENDLOOP.
TRY.
CREATE OBJECT PROXY.
CALL METHOD PROXY->Message_Out
EXPORTING
OUTPUT = OUTPUT.
COMMIT WORK.
ENDTRY.
there is a error message on line "Myfield (8) TYPE F,":
"Myfield" must be a character like data object (data type C, N, D, T or STRING) .
in the DEEP structure OUTPUT the field "Myfield" has XSD:DOUBLE type (in XI).
Please help me to solve this problem. Thanks.
P.S. the data for "Myfield" can be like "12345678,12345678" - i mean it's float and has max length - 16.
05-13-2011 8:01 AM
Hi,
Change Myfield data type 'F' to 'string'. it will work fine.
Ram.
05-13-2011 8:23 AM
Hi, thanks for reply, but i've solved this problem by other way:
1.
i've changed
Myfield (8) TYPE F, to Myfield (16) TYPE С,
2.
then i've changed
LOOP AT mylocaltable.
MOVE-CORRESPONDING mylocaltable to deepstructure.
APPEND deepstructure TO OUTPUT-message_type-line.
ENDLOOP.
to
DATA: Float type F.
LOOP AT mylocaltable.
deepstructure-f1 = mylocaltable-f1.
deepstructure-f2 = mylocaltable-f2.
deepstructure-f3 = mylocaltable-f3.
deepstructure-f4 = mylocaltable-f4.
deepstructure-f5 = mylocaltable-f5.
deepstructure-f6 = mylocaltable-f6.
CALL FUNCTION 'CHAR_FLTP_CONVERSION'
EXPORTING
STRING = mylocaltable-Myfield
IMPORTING
FLSTR = Float
EXCEPTIONS
EXPONENT_TOO_BIG = 1
EXPONENT_TOO_SMALL = 2
STRING_NOT_FLTP = 3
TOO_MANY_DECIM = 4
OTHERS = 5.
deepstructure-Myfield = Float.
APPEND deepstructure TO OUTPUT-message_type-line.
ENDLOOP.
Anyway thanks to all !!!!! )))).
05-13-2011 8:24 AM
the problem has been solved !
Edited by: kinderus on May 13, 2011 9:24 AM
05-13-2011 10:23 AM
select the fiels wanted in the d.b tabke and create (.)append structure