07-02-2007 9:22 PM
Hi all,
i am using this code.
parameters: p_file type rlgrap-filename.
data: gv_xstr type xstring,
gv_str type string,
gv_bom(2) type x,
gv_encoding type abap_encod,
gv_endian type abap_endia,
conv_obj type ref to cl_abap_conv_in_ce,
GV_NL type c value CL_ABAP_CHAR_UTILITIES=>NEWLINE.
data: gt_text type table of char255,
gs_text type char255.
open dataset p_file for input in binary mode.
read dataset p_file into gv_xstr.
close dataset p_file.
now i want to split this gv_xstr and pass to an itab.
itab contains 20 fields and the flat file has 250 lines.
thanks
madhu
07-03-2007 4:56 AM
Try this...
DO.
READ DATASET P_ITOF INTO FILE .
IF SY-SUBRC NE 0.
EXIT.
ELSE.
SPLIT p_file AT COMMA INTO
ITAB-FIELD1
ITAB-FIELD2
ITAB-FIELD3
ITAB-FIELD4
ITAB-FIELD5
APPEND ITAB
ENDIF.
ENDDO.
Award points.. if its help full
07-03-2007 6:51 AM
data: binary_content type solix_tab.
data: gv_xstr type xstring .
call function 'SCMS_XSTRING_TO_BINARY'
exporting
buffer = gv_xstr
tables
binary_tab = binary_content.