Application Development and Automation 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: 
Read only

Export Screen to Flat Text file

Former Member
0 Likes
1,634

Hello,

I'm very new in SAP and need to modify a little program.

I would like to export the current screen in a flat text file.

The file must be stored on the SAP server ( /usr/sap/data/bel) so not on my local harddrive.

I searched and found found functions like WS_download and GUI_download, but I'm not sure how to use them. Can somebody help me please?

Curent Code of my report:

REPORT ZAT_CLRDEP01.

  • Tables declaration

tables : vbrp,bkpf,bseg.

  • Data declaration

data: begin of itab1 occurs 0,

vbeln like vbrp-vbeln,

arktx like vbrp-arktx,

belnr like bkpf-belnr,

end of itab1.

data: begin of itab2 occurs 0,

vbeln like vbrp-vbeln,

arktx like vbrp-arktx,

belnr like bkpf-belnr,

end of itab2.

data: begin of itab3 occurs 0,

kunnr like bseg-kunnr,

name1 like kna1-name1,

vbeln like vbrp-vbeln,

zfbdt like bseg-zfbdt,

belnr like bkpf-belnr,

augcp like bseg-augcp,

augbl like bseg-augbl,

arktx like vbrp-arktx,

end of itab3.

data: begin of itab4 occurs 0,

kunnr like bseg-kunnr,

name1 like kna1-name1,

vbeln like vbrp-vbeln,

zfbdt like bseg-zfbdt,

augcp like bseg-augcp,

augbl like bseg-augbl,

arktx like vbrp-arktx,

pswbt like bseg-pswbt,

end of itab4.

data: vbeln_tst like vbrp-vbeln.

  • Selections

parameters accgrp like vbrp-ktgrm default '03' obligatory.

parameters compcde like bkpf-bukrs default 'LOI' obligatory.

select-options: billdoc for vbrp-vbeln.

select-options: customer for bseg-kunnr.

select-options: fiscyear for bkpf-gjahr.

select-options: reldate for bseg-augcp.

select-options amount for bseg-pswbt.

INITIALIZATION.

fiscyear-low = sy-datum(4).

fiscyear-high = sy-datum(4).

append fiscyear.

reldate-high = sy-datum.

append reldate.

amount-low = '100'.

amount-high = '2000'.

append amount.

START-OF-SELECTION.

refresh: itab1,itab2,itab3,itab4.

clear : itab1,itab2,itab3,itab4.

clear: vbeln_tst.

select * into corresponding fields of table itab1

from vbrp inner join bkpf

on vbrpmandt = bkpfmandt

and vbrpvbeln = bkpfxblnr

where vbrp~ktgrm = accgrp

and bkpf~bukrs = compcde

and bkpf~gjahr = fiscyear.

loop at itab1.

if itab1-vbeln ne vbeln_tst.

move itab1-belnr to itab2-belnr.

move itab1-vbeln to itab2-vbeln.

move itab1-arktx to itab2-arktx.

append itab2.

endif.

vbeln_tst = itab1-vbeln.

endloop.

loop at itab2.

select * from bseg

where bukrs = compcde

and belnr = itab2-belnr

and gjahr = fiscyear

and buzei = '001'

and augcp in reldate

and augbl ne ''

and vbeln in billdoc

and kunnr in customer.

if sy-subrc = 0.

move itab2-belnr to itab3-belnr.

move bseg-kunnr to itab3-kunnr.

select single name1 from kna1

into itab3-name1

where kunnr = itab3-kunnr.

move itab2-vbeln to itab3-vbeln.

move bseg-zfbdt to itab3-zfbdt.

move bseg-augcp to itab3-augcp.

move bseg-augbl to itab3-augbl.

move itab2-arktx to itab3-arktx.

append itab3.

endif.

endselect.

endloop.

loop at itab3.

select * from bseg

where bukrs = compcde

and belnr = itab3-belnr

and gjahr = fiscyear

