Skip to Content
0
Former Member
Aug 24, 2009 at 10:12 AM

error executing read data set

23 Views

Dear all,

i have to read data from dataset using read data set. but i got error in executing this program .i included the code for your reference.

regards,

suresh.

data l_item(100) type c.

data: lv_times type i.

data: p_file1(50).

data: x_item

*Open the .DAT file for reading

open dataset p_file1 for input in text mode encoding utf-8." MESSAGE x_error.

if sy-subrc ne 0.

*An error occured during opening the dataset !

*message 'x_error' type 'S'.

message 'x_error' type 'E'.

  • CLEAR x_error.

endif.

do.

*Read the .DAT file into an internal table

read dataset p_file1 into l_item.

if sy-subrc eq 0.

*split the records into data fields based on delimiter ','

*then append the current record to an internal table

split l_item at ',' into

x_item-inv_item_id

x_item-intl_aa_nbr

x_item-intl_pba_nbr

x_item-intl_ta_nbr

x_item-intl_product_code

x_item-descr254

x_item-intl_stck_id

x_item-awr_disallowed_flg

x_item-returnable_flg

x_item-fulfillment_flg

x_item-refund_only_flg

x_item-prod_returnable_flg

x_item-stock_cat_id.

append x_item to i_item.

clear x_item.

lv_times = lv_times + 1.

if lv_times = 100.

process records here.

clear x_items.

refresh x_items.

endif.

else.

*Data was read and the end of the file was reached

message i006.

exit.

endif.

enddo.