Skip to Content
author's profile photo Former Member
Former Member

error executing read data set

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Aug 24, 2009 at 10:27 AM

    Dear Suresh,

    Use application server to use Read Data set .

    With Regards,

    Baskaran

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 24, 2009 at 10:33 AM

    Hi,

    CLOSE DATASET.

    is missing here.

    Regards,

    Vijay

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 24, 2009 at 10:39 AM

    This message was moderated.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 24, 2009 at 10:44 AM

    This message was moderated.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 24, 2009 at 11:18 AM

    Hi,

    Refer the code to read the data from application server:

    DATA: lv_app_server_file TYPE string.

    lv_app_server_file = pa_afile.

    • To read file from Application server

    OPEN DATASET lv_app_server_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.

    DO.

    READ DATASET lv_app_server_file INTO wa_file_data.

    IF sy-subrc = 0.

    APPEND wa_file_data TO gi_file_data.

    ELSE.

    EXIT.

    ENDIF.

    ENDDO.

    CLOSE DATASET lv_app_server_file.

    Hope it helps.

    Regards,

    Rajesh Kumar

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.