Skip to Content
0
Former Member
Jan 13, 2015 at 08:38 AM

any alternative for this codding.

47 Views

hello Tech Experts,

I'm developing a simple application in wd for uploading text file into ztable. I've found some sources to implement, I had a doubt in the following code



CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'
EXPORTING
in_xstring = l_xstring
IMPORTING
out_string = l_string.

SPLIT l_string AT cl_abap_char_utilities=>newline INTO TABLE i_data.

* Bind With table Element.

LOOP AT i_data INTO l_string.

SPLIT l_string AT cl_abap_char_utilities=>horizontal_tab INTO TABLE fields.

READ TABLE fields INTO lv_field INDEX 1.
fs_table-name = lv_field.

READ TABLE fields INTO lv_field INDEX 2.
fs_table-age = lv_field.

APPEND fs_table TO t_table1.

ENDLOOP.

  lo_nd_sflight = wd_context->get_child_node( 'DATA_TAB' ).
lo_nd_sflight->bind_table( t_table1 ).

this code works fine, But inside the loop we are reading the value field by field using index in this case it has just 2 records, what if they are n number of records. Do I have to use those read statements for 'n' times.

please help me if there is any alternative solution for this.

thank you,

Regards,

Nagendra