Tuesday, December 21, 2010
REPORT ztest_program.
DATA: BEGIN OF it_t001 OCCURS 0,
bukrs TYPE t001-bukrs,
butxt TYPE t001-butxt,
ort01 TYPE t001-ort01,
land1 TYPE t001-land1,
waers TYPE t001-waers,
spras TYPE t001-spras,
ktopl TYPE t001-ktopl,
waabw TYPE t001-waabw,
END OF it_t001.
DATA: BEGIN OF it_app_file OCCURS 0,
data TYPE string,
END OF it_app_file.
CLASS cl_abap_char_utilities DEFINITION LOAD.
CONSTANTS:hor_tab  TYPE c VALUE cl_abap_char_utilities=>horizontal_tab.
PARAMETERS : p_file(150) TYPE c.
START-OF-SELECTION.
"Open file for reading
OPEN DATASET p_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc EQ 0.
DO.
READ DATASET p_file INTO it_app_file-data.
IF it_app_file IS INITIAL.
"If file ends or if does not have data
EXIT.
ELSE.
"Splitting TAB delimited data into into internal table
SPLIT it_app_file-data AT hor_tab INTO it_t001-bukrs
it_t001-butxt
it_t001-ort01
it_t001-land1
it_t001-waers
it_t001-spras
it_t001-ktopl
it_t001-waabw.
APPEND it_t001.
CLEAR  it_t001.
ENDIF.
ENDDO.
ENDIF.
"close file
CLOSE DATASET p_file.
LOOP AT it_t001.
WRITE:/ it_t001-bukrs,
it_t001-butxt,
it_t001-ort01,
it_t001-land1,
it_t001-waers,
it_t001-spras,
it_t001-ktopl,
it_t001-waabw.
ENDLOOP.

0 comments:

Post a Comment

Your useful comments, suggestions are appreciated.Your comments are moderated.

Followers

Contact Form

Name

Email *

Message *

Web Dynpro ABAP Book

An SAP Consultant

Follow US


Want to Contribute ?

If you are interested in writing about the new stuff you learn everyday while working, please write to the.sap.consultants@gmail.com.

Click on Contribution for more details.