Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding tab delimiter

Former Member
0 Kudos

hi..

my problem is..i have to take the contents of the flatfile which is in the application server and put the data in flat file into a database.I am able to put the contents into the database table but the problem is the tab delimiter. The whole data in the flat file comes in a single column in the data base table.

my code is,

DATA: STR(10000).

constants: con_tab value cl_abap_char_utilities=>HORIZONTAL_TAB.

data: begin of itab1 occurs 0,

ZCUSTID LIKE ZCUST_MASTER2-ZCUSTID,

ZCUSTNAME LIKE ZCUST_MASTER2-ZCUSTNAME,

ZADDR LIKE ZCUST_MASTER2-ZADDR,

ZCITY LIKE ZCUST_MASTER2-ZCITY,

ZSTATE LIKE ZCUST_MASTER2-ZSTATE,

ZCOUNTRY LIKE ZCUST_MASTER2-ZCOUNTRY,

ZPHONE LIKE ZCUST_MASTER2-ZPHONE,

ZEMAIL LIKE ZCUST_MASTER2-ZEMAIL,

ZFAX LIKE ZCUST_MASTER2-ZFAX,

ZSTAT LIKE ZCUST_MASTER2-ZSTAT,

end of itab1.

data : sr_dir TYPE dxfields-longpath VALUE 'E:\usr\sap\ECC\SYS\gen\dbg'.

data: FILE1 LIKE DXFIELDS-LONGPATH.

CALL FUNCTION 'F4_DXFILENAME_TOPRECURSION'

EXPORTING

I_LOCATION_FLAG = 'A'

I_SERVER = ''

I_PATH = sr_dir

FILEMASK = '.'

FILEOPERATION = 'R'

IMPORTING

  • O_LOCATION_FLAG =

  • O_SERVER =

O_PATH = FILE1

  • ABEND_FLAG =

  • EXCEPTIONS

  • RFC_ERROR = 1

  • ERROR_WITH_GUI = 2

  • OTHERS = 3

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

OPEN DATASET FILE1 FOR INPUT IN TEXT MODE ENCODING DEFAULT.

do.

READ DATASET FILE1 INTO str.

if sy-subrc ne 0.

EXIT.

else.

split str at con_tab into itab1-zcustid itab1-zcustname itab1-zaddr itab1-zcity itab1-zstate itab1-zcountry itab1-zphone itab1-zemail itab1-zfax itab1-zstat.

append itab1.

update zcust_master7 from itab1.

modify zcust_master7 from itab1.

endif.

enddo.

CLOSE DATASET FILE1.

please help me...

Thanks in advance..

Edited by: arunsri bs on Dec 27, 2007 7:57 AM

2 REPLIES 2

Former Member
0 Kudos

Hai,

declare

constants: con_tab(1) type c value '#'.

instead of declaring constants: con_tab value cl_abap_char_utilities=>HORIZONTAL_TAB.

0 Kudos

Thanks for the reply..i got the output