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 on FTP server

Former Member
0 Likes
2,231

Hy gurus,

It's possible to create a file on FTP server from internal table? How I can do it?

I've created an internal table in my program and I've to create a file in a specific path on FTP server.

Thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,051

Check this :

5 REPLIES 5
Read only

Former Member
0 Likes
1,052

Check this :

Read only

Former Member
0 Likes
1,051

Hi,

To read the SAP data from FTP server or vice versa, you need to configure the sender file/FTP adapter. But you should keep one thing in mind that this is possible only when files aren't read only.

You configure the adapter on the Parameters tab page during the definition of a communication channel in the Integration Server or in the PCK. In addition to the adapter configuration, you can use the Module tab page in the module processor to specify generic modules, which give the adapter additional functions.

for more details you can go through the thread below:

http://help.sap.com/saphelp_nw04/helpdata/en/e3/94007075cae04f930cc4c034e411e1/content.htm

Hope this would be some help!!

Regards,

Lalit Kabra

Read only

Former Member
0 Likes
1,051

HI,

You can write in to a file using :

OPEN DATASET statement

You can get file path from transaction: FILE

Read only

Former Member
0 Likes
1,051

hi...

you can use OPEN DATASET and CLOSE DATASET to create file on FTP server.The data from your internal table will be created in csv format on the application server.

CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'

EXPORTING

i_field_seperator = ';'

  • I_LINE_HEADER =

  • I_FILENAME =

  • I_APPL_KEEP = ' '

TABLES

i_tab_sap_data = it_zproj_site_detl

CHANGING

i_tab_converted_data = it_trans

  • EXCEPTIONS

  • CONVERSION_FAILED = 1

  • OTHERS = 2

.

IF sy-subrc <> 0.

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

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

ENDIF.

IF sy-subrc NE 0.

MESSAGE e000(yw) WITH 'Data not Avilable for Selection Criteria.'.

ENDIF.

SELECT SINGLE paramval FROM zmm_params

INTO path

WHERE pgmna = 'ZBTS_SAP_CLARITY'

AND paramid = 'PATH'

AND fromdt <= sy-datum

AND todt >= sy-datum.

IF SY-MANDT EQ '300'.

path = '/statd40/'.

ENDIF.

CONDENSE path.

CONCATENATE path 'SAPSITE_' sy-datum '.CSV' INTO dsn.

CONDENSE dsn.

OPEN DATASET dsn FOR OUTPUT IN TEXT MODE.

IF sy-subrc EQ 0.

LOOP AT it_trans INTO wt_trans.

CLEAR line.

TRANSLATE wt_trans-truxs_t_text_data USING ';,'.

MOVE wt_trans-truxs_t_text_data TO line.

TRANSFER line TO dsn.

ENDLOOP.

CLOSE DATASET dsn.

*ENDIF.

CLEAR : cmdtxt.

  • concatenate 'chmod 777' '/infocomm/mm/getfile' into

CONCATENATE 'chmod 777' dsn INTO

cmdtxt SEPARATED BY space.

CALL 'SYSTEM' ID 'COMMAND' FIELD cmdtxt

ID 'TAB' FIELD i_tty[].

MESSAGE i001(yw) WITH 'File is downloaded successfully'.

this is an example code wher fle is downloaded to the application server and we are converting this file to csv format and then using open dataset.

try this....

Read only

Former Member
0 Likes
1,051

Hi

Go through the link given below :

http://help.sap.com/saphelp_nw04/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/content.htm

rewards if useful.

Thanks and Regards

Nikunj Shah