‎2007 Oct 18 2:31 PM
How to create file interface. ?
My requirement is i am getting data from client sap system to create a file ABC.txt .
by using 1) open data set
2) transfer
3) close data set
So how to write code in open data set ,transfer, close data set.
In SAP enterprise system by using
1) open data set
2) read datset
3) close data set.
So how to write code in open data set ,read datset, close data set.
any one can send me Code .
‎2007 Oct 18 2:38 PM
Naveen,
Check the example.....
<a href="http://www.geocities.com/ResearchTriangle/1635/abap32.html">http://www.geocities.com/ResearchTriangle/1635/abap32.html</a>
‎2007 Oct 19 9:56 AM
hi ,
This solution is recommended only if the database table is NOT a standard SAP database table .
i want to solution standard SAP database table .
‎2007 Oct 18 2:39 PM
DATA: file TYPE string VALUE `flights.dat`,
wa TYPE spfli.
FIELD-SYMBOLS TYPE x.
OPEN DATASET file FOR OUTPUT IN BINARY MODE.
SELECT *
FROM spfli
INTO wa.
ASSIGN wa TO CASTING.
TRANSFER TO file.
ENDSELECT.
CLOSE DATASET file.****************************************
DATA: file TYPE string VALUE `flights.dat`,
hex_container TYPE x LENGTH 1000,
len TYPE i.
FIELD-SYMBOLS <spfli> TYPE spfli.
DESCRIBE FIELD <spfli> LENGTH len IN BYTE MODE.
OPEN DATASET file FOR INPUT IN BINARY MODE.
ASSIGN hex_container TO <spfli> CASTING.
DO.
READ DATASET file INTO hex_container MAXIMUM LENGTH len.
IF sy-subrc = 0.
WRITE: / <spfli>-carrid,
<spfli>-connid,
<spfli>-countryfr,
<spfli>-cityfrom,
<spfli>-cityto,
<spfli>-fltime,
<spfli>-distance.
ELSE.
EXIT.
ENDIF.
ENDDO.
CLOSE DATASET file.
‎2007 Oct 19 10:04 AM
hi
good
open dataset->
DATA FNAME(60) VALUE 'myfile'.
DATA: TEXT1(12) VALUE 'abcdefghijkl',
TEXT2(5),
LENG TYPE I.
OPEN DATASET FNAME FOR OUTPUT IN BINARY MODE.
TRANSFER TEXT1 TO FNAME.
CLOSE DATASET FNAME.
OPEN DATASET FNAME FOR INPUT IN BINARY MODE.
DO.
READ DATASET FNAME INTO TEXT2 LENGTH LENG.
WRITE: / SY-SUBRC, TEXT2, LENG.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
ENDDO.
CLOSE DATASET FNAME.
data transfer->
During data transfer, data is transferred from an external system into the SAP system. You can use data transfer when you:
● Transfer data from an external system into an SAP system as it is installed.
● Transfer data regularly from an external system into an SAP system. Example: If data for some departments in your company is input using a system other than the SAP system, you can still integrate this data in the SAP system. To do this, you export the data from the external system and use a data transfer method to import it into the SAP system.
http://help.sap.com/saphelp_nw04s/helpdata/en/fa/097008543b11d1898e0000e8322d00/content.htm
reward point if helpful.
thanks
mrutyun^