cancel
Showing results for 
Search instead for 
Did you mean: 

WS_DOWNLOAD

Former Member
0 Kudos

can i use internal table as my data_tab?

thanks.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Not sure I got your question right - the parameter DATA_TAB is a TABLES parameter, and you will have to pass an internal table there.

Sudha

Former Member
0 Kudos

yes u can use ur data_itab ..

infact data_itab is the tables parameter of fm ws_download ..therefore it demand an internal table as parameter.

Also ws_download has become obsolete ..therefore avoid using it..

Answers (5)

Answers (5)

former_member355937
Participant
0 Kudos

Hi Donna,

If you are planning to use GUI_UPLOAD (which I personally recommend you use it because it is not properly working in the latest patch of SAP for 4.6c) here is the complete code:

<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>

*1. Include this type pool

TYPE-POOLS TRUXS.

*2. Declare your internal table based on your import

  • file's structure

Data: begin of i_tab occurs 0,

ebeln like ekko-ebeln,

ebelp like ekpo-ebelp,

menge(4) type c,

end of i_tab.

*3. Declare a string type variable that will get the value * of your imput file parameter. And a temp table that

  • will be used for GUI_UPLOAD.

Data: strFilename type string,

tbTemp type truxs_t_text_data.

*4. A Sample selection screen

selection-screen begin of block b1 with frame title text-001.

parameters: pFile like rlgrap-filename.

selection-screen end of block b1.

*5. Trigger this event and add the following code.

at selection-screen on value-request for pFile.

call function 'WS_FILENAME_GET'

exporting

mask = '., All Files (.)...'

mode = '0'

title = 'Get Text File...'

importing

filename = pFile

exceptions

inv_winsys = 1

no_batch = 2

selection_Cancel = 3

selection_error = 4

others = 5.

if sy-subrc <> 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

  • 6. The rest are self explanatory.

start-of-selection.

strFilename = pFile.

call function 'GUI_UPLOAD'

exporting

filename = strFileName

filetype = 'ASC'

has_field_separator = 'X'

dat_mode = ' '

tables

data_tab = tbTemp

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 sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

call function 'TEXT_CONVERT_XLS_TO_SAP'

exporting

i_field_separator = 'X'

i_tab_raw_data = tbTemp

i_filename = pFile

tables

i_tab_converted_data = i_tab

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.

<><><><><><><><><><><><><><><><><><><><><><><><><><><><>

You can check the entries of <b><i>i_tab</i></b> internal table.

Happy Coding!!!

Jeff

Former Member
0 Kudos

Using GUI_DOWNLOAD

data: begin of it_itab occurs 0 ,

text(200),

end of it_itab.

data: v_path like rlgrap-filename,

v_filename type sting.

v_filename = v_path.

call function 'GUI_DOWNLOAD'

exporting

filename = v_filename

  • FILETYPE = 'ASC'

  • HAS_FIELD_SEPARATOR = ' '

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • CHECK_BOM = ' '

  • VIRUS_SCAN_PROFILE =

  • IMPORTING

  • FILELENGTH =

  • HEADER =

tables

data_tab = it_itab

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.

Former Member
0 Kudos

try this way

REPORT zanid_test MESSAGE-ID zz.

data: begin of itab occurs 0,

line(120),

end of itab.

*

CALL FUNCTION 'WS_DOWNLOAD'

EXPORTING

FILENAME = 'c:\test.txt '

  • FILETYPE = 'ASC'

  • MODE = ' '

  • IMPORTING

  • FILELENGTH =

TABLES

data_tab = itab

  • FIELDNAMES =

EXCEPTIONS

FILE_OPEN_ERROR = 1

FILE_WRITE_ERROR = 2

INVALID_FILESIZE = 3

INVALID_TYPE = 4

NO_BATCH = 5

UNKNOWN_ERROR = 6

INVALID_TABLE_WIDTH = 7

GUI_REFUSE_FILETRANSFER = 8

CUSTOMER_ERROR = 9

OTHERS = 10

.

IF sy-subrc <> 0.

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

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

ENDIF.

Former Member
0 Kudos

> can i use internal table as my data_tab?

>

> thanks.

Hi,

Yes you can! Pay attention on the version of sap... from 4.6c better use gui_download ...

Former Member
0 Kudos

hi,

yes you can. but WS_upload and Ws_download is now obselate. try to use Gui_upload and download

cheers,

sasi