and hkont = '0000488600'

and pswbt in amount.

if sy-subrc = 0.

move itab3-kunnr to itab4-kunnr.

move itab3-name1 to itab4-name1.

move itab3-vbeln to itab4-vbeln.

move itab3-zfbdt to itab4-zfbdt.

move itab3-augcp to itab4-augcp.

move itab3-augbl to itab4-augbl.

move itab3-arktx to itab4-arktx.

move bseg-pswbt to itab4-pswbt.

append itab4.

endif.

endselect.

endloop.

END-OF-SELECTION.

sort itab4 by kunnr.

loop at itab4.

at first.

write:/ ' customer ','billing doc.',

'Billing date',' Release date','Release doc.',

' material ','G/L amount'.

endat.

write:/ itab4-name1.

write at 36 itab4-vbeln.

write at 47 itab4-zfbdt.

write at 61 itab4-augcp.

write at 74 itab4-augbl.

write at 88 itab4-arktx.

write at 127 itab4-pswbt.

endloop.

Thanks in advance!

Kindly regards,

Nico

1 ACCEPTED SOLUTION
Read only

Simha_
Product and Topic Expert
Product and Topic Expert
0 Likes
1,515

Hi,

To download on the hard drive...

Use Gui_Download f.M.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

FILENAME = <fullpath>

FILETYPE = 'BIN'

TABLES

DATA_TAB = <your internal table>

EXCEPTIONS

FILE_WRITE_ERROR = 1

NO_BATCH = 2

GUI_REFUSE_FILETRANSFER = 3

INVALID_TYPE = 4

NO_AUTHORITY = 5

UNKNOWN_ERROR = 6

HEADER_NOT_ALLOWED = 7

SEPARATOR_NOT_ALLOWED = 8

FILESIZE_NOT_ALLOWED = 9

HEADER_TOO_LONG = 10

DP_ERROR_CREATE = 11

DP_ERROR_SEND = 12

DP_ERROR_WRITE = 13

UNKNOWN_DP_ERROR = 14

ACCESS_DENIED = 15

DP_OUT_OF_MEMORY = 16

DISK_FULL = 17

DP_TIMEOUT = 18

FILE_NOT_FOUND = 19

DATAPROVIDER_EXCEPTION = 20

CONTROL_FLUSH_ERROR = 21

OTHERS = 22.

to download on the application server...

perform as ravi said....

Cheers,

Simha.

Hello,

I'm very new in SAP and need to modify a little program.

I would like to export the current screen in a flat text file.

The file must be stored on the SAP server ( /usr/sap/data/bel) so not on my local harddrive.

I searched and found found functions like WS_download and GUI_download, but I'm not sure how to use them. Can somebody help me please?

Curent Code of my report:

REPORT ZAT_CLRDEP01.

  • Tables declaration

tables : vbrp,bkpf,bseg.

  • Data declaration

data: begin of itab1 occurs 0,

vbeln like vbrp-vbeln,

arktx like vbrp-arktx,

belnr like bkpf-belnr,

end of itab1.

data: begin of itab2 occurs 0,

vbeln like vbrp-vbeln,

arktx like vbrp-arktx,

belnr like bkpf-belnr,

end of itab2.

data: begin of itab3 occurs 0,

kunnr like bseg-kunnr,

name1 like kna1-name1,

vbeln like vbrp-vbeln,

zfbdt like bseg-zfbdt,

belnr like bkpf-belnr,

augcp like bseg-augcp,

augbl like bseg-augbl,

arktx like vbrp-arktx,

end of itab3.

data: begin of itab4 occurs 0,

kunnr like bseg-kunnr,

name1 like kna1-name1,

vbeln like vbrp-vbeln,

zfbdt like bseg-zfbdt,

augcp like bseg-augcp,

augbl like bseg-augbl,

arktx like vbrp-arktx,

pswbt like bseg-pswbt,

end of itab4.

