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

Create File

Former Member
0 Likes
661

Hi,

How can i create a file in the app server?? Is there any FM available??

Regards,

Kit

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
625

HI

for XML files

please try with these fms.

UA_UPLOAD_XMLFILE

JIT03_UPLOAD_XML

for direct upload of a file use

Use Tcode CG3Z to upload the file into app server

<b>Reward if usefull</b>

5 REPLIES 5
Read only

Former Member
0 Likes
625

Hi Kit,

You need to use

OPEN DATASET..

There is no FM for the same.

Just search forum and you will get lots of sample code for the same.

Regards,

Atish

Read only

Former Member
0 Likes
625

Hi,

try this fn module,

DOWNLOAD

Read only

Former Member
0 Likes
625

hi,

HI..This is a sample program to create a CSV file. If you require to move this file to the application server, you can use OPEN DATASET...TRANSFER DATASET..etc to move it to the application server.

REPORT zcomma .

  • Open the file using Notepad or open and SaveAs Text file

DATA : BEGIN OF i_output OCCURS 0,

text(3000) TYPE c,

END OF i_output.

DATA: ws_rmwwr(15) TYPE c.

DATA: BEGIN OF i_rbkp OCCURS 0,

belnr LIKE rbkp-belnr,

gjahr LIKE rbkp-gjahr,

blart LIKE rbkp-blart,

bldat LIKE rbkp-bldat,

budat LIKE rbkp-budat,

usnam LIKE rbkp-usnam,

xblnr LIKE rbkp-xblnr,

bukrs LIKE rbkp-bukrs,

lifnr LIKE rbkp-lifnr,

waers LIKE rbkp-waers,

rmwwr LIKE rbkp-rmwwr,

END OF i_rbkp.

SELECT belnr

gjahr

blart

bldat

budat

usnam

xblnr

bukrs

lifnr

waers

rmwwr FROM rbkp UP TO 10 ROWS INTO TABLE i_rbkp.

BREAK-POINT.

IF sy-subrc = 0.

LOOP AT i_rbkp.

  • WRITE i_rbkp-rmwwr TO ws_rmwwr CURRENCY 'USD'.

ws_rmwwr = i_rbkp-rmwwr.

write ws_rmwwr no-gap to ws_rmwwr.

CONCATENATE i_rbkp-belnr

i_rbkp-gjahr

i_rbkp-blart

i_rbkp-bldat

i_rbkp-budat

i_rbkp-usnam

i_rbkp-xblnr

i_rbkp-bukrs

i_rbkp-lifnr

i_rbkp-waers

ws_rmwwr

INTO i_output SEPARATED BY ',' .

APPEND i_output.

CLEAR i_output.

ENDLOOP.

ENDIF.

CALL FUNCTION 'WS_DOWNLOAD'

EXPORTING

  • BIN_FILESIZE =

filename = 'C:\test.csv'

filetype = 'DAT'

  • APPEND = ' '

  • WRITE_FIELD_SEPARATOR = 'X'

  • HEADER = '00'

  • TRUNC_TRAILING_BLANKS = ' '

  • WRITE_LF = 'X'

  • COL_SELECT = ' '

  • COL_SELECT_MASK = ' '

  • DAT_MODE = ' '

  • IMPORTING

  • FILELENGTH =

TABLES

data_tab = i_output[]

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

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

regards

siva

Read only

Former Member
0 Likes
626

HI

for XML files

please try with these fms.

UA_UPLOAD_XMLFILE

JIT03_UPLOAD_XML

for direct upload of a file use

Use Tcode CG3Z to upload the file into app server

<b>Reward if usefull</b>

Read only

former_member386202
Active Contributor
0 Likes
625

Hi,

Use open dataset it will create file on application server

Reagrds,

Prashant