05-19-2009 10:10 AM
Hi,
We have a requirement to upload a file from the presentation server C:\xxx to the application server.
Can any body share the code snippet.
Thanks.
05-19-2009 10:14 AM
Hi,
There is a standard transaction CG3Z available for the same.
You can check the same.
Regards,
Ankur Parab
05-19-2009 10:15 AM
Hi,
If its a simple upload without any validation then can use the standard tcode CG3Z, to upload file from presentation server to application server.
Regards,
Nikhil
05-19-2009 10:16 AM
Use Transaction CG3Z to upload file from Presentation Server to Application Server
For reading file from presentation server use FM GUI_UPLOAD
05-19-2009 10:17 AM
05-19-2009 10:28 AM
Hi,
Thank you for you prompt replies.
Scenario is - I have downloaded a file using tcode FDTA.
That got stored in C:\documentsandsetting\sapworkdir .
Now can we build a code in this tcode FDTA using exits or anyother way so that when ever a user runs this tcode , after downloading to presentation it will get stored in application.
So can i submit any report in exit.
Thanks.
05-19-2009 10:28 AM
Hi,
Thank you for you prompt replies.
Scenario is - I have downloaded a file using tcode FDTA.
That got stored in C:\documentsandsetting\sapworkdir .
Now can we build a code in this tcode FDTA using exits or anyother way so that when ever a user runs this tcode , after downloading to presentation it will get stored in application.
So can i submit any report in exit.
Thanks.
05-19-2009 10:20 AM
Hello,
Use the transaction:
CG3Z --> for Upload
CG3Y --> for Download
Rgds,
RamaniN
05-19-2009 10:29 AM
Hi,
Thank you for you prompt replies.
Scenario is - I have downloaded a file using tcode FDTA.
That got stored in C:\documentsandsetting\sapworkdir .
Now can we build a code in this tcode FDTA using exits or anyother way so that when ever a user runs this tcode , after downloading to presentation it will get stored in application.
So can i submit any report in exit.
Thanks.
05-19-2009 10:35 AM
Hi,
User exists ar basically to update certain data which SAP is allowing us in that particualr exits.
Do not submit any report in any exit.
In your exit you can try to extract the file on desktop using GUI_UPLOAD and then using OPEN DATASET and TRANSFER statements you can pass the fille to the application server.
Regards,
Ankur Parab
05-19-2009 10:22 AM
Use Function module GUI_UPLOAD or
Have a look at transaction FILE and the logic of logical filenames.
Looks like the best option
05-19-2009 10:25 AM
Hi,
Can you please tell me the format in which you want to upload the file?
The below code uploads file in the CSV format on application server
you can specify your separator in the variable lv_file_separator.
DATA: lv_file_separator TYPE c.
lv_file_separator = ','.
CALL FUNCTION 'SAP_CONVERT_TO_TEX_FORMAT'
EXPORTING
i_field_seperator = lv_file_separator
TABLES
i_tab_sap_data = tb_output1_file
CHANGING
i_tab_converted_data = tb_converted
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.
DATA: lv_app_server_file TYPE string.
lv_file_name = pa_filep.
OPEN DATASET lv_app_server_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
LOOP AT tb_converted INTO wa_converted.
TRANSFER wa_converted TO lv_app_server_file.
ENDLOOP.
CLOSE DATASET lv_app_server_file.
Regards,
Manish
05-19-2009 10:26 AM
Hi,
CG3Z transaction is to upload filr from presentation server to application server.
OR
use GUI_UPLOAD fm
Regards,
Jyothi CH.
05-19-2009 10:34 AM
Hi,
It is possible with CG3Z transaction.
It is also possible with Opendataset statement.
Pass the data into table and in open dataset statement loop the table, here is sample code:
OPEN DATASET <filename in application server> FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc EQ 0.
LOOP AT <table with upload data> INTO <field string>.
TRANSFER <fieldstring> TO <filename>.
ENDLOOP.
CLOSE DATASET <filename>.
ENDIF.
Hope this helps you.
Regards,
Rajani