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: 

Functions to upload UNIX tab-delimited file

Karan_Chopra_
Active Participant
0 Kudos

plz tell me lists of Functions to upload UNIX tab-delimited file in the database table

8 REPLIES 8

amit_khare
Active Contributor
0 Kudos

You have to use OPEN DATASET to read the file from the server.

Refer this link for the same -

http://www.sapdevelopment.co.uk/file/file_uptabsap.htm

Regards,

Amit

<b><REMOVED BY MODERATOR></b>

Message was edited by:

Alvaro Tejada Galindo

Karan_Chopra_
Active Participant
0 Kudos

is this is the only function needed till the file data is uploaded in the database table

i think some more are needed

Former Member
0 Kudos

Hi Karan,

which type of database table?

own like Z... or SAP-tables.

regards, Dieter

Karan_Chopra_
Active Participant
0 Kudos

ya i have to transfer UNIX file (tab-delimited) contents to a normal ABAP table

like ZCBU

Message was edited by:

Karan Chopra

0 Kudos

HI,

data : itab like standard table of ZCBU.

ld_file = p_infile.

OPEN DATASET ld_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.

IF sy-subrc NE 0.

ELSE.

DO.

CLEAR: wa_string, wa_uploadtxt.

READ DATASET ld_file INTO wa_string.

IF sy-subrc NE 0.

EXIT.

ELSE.

SPLIT wa_string AT con_tab INTO wa_uploadtxt-name1

wa_uploadtxt-name2

wa_uploadtxt-age.

MOVE-CORRESPONDING wa_uploadtxt TO wa_upload.

APPEND wa_upload TO it_record.

ENDIF.

ENDDO.

CLOSE DATASET ld_file.

ENDIF.

loop at it_record.

itab-field1 = it_reocrd-field1.

itab-field2 = it_record-field2.

append itab.

endloop.

*-- Now update the table

modify ZCBU from table itab.

Former Member
0 Kudos

Hi,

try this:

DATA: DATEI_A(30) TYPE C VALUE '/tmp/dat.txt'.

  • declare itsb_read as you need

DATA: ITAB_READ TYPE TABLE OF MARA WITH HEADER LINE.

*

START-OF-SELECTION.

*

OPEN DATASET DATEI_A FOR INPUT IN TEXT MODE.

IF SY-SUBRC NE 0. EXIT. ENDIF.

*

DO.

*

READ DATASET DATEI_A INTO ITAB_READ.

*

IF SY-SUBRC <> 0. EXIT. ENDIF.

*

APPEND ITAB_READ.

*

ENDDO.

*

CLOSE DATASET DATEI_A.

*

regards, Dieter

Karan_Chopra_
Active Participant
0 Kudos

plz help

still in trouble how to exactly use this function

0 Kudos

Upload? Upload from presentation server? Application server?

To split the record at tab into single fields use ABAP command SPLIT