data: vbeln_tst like vbrp-vbeln.

  • Selections

parameters accgrp like vbrp-ktgrm default '03' obligatory.

parameters compcde like bkpf-bukrs default 'LOI' obligatory.

select-options: billdoc for vbrp-vbeln.

select-options: customer for bseg-kunnr.

select-options: fiscyear for bkpf-gjahr.

select-options: reldate for bseg-augcp.

select-options amount for bseg-pswbt.

INITIALIZATION.

fiscyear-low = sy-datum(4).

fiscyear-high = sy-datum(4).

append fiscyear.

reldate-high = sy-datum.

append reldate.

amount-low = '100'.

amount-high = '2000'.

append amount.

START-OF-SELECTION.

refresh: itab1,itab2,itab3,itab4.

clear : itab1,itab2,itab3,itab4.

clear: vbeln_tst.

select * into corresponding fields of table itab1

from vbrp inner join bkpf

on vbrpmandt = bkpfmandt

and vbrpvbeln = bkpfxblnr

where vbrp~ktgrm = accgrp

and bkpf~bukrs = compcde

and bkpf~gjahr = fiscyear.

loop at itab1.

if itab1-vbeln ne vbeln_tst.

move itab1-belnr to itab2-belnr.

move itab1-vbeln to itab2-vbeln.

move itab1-arktx to itab2-arktx.

append itab2.

endif.

vbeln_tst = itab1-vbeln.

endloop.

loop at itab2.

select * from bseg

where bukrs = compcde

and belnr = itab2-belnr

and gjahr = fiscyear

and buzei = '001'

and augcp in reldate

and augbl ne ''

and vbeln in billdoc

and kunnr in customer.

if sy-subrc = 0.

move itab2-belnr to itab3-belnr.

move bseg-kunnr to itab3-kunnr.

select single name1 from kna1

into itab3-name1

where kunnr = itab3-kunnr.

move itab2-vbeln to itab3-vbeln.

move bseg-zfbdt to itab3-zfbdt.

move bseg-augcp to itab3-augcp.

move bseg-augbl to itab3-augbl.

move itab2-arktx to itab3-arktx.

append itab3.

endif.

endselect.

endloop.

loop at itab3.

select * from bseg

where bukrs = compcde

and belnr = itab3-belnr

and gjahr = fiscyear

and hkont = '0000488600'

and pswbt in amount.

if sy-subrc = 0.

move itab3-kunnr to itab4-kunnr.

move itab3-name1 to itab4-name1.

move itab3-vbeln to itab4-vbeln.

move itab3-zfbdt to itab4-zfbdt.

move itab3-augcp to itab4-augcp.

move itab3-augbl to itab4-augbl.

move itab3-arktx to itab4-arktx.

move bseg-pswbt to itab4-pswbt.

append itab4.

endif.

endselect.

endloop.

END-OF-SELECTION.

sort itab4 by kunnr.

loop at itab4.

at first.

write:/ ' customer ','billing doc.',

'Billing date',' Release date','Release doc.',

' material ','G/L amount'.

endat.

write:/ itab4-name1.

write at 36 itab4-vbeln.

write at 47 itab4-zfbdt.

write at 61 itab4-augcp.

write at 74 itab4-augbl.

write at 88 itab4-arktx.

write at 127 itab4-pswbt.

endloop.

Thanks in advance!

Kindly regards,

Nico

12 REPLIES 12
Read only

Former Member
0 Likes
1,515

Hi Nico,

The function modules you see will not server the purpose.

you should use the OPEN dataset /transfer/ close dataset commands.

make the follwing changes:

<b>open dataset <dataset name> for output in text mode.</b>

if sy-subrc = 0.

loop at itab4.

at first.

write:/ ' customer ','billing doc.',

'Billing date',' Release date','Release doc.',

' material ','G/L amount'.

endat.

write:/ itab4-name1.

write at 36 itab4-vbeln.

write at 47 itab4-zfbdt.

