09-06-2007 3:17 PM
plz tell me lists of Functions to upload UNIX tab-delimited file in the database table
09-06-2007 3:19 PM
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
09-06-2007 3:21 PM
is this is the only function needed till the file data is uploaded in the database table
i think some more are needed
09-06-2007 3:26 PM
Hi Karan,
which type of database table?
own like Z... or SAP-tables.
regards, Dieter
09-06-2007 3:31 PM
ya i have to transfer UNIX file (tab-delimited) contents to a normal ABAP table
like ZCBU
Message was edited by:
Karan Chopra
09-06-2007 3:39 PM
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.
09-06-2007 3:39 PM
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
09-11-2007 2:04 PM
09-11-2007 2:06 PM
Upload? Upload from presentation server? Application server?
To split the record at tab into single fields use ABAP command SPLIT