Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

xstring to itab

Former Member
0 Kudos

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

2 REPLIES 2

Former Member
0 Kudos

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

athavanraja
Active Contributor
0 Kudos

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.