write at 61 itab4-augcp.

write at 74 itab4-augbl.

write at 88 itab4-arktx.

write at 127 itab4-pswbt.

<b>transfer itab4 to <dataset name>.</b>

endloop.

<b>close dataset <dataset name>.

endif.</b>

REgards,

Ravi

Read only

0 Likes
1,515

Hello,

Thanks for your help and fast reaction, I added the 'open dataset' but probably made some minor error:

I'm getting field "result" (name of my text file) is unknown. It is neither in one of the specified tables or defined by a 'DATA' statement

Currently have following code:

************************************************************************

  • Objet du programme : *

  • Recherche de documents de facturation SD sur base de *

  • l' "account assignment group" de l'article *

  • Stocker ces valeurs dans une table interne afin *

  • de retrouver les pièces comptables correspondantes. *

  • Afficher le N° du document de facturation, celui de la *

  • pièce comptable, la date de release du release document. *

************************************************************************

REPORT ZAT_CLRDEP01.

  • Tables declaration

tables : vbrp,bkpf,bseg.

  • Data declaration

data: begin of itab1 occurs 0,

vbeln like vbrp-vbeln,

arktx like vbrp-arktx,

belnr like bkpf-belnr,

end of itab1.

data: begin of itab2 occurs 0,

vbeln like vbrp-vbeln,

arktx like vbrp-arktx,

belnr like bkpf-belnr,

end of itab2.

data: begin of itab3 occurs 0,

kunnr like bseg-kunnr,

name1 like kna1-name1,

vbeln like vbrp-vbeln,

zfbdt like bseg-zfbdt,

belnr like bkpf-belnr,

augcp like bseg-augcp,

augbl like bseg-augbl,

arktx like vbrp-arktx,

end of itab3.

data: begin of itab4 occurs 0,

kunnr like bseg-kunnr,

name1 like kna1-name1,

vbeln like vbrp-vbeln,

zfbdt like bseg-zfbdt,

augcp like bseg-augcp,

augbl like bseg-augbl,

arktx like vbrp-arktx,

pswbt like bseg-pswbt,

end of itab4.

data: vbeln_tst like vbrp-vbeln.

  • Selections

parameters accgrp like vbrp-ktgrm default '03' obligatory.

parameters compcde like bkpf-bukrs default 'LOI' obligatory.

select-options: billdoc for vbrp-vbeln.

select-options: customer for bseg-kunnr.

select-options: fiscyear for bkpf-gjahr.

select-options: reldate for bseg-augcp.

select-options amount for bseg-pswbt.

INITIALIZATION.

fiscyear-low = sy-datum(4).

fiscyear-high = sy-datum(4).

append fiscyear.

reldate-high = sy-datum.

append reldate.

amount-low = '100'.

amount-high = '2000'.

append amount.

START-OF-SELECTION.

refresh: itab1,itab2,itab3,itab4.

clear : itab1,itab2,itab3,itab4.

clear: vbeln_tst.

select * into corresponding fields of table itab1

from vbrp inner join bkpf

on vbrp~mandt = bkpf~mandt

and vbrp~vbeln = bkpf~xblnr

where vbrp~ktgrm = accgrp

and bkpf~bukrs = compcde

and bkpf~gjahr = fiscyear.

loop at itab1.

if itab1-vbeln ne vbeln_tst.

move itab1-belnr to itab2-belnr.

move itab1-vbeln to itab2-vbeln.

move itab1-arktx to itab2-arktx.

append itab2.

endif.

vbeln_tst = itab1-vbeln.

endloop.

loop at itab2.

select * from bseg

where bukrs = compcde

and belnr = itab2-belnr

and gjahr = fiscyear

and buzei = '001'

and augcp in reldate

and augbl ne ''

and vbeln in billdoc

and kunnr in customer.

if sy-subrc = 0.

move itab2-belnr to itab3-belnr.

move bseg-kunnr to itab3-kunnr.

