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

down load

Former Member
0 Likes
623

i want down load my txt file in remote system

6 REPLIES 6
Read only

Former Member
0 Likes
587

hi

use CG3Z transaction.....

Read only

Former Member
0 Likes
587

Hello,

Check this :-



Data : l_file LIKE rlgrap-filename DEFAULT 'c:tempinv_to_wms.txt'.


CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
FILENAME = l_FILE
FILETYPE = 'ASC'
* APPEND = ' '
* WRITE_FIELD_SEPARATOR = ' '
* HEADER = '00'
* TRUNC_TRAILING_BLANKS = ' '
* WRITE_LF = 'X'
* COL_SELECT = ' '
* COL_SELECT_MASK = ' '
* DAT_MODE = ' '
* CONFIRM_OVERWRITE = ' '
* NO_AUTH_CHECK = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* WRITE_BOM = ' '
* TRUNC_TRAILING_BLANKS_EOL = 'X'
* IMPORTING
* FILELENGTH =
TABLES
DATA_TAB = it_datei
* FIELDNAMES =
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

Regards,

Deepu.k

Read only

Former Member
0 Likes
587

Hi Jaya,

You can use the transaction <i><b>CG3Z</b></i> for downloading the file on the application server. Here in the transaction, plz specify the path of file on your desk and the path of application server, where you want to download the file.If you want to see the directories of application server, use transaction <i><b>AL11.</b></i>

Also, there is one more way of doing this by programming. You can use the OPEN_DATASET & CLOSE_DATASET ABAP statements for writing the data on the application server.

Hope this sort out your issue.

PS If the answer solves your query, plz close the thread by rewarding points to each reply.

Regards

Read only

Former Member
0 Likes
587

hi,

use function modules ws_download or gui_download.and in that give the file path.

reward the points if useful.

Read only

sharadendu_agrawal
Active Participant
0 Likes
587

check out the code given below..

----


  • Program Description: YKPCAR_PROFIT_SEGMENT *

----


  • This program is used for uploading the check table with the active *

  • PA object numbers. This check table will be referred to in the *

  • Deactivation Program. *

REPORT ykpcar_profit_segment

NO STANDARD PAGE HEADING

LINE-SIZE 255

MESSAGE-ID zz.

----


  • Types *

----


TYPES : BEGIN OF tp_ykpcat_paobjnr,

paobjnr LIKE ykpcat_paobjnr-paobjnr,

type LIKE ykpcat_paobjnr-type,

END OF tp_ykpcat_paobjnr.

----


  • Tables *

----


TABLES : ykpcat_paobjnr.

----


  • Constants *

----


CONSTANTS : c_file(80) TYPE c VALUE

'/usr/sap/RD1/SYS/interfaces/client670/SP01_TO_UNIX/UNIX1'.

----


  • Global Internal tables *

----


DATA : t_ykpcat_paobjnr TYPE STANDARD TABLE OF tp_ykpcat_paobjnr

WITH HEADER LINE,

t_ykpcat_paobjnr_help TYPE STANDARD TABLE OF tp_ykpcat_paobjnr

WITH HEADER LINE.

----


  • Global Variable Declaration *

----


DATA: w_modify TYPE i VALUE 0,

w_delete TYPE i VALUE 0,

w_deletews TYPE i VALUE 0.

----


  • Global Work Areas *

----


DATA : wa_ykpcat_paobjnr TYPE ykpcat_paobjnr.

----


  • Selection Screen *

----


SELECTION-SCREEN BEGIN OF BLOCK b01.

SELECTION-SCREEN BEGIN OF BLOCK b11 WITH FRAME TITLE text-b11.

PARAMETERS : p_local AS CHECKBOX DEFAULT 'X' MODIF ID grp,

p_output LIKE rlgrap-filename OBLIGATORY MODIF ID grp.

  • DEFAULT c_file.

SELECTION-SCREEN END OF BLOCK b11.

SELECTION-SCREEN BEGIN OF BLOCK b12 WITH FRAME TITLE text-b12.

SELECT-OPTIONS : s_paobjn FOR ykpcat_paobjnr-paobjnr MODIF ID mod,

s_type FOR ykpcat_paobjnr-type MODIF ID mod.

SELECTION-SCREEN END OF BLOCK b12.

SELECTION-SCREEN END OF BLOCK b01.

