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: 

GUI_UPLOAD

Former Member
0 Kudos

Hi,

I trying my options of uploading a notepad file & an excel file thru GUI_UPLOAD FM ... the notepad file is getting uploaded but for ecel file it it's giving sy-subrc = 13 .... i.e Access Denied... both the notepad & excel sheet are on my desktop... The importing parameters are :-

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

for excel sheet I tried commenting & uncommenting the Field_seperator parameter... still it throws the same exception ... sy-subrc = 13.

Can anybody tell me what's wrong here ??...

Thank You & Regards,

-S.

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate

Have you tried Func Mod "ALSM_EXCEL_TO_INTERNAL_TABLE"?

This may work for you.

Regards,

Rich Heilman

12 REPLIES 12

Former Member
0 Kudos

Try opening the spreadsheet in Excel and see if Windows has it locked. I have had this problem before. If you can open it, save it, then close it. Then try your ABAP again.

Let us know how it goes.

0 Kudos

Hi,

It's not raising an exception now but in the debug mode when i see the data inside the uploaded internal table I get only one record line & that too a junk data...

& then a dump is thrown saying ..

Unable to interpret "##" as a number.

Thank You & Regards,

-Seema.

0 Kudos

Hi Seema,

You have to use some extra coding if you want to upload the Excel file using GUI_UPLOAD. If the function module Rich suggested doesn't work for you, here is a sample code that uploads a excel file using GUI_UPLOAD, but uses another function module to convert that uploaded data into an internal table.

TYPE-POOLS: truxs.

DATA: i_text_data       TYPE truxs_t_text_data,
      v_filename_string TYPE string.

DATA: BEGIN OF itab OCCURS 0,
        Name(30),
        Phone(15),
        Fax(500).
DATA: END OF itab.

PARAMETERS: p_file LIKE rlgrap-filename.

START-OF-SELECTION.

  v_filename_string = p_file.

  CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
      filename                      = v_filename_string
      filetype                      = 'ASC'
      has_field_separator           = 'X'
*     HEADER_LENGTH                 = 0
*     READ_BY_LINE                  = 'X'
      dat_mode                      = ''
*   IMPORTING
*     FILELENGTH                    =
*     HEADER                        =
    TABLES
      data_tab                      = i_text_data
    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_seperator          = 'X'
*     I_LINE_HEADER              =
      i_tab_raw_data             = i_text_data
      i_filename                 = p_file
    TABLES
      i_tab_converted_data       = itab
    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.

Hope this helps. You may to have add some extra coding to check whether the file is an excel file or not.

Srinivas

0 Kudos

hi guys, i have data in .txt which i am able to upload using GUI_UPLOAD.

this data needs to be inserted into r/3 database table.

Problem: i have 5 fields in r/3 table and i have data for 4 fields from sql.

the first field MANDT , I have no values for it and i donot want to fill during inserting .

According to SAP Standard insertion the first values sits in first field.

how can i fill data from my .txt file into r/3 table without filling MANDT.

azee

0 Kudos

hi guys, i have data in .txt which i am able to upload using GUI_UPLOAD.

this data needs to be inserted into r/3 database table.

Problem: i have 5 fields in r/3 table and i have data for 4 fields from sql.

the first field MANDT , I have no values for it and i donot want to fill during inserting .

According to SAP Standard insertion the first values sits in first field.

how can i fill data from my .txt file into r/3 table without filling MANDT.

azee

0 Kudos

Hi Azee,

Fill MANDT field with SY-MANDT and the rest of the four fields from the uploaded text file.

Satya.

0 Kudos

If you want to leave the MANDT field blank than leave it blank in your internal table and while inserting use the key word 'CLIENT SPECIFIED'.

0 Kudos

Hi,

I am getting the same Sy-subrc = 13 problem mentioned above, and i have done all what u have said here. but it is still not getting solved. I am using GUI_Upload

0 Kudos

Did you see Rich's answer above? Try it.

Rob

RichHeilman
Developer Advocate
Developer Advocate

Have you tried Func Mod "ALSM_EXCEL_TO_INTERNAL_TABLE"?

This may work for you.

Regards,

Rich Heilman

former_member233090
Active Contributor
0 Kudos

Hi,

Even i was facing the problem when i was trying to load the excel into sap, i tried doing it as

changing the file name as .csv

suppose ur excel is "ABC.XLS" try to change it to ".CSV" file and then change in the gui_upload function

file type ABC.CSV

then check the program, if still you get a problem let me know.

else you can do with another function module i,e ALSM_EXCEL_TO_INTERNAL_TABLE this also wrks exactly fine

Regards,

Bhavana

Former Member
0 Kudos

Hi All,

I have data in .xls format and tried using GUI_UPLOAD but the internal table has junk values .Then i converted .xls into .csv and changed FILETYPE = '.CSV'

but im geeting an error ( some thing like invalid file type).

And I know we can use ALSM_EXCEL_TO_INTERNAL_TABLE function module to upload excel but im working in solution manager 7.0 which does not have ALSM_EXCEL_TO_INTERNAL_TABLE function module.

Please can anyone help me on this.

Regards,

Gana.