select single name1 from kna1

into itab3-name1

where kunnr = itab3-kunnr.

move itab2-vbeln to itab3-vbeln.

move bseg-zfbdt to itab3-zfbdt.

move bseg-augcp to itab3-augcp.

move bseg-augbl to itab3-augbl.

move itab2-arktx to itab3-arktx.

append itab3.

endif.

endselect.

endloop.

loop at itab3.

select * from bseg

where bukrs = compcde

and belnr = itab3-belnr

and gjahr = fiscyear

and hkont = '0000488600'

and pswbt in amount.

if sy-subrc = 0.

move itab3-kunnr to itab4-kunnr.

move itab3-name1 to itab4-name1.

move itab3-vbeln to itab4-vbeln.

move itab3-zfbdt to itab4-zfbdt.

move itab3-augcp to itab4-augcp.

move itab3-augbl to itab4-augbl.

move itab3-arktx to itab4-arktx.

move bseg-pswbt to itab4-pswbt.

append itab4.

endif.

endselect.

endloop.

END-OF-SELECTION.

sort itab4 by kunnr.

************************************************************************

  • EXPORT OUTPUT TO FLAT TEXT FILE : *

************************************************************************

open dataset result for output in text mode.

if sy-subrc = 0.

loop at itab4.

at first.

write:/ ' customer ','billing doc.',

'Billing date',' Release date','Release doc.',

' material ','G/L amount'.

endat.

write:/ itab4-name1.

write at 36 itab4-vbeln.

write at 47 itab4-zfbdt.

write at 61 itab4-augcp.

write at 74 itab4-augbl.

write at 88 itab4-arktx.

write at 127 itab4-pswbt.

transfer itab4 to result.

endloop.

close dataset result.

endif.

Thank you!

Regards,

Nico

Read only

Simha_
Product and Topic Expert
Product and Topic Expert
0 Likes
1,516

Hi,

To download on the hard drive...

Use Gui_Download f.M.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

FILENAME = <fullpath>

FILETYPE = 'BIN'

TABLES

DATA_TAB = <your internal table>

EXCEPTIONS

FILE_WRITE_ERROR = 1

NO_BATCH = 2

GUI_REFUSE_FILETRANSFER = 3

INVALID_TYPE = 4

NO_AUTHORITY = 5

UNKNOWN_ERROR = 6

HEADER_NOT_ALLOWED = 7

SEPARATOR_NOT_ALLOWED = 8

FILESIZE_NOT_ALLOWED = 9

HEADER_TOO_LONG = 10

DP_ERROR_CREATE = 11

DP_ERROR_SEND = 12

DP_ERROR_WRITE = 13

UNKNOWN_DP_ERROR = 14

ACCESS_DENIED = 15

DP_OUT_OF_MEMORY = 16

DISK_FULL = 17

DP_TIMEOUT = 18

FILE_NOT_FOUND = 19

DATAPROVIDER_EXCEPTION = 20

CONTROL_FLUSH_ERROR = 21

OTHERS = 22.

to download on the application server...

perform as ravi said....

Cheers,

Simha.

Read only

Former Member
0 Likes
1,515

Hi nico,

here a short example to do download/upoad and read/transfer.

TABLES: MARA.

*

DATA: DATEI_A(30) TYPE C VALUE '/transfer/sap/matnr.txt'.

DATA: DATEI_PC TYPE STRING VALUE 'D:\MATNR.TXT'.

*

TYPES: BEGIN OF IMARA,

MATNR LIKE MARA-MATNR,

MTART LIKE MARA-MATNR,

END OF IMARA.

*

DATA: ITAB TYPE TABLE OF IMARA WITH HEADER LINE.

DATA: ITAB_READ TYPE TABLE OF IMARA WITH HEADER LINE.

DATA: ITAB_UPLOAD TYPE TABLE OF IMARA WITH HEADER LINE.

*

START-OF-SELECTION.

