Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Error in populating data

Hi,

I am taking the data from a file which is available on application server. During reading of file I am storing the data into an internal table. But the problem is, System is taking the data with '#' while passing the data to internal table. Means it is not treating # as a next column. For example if the table line's (file) contains "3#78#N456#78945#" data system is passing it to internal table in the following format (itab-field1 = '3', itab-field2 = '#78' itab-fld3 = '#N456' and so on..

Pls suggest me how to handle it. I am using the following code for updating the table.

data : begin of t_itab occurs 0,

fld1(1),

fld2(3),

fld3(4),

fld4(5),

....

....

fld50(5),

end of t_itab.

OPEN DATASET V_FILE IN TEXT MODE encoding DEFAULT .

IF SY-SUBRC = 0.

DO.

READ DATASET V_FILE INTO t_itab.

IF SY-SUBRC <> 0.

EXIT.

ENDIF.

APPEND T_ITAB.

CLEAR T_ITAB.

ENDDO.

ELSE.

WRITE: / 'Error in open file'.

ENDIF.

CLOSE DATASET v_file.

Note : We do't know how many fields are available in the txt file on application server.. so we are assuming that file can contains upto 50 fields that's why I have declared 50 fields in internal table.

pls suggest something.

Thanks,

Tags:

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question