‎2006 Nov 14 12:10 PM
Hello,
I have a binary file with a structured format like <header>,<item>, <sub-item> etc. How do I convert it in to text ??? I want to post this data to R/3.
Thanks,
John
‎2006 Nov 14 12:16 PM
hi,
SCMS_BINARY_TO_STRING .
if you want the resulting string to be in an itab.
declare a itab type string.
data: stringtab type standard table of string.
append <result string from FM> to stringtab .
or
Use below function module inorder to convert as string from a given internal table .
CALL FUNCTION 'SCMS_TEXT_TO_XSTRING'
EXPORTING
FIRST_LINE = 0
LAST_LINE = 0
MIMETYPE = ' '
IMPORTING
BUFFER = lv_XSTRING
TABLES
TEXT_TAB = LT_TEXT_OUT
EXCEPTIONS
FAILED = 1
OTHERS = 2
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
rgds
anver
‎2006 Nov 14 12:58 PM
Hi,
I just have look at this FM. It needs INPUT_LENGTH as input. Wherre do I get it ?? Will strlen() works for byte stream ??
Thanks
John
‎2006 Nov 14 2:24 PM
Hi,
u this function module like this
TYPES : BEGIN OF TY_TEXT,
TEXT_FIELD(1000) TYPE C,
END OF TY_TEXT.
TYPES : BEGIN OF TY_BINARY,
BINARY_FIELD(1000) TYPE C,
END OF TY_BINARY.
DATA : LT_BINARY type table of TY_BINARY with header line.
DATA : LT_TEXT_OUT type table of TY_TEXT with header line.
Convert binary to text.
CALL FUNCTION 'SCMS_BINARY_TO_TEXT'
EXPORTING
INPUT_LENGTH = 100
FIRST_LINE = 0
LAST_LINE = 0
APPEND_TO_TABLE = ' '
MIMETYPE = ' '
WRAP_LINES = 'X'
IMPORTING
OUTPUT_LENGTH =
TABLES
BINARY_TAB = LT_BINARY
TEXT_TAB = LT_TEXT_OUT
EXCEPTIONS
FAILED = 1
OTHERS = 2
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.