*

SELECT MATNR MTART INTO TABLE ITAB FROM MARA UP TO 10 ROWS.

*

PERFORM DATEI_AUSGEBEN.

PERFORM DATEI_EINLESEN.

PERFORM DATEI_DOWNLOAD.

PERFORM DATEI_UPLOAD.

*

************************************************************************

FORM DATEI_AUSGEBEN.

*

OPEN DATASET DATEI_A FOR OUTPUT IN TEXT MODE.

IF SY-SUBRC NE 0. MESSAGE E001. STOP. ENDIF.

*

LOOP AT ITAB.

*

TRANSFER ITAB TO DATEI_A.

*

ENDLOOP.

*

CLOSE DATASET DATEI_A.

IF SY-SUBRC NE 0. MESSAGE E001. STOP. ENDIF.

*

ENDFORM. "DATEI_AUSGEBEN

************************************************************************

FORM DATEI_EINLESEN.

*

*

OPEN DATASET DATEI_A FOR INPUT IN TEXT MODE.

IF SY-SUBRC NE 0. MESSAGE E001. STOP. ENDIF.

*

DO.

*

READ DATASET DATEI_A INTO ITAB_READ.

*

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

*

APPEND ITAB_READ.

*

ENDDO.

*

CLOSE DATASET DATEI_A.

*

IF SY-SUBRC NE 0. MESSAGE E001. STOP. ENDIF.

*

WRITE: / 'INPUT:'.

LOOP AT ITAB_READ. WRITE: / ITAB_READ. ENDLOOP.

*

ENDFORM. "DATEI_EINLESEN

************************************************************************

FORM DATEI_DOWNLOAD.

  • Datei downloaden

CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD

EXPORTING

FILENAME = DATEI_PC

FILETYPE = 'ASC'

CHANGING

DATA_TAB = ITAB[]

EXCEPTIONS

FILE_WRITE_ERROR = 1

NO_BATCH = 2

GUI_REFUSE_FILETRANSFER = 3

INVALID_TYPE = 4

NO_AUTHORITY = 5

UNKNOWN_ERROR = 6

HEADER_NOT_ALLOWED = 7

SEPARATOR_NOT_ALLOWED = 8

FILESIZE_NOT_ALLOWED = 9

HEADER_TOO_LONG = 10

DP_ERROR_CREATE = 11

DP_ERROR_SEND = 12

DP_ERROR_WRITE = 13

UNKNOWN_DP_ERROR = 14

ACCESS_DENIED = 15

DP_OUT_OF_MEMORY = 16

DISK_FULL = 17

DP_TIMEOUT = 18

FILE_NOT_FOUND = 19

DATAPROVIDER_EXCEPTION = 20

CONTROL_FLUSH_ERROR = 21

NOT_SUPPORTED_BY_GUI = 22

ERROR_NO_GUI = 23

OTHERS = 24.

*

IF SY-SUBRC NE 0. MESSAGE E001. STOP. ENDIF.

*

ENDFORM. "DATEI_DOWNLOAD

***********************************************************************

FORM DATEI_UPLOAD.

*

CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD

EXPORTING

FILENAME = DATEI_PC

FILETYPE = 'ASC'

CHANGING

DATA_TAB = ITAB_UPLOAD[]

EXCEPTIONS

FILE_OPEN_ERROR = 1

FILE_READ_ERROR = 2

NO_BATCH = 3

GUI_REFUSE_FILETRANSFER = 4

INVALID_TYPE = 5

NO_AUTHORITY = 6

UNKNOWN_ERROR = 7

BAD_DATA_FORMAT = 8

HEADER_NOT_ALLOWED = 9

SEPARATOR_NOT_ALLOWED = 10

HEADER_TOO_LONG = 11

UNKNOWN_DP_ERROR = 12

ACCESS_DENIED = 13

DP_OUT_OF_MEMORY = 14

DISK_FULL = 15

