Application Development 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: 

Error While Uploding data from Excel File

Former Member
0 Kudos

I try to upload data directly from Xlfile to Internal table.I have used the foll function module

ALSM_EXCEL_TO_INTERNAL_TABLE

and it's working nicely when i run the program from R/3.

My Question is ,if i access the same program from ITS ,no record is uploaded .

Any help will be much appreciated .

Rgds,

J.

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

This function module probably uses OLE technology, I don't think this kind of thing is available thru ITS.

Regards,

Rich Heilman

14 REPLIES 14

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

This function module probably uses OLE technology, I don't think this kind of thing is available thru ITS.

Regards,

Rich Heilman

0 Kudos

Thks .

I tried to use

WS_UPLOAD

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

  • CODEPAGE = ' '

FILENAME = file_path

FILETYPE = 'DAT'

  • HEADLEN = ' '

  • LINE_EXIT = ' '

  • TRUNCLEN = ' '

  • USER_FORM = ' '

  • USER_PROG = ' '

  • DAT_D_FORMAT = ' '

  • IMPORTING

  • FILELENGTH =

TABLES

data_tab = data_tab .

************************************************

but in the output table am getting '######' for the field values .

cud u help me ?

Rgds,

J

Message was edited by: Jothivenkatachalam.P

0 Kudos

Jothi,

Can you please close this thread if you think you got satisfactory answer to the earlier question.

Regarding the current question ,

What is the Sy-sbrc after the function module.

It should be either zero or one of the following.

FILE_OPEN_ERROR = 1

FILE_READ_ERROR = 2

NO_BATCH = 3

GUI_REFUSE_FILETRANSFER = 4

INVALID_TYPE = 5

OTHERS = 6.

Cheers

Raghava

0 Kudos

Hi raghava,

I hav changed the fn module to Remote Enabled . Still it doesn't work . I hope it's the prob of OLE as suggested by the other user .

That Expections i hav included already . Still the problem persists .

Rgds,

J

0 Kudos

Hi,

try with this sample code.

**************

----


at selection-screen on value-request for p_file.

----


call function 'F4_FILENAME'

exporting

field_name = 'p_file'

importing

file_name = p_file.

----


start-of-selection.

----


clear itab.

call function 'WS_UPLOAD'

exporting

codepage = ' '

filename = p_file

filetype = 'DAT'

tables

data_tab = itab

exceptions

conversion_error = 1

file_open_error = 2

file_read_error = 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 ne 0.

message e000 with text-e01.

stop.

endif.

I hope it will work for you.

Thanks.

0 Kudos

hi deepak,

Tried with the code given by u.

now am getting the values "########" for the fields uploaded .

Rgds,

j

Message was edited by: Jothivenkatachalam.P

0 Kudos

Hi,

Try to save your file as TEXT(TAB DELIMITED)(*.TXT).

try this and see.

Your ITAb FIELDS must be same as of fields you are uploading.

Check that also.

Data: begin of itab occurs 0,

matnr like mara-matnr,

....

....

end of itab.

Thanks.

0 Kudos

Hi deepak ,

My prob is not with R/3 . Evn "ALSM_EXCEL_TO_INTERNAL_TABLE' works fine .

But if i access the same program thru ITS it's throwing error ,

TSV_NEW_PAGE_ALLOC_FAILED

( Since the system requires more memory to format the error log .the system deletes the table prior to outputting the log. So the value '0' was mistakenly entered always . )

Rgds,

J

Message was edited by: Jothivenkatachalam.P

0 Kudos

you should use gui_upload

This function will check whether the system is running in ITS more or normal GUI mode and based on that different set of codes will get executed.

By using gui_upload you can without additional coding, you can be sure that it will work both in ITS and normal SAP gui modes.

Note: for FMs to work within ITS environment they dont have to be RFC enabled.

Regards

Raja

0 Kudos

hi , if i use Gui_upload ,

from R/3 it's uploading from Excel file . But if i access the same from ITS it's throwing error / the table doesn't contain any data .

( it's due to TSV_TNEW_PAGE_ALLOC_FAILED as mentioned already)

Shd i extend the memory of ITS ?

Rgds,

J

Message was edited by: Jothivenkatachalam.P

0 Kudos

Actually it brings the meta dat of excel as well when you try to upload with

Either GUI_UPLOAD or WS_UPLOAD

Former Member
0 Kudos

Jothi,

This function module does not seem to be remote-enabled. Try to create a wrapper remote-enabled (ZALSM_EXCEL_TO_INTERNAL_TABLE) function module & use ALSM_EXCEL_TO_INTERNAL_TABLE function module in that. That might solve your problem.

Cheers

Raghava

Former Member
0 Kudos

Hi,

The most common cause you will get for "getting the values "########" for the fields uploaded" will be either coming from the situation below:

1) the variables length you declare in your itab is not long enough to cater for the text values.

2) if you are using excel to view the text file that you downloaded, most properly you need to double click on the tab to enlarge the tab length to display the full length of each fields.

PS: Most important at all, please check on your itab to determine whether got any values inside before you upload it to a text file.

Thanks.

Former Member
0 Kudos

Hi,

Additional point.

Use ' FILETYPE = 'ASC'

instead of using DAT.