Skip to Content

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

Reading the file from the application server

Hi All,

I have an immediate requeirment,am reading 2 files from the application server one after the other.The first file has 42 entries,once the first file is read the data is getting populated into the int.table t_input_file.While am reading the 2nd file which also has 42 entries,the int.table t_input_file is getting populated along with the 1st file enties, so am getting total of 84 entries in the int.table t_input_file.I need to clear the t_input_file before reading the 2nd file.So how do i proceed with this?Plz help me out as this is an immediate requirement.Code is as below.Points awarded if useful.

DATA: tx_record(235) TYPE c,

c_tab(1) TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,

tx_msg(80) TYPE c,

ls_path TYPE zzpath. " File path.

CONCATENATE tx_path

w_file_tbl-name

INTO ls_path.

OPEN DATASET ls_path FOR INPUT MESSAGE tx_msg IN TEXT MODE ENCODING DEFAULT.

IF sy-subrc NE '0'.

*Error in opening file &

MESSAGE e001(zi1) with ls_path.

ENDIF.

DO.

READ DATASET ls_path INTO tx_record.

IF sy-subrc NE 0.

EXIT.

ENDIF.

SPLIT tx_record AT c_tab INTO w_input_file-indic w_input_file-bustr w_input_file-venda

w_input_file-ccode w_input_file-idate w_input_file-refdo

w_input_file-postd w_input_file-invam w_input_file-currk

w_input_file-terms w_input_file-itemt w_input_file-glacc

w_input_file-dcind w_input_file-amdcu w_input_file-sapcc

w_input_file-sapwb w_input_file-iteti.

APPEND w_input_file TO t_input_file.

CLEAR w_input_file.

ENDDO.

Regards,

Indu.

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