DP_TIMEOUT = 16

NOT_SUPPORTED_BY_GUI = 17

ERROR_NO_GUI = 18

OTHERS = 19.

*

IF SY-SUBRC NE 0. MESSAGE E001. STOP. ENDIF.

*

WRITE: / 'UPLOAD:'.

LOOP AT ITAB_UPLOAD. WRITE: / ITAB_UPLOAD. ENDLOOP.

*

ENDFORM. "datei_upload

regards, dieter

Read only

Former Member
0 Likes
1,515

You need to use OPEN DATASET to store file in presentation server.

DATA: G_FILE(150) value '/usr/sap/data/bel'.

IF NOT I_TAB[] IS INITIAL.

CONCATENATE: GFILE '/' FILE INTO G_FILE.

OPEN DATASET G_FILE FOR OUTPUT IN TEXT MODE

ENCODING DEFAULT

IGNORING CONVERSION ERRORS.

IF SY-SUBRC = 0.

LOOP AT I_TAB.

CONCATENATE I_TAB-BUKRS ',' I_TAB-EBELN ','

I_TAB-BLDAT ',' I_TAB-XBLNR ','

I_TAB-LIFNR ',' I_TAB-AMOUNT ','

I_TAB-CURR ',' I_TAB-BUSAREA ','

I_TAB-BKTXT ',' I_TAB-DMBTR ','

I_TAB-MENGE ',' I_TAB-SRNO INTO RECORD.

TRANSFER RECORD TO G_FILE.

L_FL = 'X'.

ENDLOOP.

CLOSE DATASET G_FILE.

ENDIF.

ENDIF.

here pass filename to FILE

Read only

Former Member
0 Likes
1,515

Hello,

Make use of this code:


CALL FUNCTION 'RS_DYNPRO_DOWNLOAD'
EXPORTING
HEADER = HEADER
DESCRIPT = ' '
FILE = FILE
TABLES
FIELDS = FIELDS
FLOWLOGIC = FLOWLOGIC.

If useful reward.

Vasanth

Read only

Former Member
0 Likes
1,515

hi nico,

u need to use the stmts..

opening the dataset for writing

OPEN DATASET <FNAME> FOR OUTPUT IN TEXT MODE.

transferring data

LOOP AT ITAB.

TRANSFER ITAB TO <FNAME>.

ENDLOOP.

Closing the dataset.

CLOSE DATASET <FNAME>.

regards,

priya.

Read only

Former Member
0 Likes
1,515

Hi Nico,

Problem solved?

Regards, Dieter

Read only

0 Likes
1,515

Hello Dieter,

First I would like to thank you for your help!

I'm very close however my problem is not yet solved

Since I need to export the file on the applicationsserver, I will probably need to use the 'open dataset' command. (I posted my current code, with dataset in the post above this one)

I'm not sure what I did wrong, sorry nut very new for me.

Thanks,

Read only

0 Likes
1,515

Hi Nico,

i don't see the transfer statement, i think you use write??

try this:

FORM DATEI_AUSGEBEN.

*

OPEN DATASET DATEI_A FOR OUTPUT IN TEXT MODE.

IF SY-SUBRC NE 0. MESSAGE E001. STOP. ENDIF.

*

LOOP AT ITAB.

*

TRANSFER ITAB TO DATEI_A.

*

ENDLOOP.

*

CLOSE DATASET DATEI_A.

IF SY-SUBRC NE 0. MESSAGE E001. STOP. ENDIF.

*

ENDFORM. "DATEI_AUSGEBEN

Regards, Dieter

Read only

0 Likes
1,515

Hello Dieter, Thanks for your help!

I'm getting following error:

"Field "DATEI_A" is unknown. It is either in one of the specified tables nor defined by a "DATA" statement"'

Not sure what to do.

Thanks

Read only

0 Likes
1,515

Hi Nico,

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

*The File on the Application-Server

Look at my above example.

Regards, Dieter