SELECTION-SCREEN BEGIN OF BLOCK b02 WITH FRAME TITLE text-b02.

PARAMETERS : p_delws RADIOBUTTON GROUP rd1 USER-COMMAND flag,

p_modify RADIOBUTTON GROUP rd1 DEFAULT 'X',

p_delete RADIOBUTTON GROUP rd1 .

SELECTION-SCREEN END OF BLOCK b02.

----


  • AT SELECTION-SCREEN *

----


*--Providing F4 help for the file.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_output.

PERFORM execute_f4help USING 'P_OUTPUT' 'P_LOCAL'.

*--Providing F4 help for the Profitability Segment Number.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_paobjn-low.

PERFORM execute_f4help_field.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_paobjn-high.

PERFORM execute_f4help_field.

----


  • AT SELECTION SCREEN OUTPUT *

----


AT SELECTION-SCREEN OUTPUT.

*--Take the selection from the user

LOOP AT SCREEN.

IF screen-group1 = 'GRP'.

IF NOT p_delws IS INITIAL.

screen-active = 0.

screen-invisible = 1.

ELSE.

screen-active = 1.

screen-invisible = 0.

ENDIF.

ENDIF.

*--Hide the user selection criteria when Delete With

*--Selection is not selected

IF screen-group1 = 'MOD'.

IF p_delws IS INITIAL.

screen-active = 0.

screen-invisible = 1.

ELSE.

screen-active = 1.

screen-invisible = 0.

ENDIF.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

----


  • START-OF-SELECTION *

----


START-OF-SELECTION.

*--If local upload is selected

IF p_local = 'X'.

*-- Reading the file locally

PERFORM gui_upload.

SORT t_ykpcat_paobjnr BY paobjnr type.

*-- Retaining only unique entries

DELETE ADJACENT DUPLICATES FROM t_ykpcat_paobjnr

COMPARING paobjnr

type.

ELSE.

*--Reading the file from the server

PERFORM get_data.

SORT t_ykpcat_paobjnr BY paobjnr type.

*-- Retaining only unique entries

DELETE ADJACENT DUPLICATES FROM t_ykpcat_paobjnr

COMPARING paobjnr

type.

ENDIF.

*-- If modify is selected

IF NOT p_modify IS INITIAL.

LOOP AT t_ykpcat_paobjnr.

CLEAR wa_ykpcat_paobjnr.

wa_ykpcat_paobjnr-mandt = sy-mandt.

wa_ykpcat_paobjnr-paobjnr = t_ykpcat_paobjnr-paobjnr.

wa_ykpcat_paobjnr-type = t_ykpcat_paobjnr-type.

*-- Inserting into the database.

INSERT ykpcat_paobjnr FROM wa_ykpcat_paobjnr.

IF sy-subrc IS INITIAL.

w_modify = w_modify + 1.

ENDIF.

ENDLOOP.

*-- If delete is selected

ELSEIF NOT p_delete IS INITIAL.

*--Delete the database.

LOOP AT t_ykpcat_paobjnr.

DELETE FROM ykpcat_paobjnr

WHERE paobjnr = t_ykpcat_paobjnr-paobjnr

AND type = t_ykpcat_paobjnr-type.

IF sy-subrc IS INITIAL.

w_delete = w_delete + 1.

ENDIF.

ENDLOOP.

*-- If delete with selection is selected

ELSEIF NOT p_delws IS INITIAL.

*-- Deleting the database table (Based on Criteria)

DELETE FROM ykpcat_paobjnr

WHERE paobjnr IN s_paobjn AND

type IN s_type.

IF sy-subrc IS INITIAL.

w_deletews = sy-dbcnt.

ENDIF.

ENDIF.

----


  • END-OF-SELECTION *

----


END-OF-SELECTION.

*--Perform called to show the status of number of records

*--Deleted/Modified

PERFORM status_report.

----


  • TOP-OF-PAGE *

----


TOP-OF-PAGE.

PERFORM top_of_page.

&----


*& Form get_data

&----


  • Form called to read data from the database server file

----


FORM get_data.

*-- Local Data

DATA : l_data(2048) TYPE c,

l_value.

CONSTANTS : c_tab TYPE x VALUE '09'.

*-- Open data set to get the file in DTS

OPEN DATASET p_output FOR INPUT IN TEXT MODE ENCODING DEFAULT.

