on 10-16-2006 2:28 AM
Hi,
I did a program for transfering data from database tables to a .dat or .txt file on my PC using the dataset concept.
the program runs without error but the data is not downloaded into the file. What can be the problem?
Here is the code.
&----
*& Report ZOPDSETOPV
*&
&----
*&
*&
&----
REPORT ZOPDSETOPV.
TABLES : LFA1, EKKO.
PARAMETERS : FILE(200) TYPE c.
DATA : BEGIN OF ITAB OCCURS 0,
LIFNR LIKE LFA1-LIFNR,
NAME1 LIKE LFA1-NAME1,
EBELN LIKE EKKO-EBELN,
BUKRS LIKE EKKO-BUKRS,
EKORG LIKE EKKO-EKORG,
EKGRP LIKE EKKO-EKGRP,
END OF ITAB.
SELECT LFA1NAME1 EKKOEBELN EKKOBUKRS EKKOEKORG EKKO~EKGRP INTO TABLE
ITAB FROM LFA1 INNER JOIN EKKO ON LFA1LIFNR = EKKOLIFNR.
OPEN DATASET FILE FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
LOOP AT ITAB FROM 1 TO 3.
TRANSFER ITAB TO FILE.
ENDLOOP.
CLOSE DATASET FILE.
Thanks...
reply back to me if u have any queries
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi friend,
u have written
open datase <file> for output in textmode encoding default
but what is the path that u have given for file
check that file path in tcode AL11.
go to AL11 and check whether data has been updated in that specific directory or not. if not just check your program once perfectly(set filepath correctly).
or there may be another reason by default when you run
the system stores all the files in /user/temp
there might be a case of less space.
try for another file path and run the program
check in the directory whether file has been uploaded
or not.
all the best
srinivas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
There is another option to download the data from the Internal table to Local file.
That is using "GUI_DOWNLOAD" Function moldule.
Kindly check the following code:
TABLES : lfa1, ekko.
DATA : BEGIN OF itab OCCURS 0,
lifnr LIKE lfa1-lifnr,
name1 LIKE lfa1-name1,
ebeln LIKE ekko-ebeln,
bukrs LIKE ekko-bukrs,
ekorg LIKE ekko-ekorg,
ekgrp LIKE ekko-ekgrp,
END OF itab.
PARAMETERS : file(200) TYPE c.
SELECT lfa1~name1 ekko~ebeln ekko~bukrs ekko~ekorg ekko~ekgrp INTO TABLE
itab FROM lfa1 INNER JOIN ekko ON lfa1~lifnr = ekko~lifnr.
IF sy-subrc EQ 0.
MOVE file TO i_file.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = i_file
filetype = 'DAT'
write_field_separator = ' '
TABLES
data_tab = itab.
IF sy-subrc NE 0.
MESSAGE 'Error writing File' TYPE 'E'.
EXIT.
ELSEIF sy-subrc IS INITIAL.
WRITE : 'File saved in the location' , i_file.
ENDIF.
ENDIF.
The contents of the Internal table will be moved to the text file in the specified location.
hope this helps!
best regards,
Thangesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
12 | |
11 | |
6 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.