IF sy-subrc <> 0.

MESSAGE s999(zz) WITH 'Unable to read file'(e01).

ELSE.

*--Bring up the file from DTS

DO.

CLEAR wa_ykpcat_paobjnr.

READ DATASET p_output INTO l_data.

IF sy-subrc <> 0.

EXIT.

ENDIF.

SPLIT l_data AT c_tab INTO t_ykpcat_paobjnr-paobjnr

t_ykpcat_paobjnr-type.

APPEND t_ykpcat_paobjnr.

ENDDO.

CLOSE DATASET p_output.

ENDIF.

ENDFORM. " get_data

&----


*& Form gui_upload

&----


  • Form called to read data from the file on the local server.

----


FORM gui_upload .

DATA: l_filename TYPE string.

l_filename = p_output.

*-- Upload Data

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = l_filename

filetype = 'ASC'

has_field_separator = 'X'

TABLES

data_tab = t_ykpcat_paobjnr

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

OTHERS = 17.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDFORM. " gui_upload

&----


*& Form execute_f4help

&----


  • Form called for f4 help to the output file field.

----


FORM execute_f4help USING fp_file

fp_local.

*-- Local data declaration

DATA : l_local TYPE c,

tl_dynpread TYPE STANDARD TABLE OF dynpread WITH HEADER LINE.

CLEAR l_local.

REFRESH tl_dynpread.

*-- Populating tl_dynpread with screen elements ie checkboxes whose

*-- Values are tracked.

tl_dynpread-fieldname = fp_local. " Presentation Server

APPEND tl_dynpread.

*-- Check the Values from Screen

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

dyname = sy-cprog " Calling program

dynumb = sy-dynnr " Screen number

TABLES

dynpfields = tl_dynpread

EXCEPTIONS

OTHERS = 11.

IF sy-subrc NE 0.

MESSAGE e103(zz) WITH

'Exception raised while reading the Screen.'(002).

ENDIF. " IF SY-SUBRC NE 0.

*-- Getting server type

READ TABLE tl_dynpread WITH KEY fieldvalue = 'X'

BINARY SEARCH.

IF sy-subrc IS INITIAL.

l_local = 'P'.

ELSE.

l_local = 'A'.

ENDIF.

*-- Selects the directory list based on the dowmload location

*-- button selected.

CALL FUNCTION 'F4_DXFILENAME_4_DYNP'

EXPORTING

dynpfield_filename = fp_file

dyname = sy-cprog

dynumb = sy-dynnr

filetype = 'P'

location = l_local

server = space.

ENDFORM. " EXECUTE_F4HELP

&----


*& Form status_report

&----


  • Form to print the number of lines deleted or modified.

----


FORM status_report .

  • Begin of I-RD1K907385

IF p_delws IS INITIAL.

DESCRIBE TABLE t_ykpcat_paobjnr.

WRITE : /05 'Number of records read from file:'(t04),

sy-tfill.

ENDIF.

  • End of I-RD1K907385

IF NOT p_modify IS INITIAL.

WRITE : /05 text-t01, w_modify.

ELSEIF NOT p_delete IS INITIAL.

WRITE : /05 text-t02, w_delete.

ELSEIF NOT p_delws IS INITIAL.

WRITE : /05 text-t03, w_deletews.

ENDIF.

ENDFORM. " status_report

&----


*& Form execute_f4help_field

&----


  • Form Called for search help to the field Profitability

  • Segment Number

----


FORM execute_f4help_field .

*--Populating the internal table with only the Profitability segment

*--Numbers(PAOBJNR)

SELECT paobjnr

FROM ykpcat_paobjnr

INTO CORRESPONDING FIELDS OF TABLE t_ykpcat_paobjnr_help.

*--Function called for F4 help on Profitability Segment Number(PAOBJNR)

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'PAOBJNR'

dynpprog = sy-repid

dynpnr = sy-dynnr

dynprofield = 'S_PAOBJN'

value_org = 'S'

TABLES

value_tab = t_ykpcat_paobjnr_help.

ENDFORM. " execute_f4help_field

In the above program u will get to know how to upload the data from the presentation or the application server.

Reward if helpful.

Read only

Former Member
0 Likes
587

Hi Jaya,

Can you plz mark your query <i><b>Solved</b></i> if you got the result. Also plz close the thread by rewarding each reply if that has helped you.

Regards