Skip to Content

Why the user can't upload the excel from desktop...

Dear Gurus,

I write a customized program, and I use the FM: text_convert_xls_to_sap to upload excel to SAP.

Some of the users upload the excel successfully, but some of the users are fail to upload.

The most weird thing is that they upload the same document with their own pc.

And I try to copy the user's ID that fail to upload, and i login SAP to upload excel, it's success to upload....

WHY DOES THIS HAPPEN??

ANY SUGGESTION??

Thanks in advance.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

8 Answers

  • Best Answer
    Posted on Oct 18, 2012 at 06:25 AM

    Dear all,

    I'm so sorry that the reason why the user couldn't upload the excel is related to Spreadsheet software, not ABAP code. There are two office software in the user' company, Microsoft & Kingsoft. When the user upload the excel to SAP, Kingsoft will pop up the msg: invalid pointer operation....so I uninstall the Kingsoft, it works fine.

    I really appreciate your any help, even I tried the solutions you mentioned , and it doesn't work, because the key of the problem is not ABAP code.

    Thank you very much!!!

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 17, 2012 at 04:24 AM

    Hi Ya-Chun,

    what is the error that you're getting?

    Are you trying to provide input in selection screen via variant??

    In that case you need to change the path of the file location.

    Regards...

    Sultana

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Ya-Chun Liou

      yes,

      give the correct Path where your file is residing in Presentation Server.

      or you can use this FM to get F4 help to browse the file location and select the path.

      parameters : p_ufile like rlgrap-filename.

      at selection-screen on value-request for p_ufile.
      perform get_file.

      form get_file.
      call function 'KD_GET_FILENAME_ON_F4'
      exporting
      mask = ' '
      changing
      file_name = p_ufile
      exceptions
      mask_too_long = 1
      others = 2.
      if sy-subrc <> 0.
      message i003(ztmtl).
      endif.
      endform.

      This will fetch the file with correct Path.

      Hope this is helpful.

      Regards...

      Sultana

  • Posted on Oct 17, 2012 at 05:05 AM

    Hi,

    can you provide us code..file format etc...

    Regards,

    Amol

    Add a comment
    10|10000 characters needed characters exceeded

    • This is normal scenario..I guess, in your case.. it happens when the file path is more then 128 characters.The problem is with the below line.

      PARAMETERS: P_FILE TYPE RLGRAP-FILENAME MODIF ID GP2.

      Where RLGRAP-FILENAME can hold only 128 characters.

      When users are loading the file from C drive or D drive it works and whenever users are trying to load from desktop it may not as the file path get trauncated.

      There are two options to over come your problem.

      1) You can ask the user to always load the file from the directory and never load the excel file from desktop as the file path gets truncated because of the lenght.

      2) Change the PARAMETERS: P_FILE(255) MODIF ID GP2.

      and copy FM(TEXT_CONVERT_XLS_TO_SAP) to Z* and make sure file path can hold 255 characters.

      I guess above information will help you to close the thread.

      Regards,

      SaiRam

  • Posted on Oct 17, 2012 at 03:57 AM

    Hi,

    Have you checked the sy--subrc after uploading fail ?

    for this situation i would like to suggest another way to select the file on at selection screen on upload button. Please check the below code before calling to FM text_convert_xls_to_sap.

    SELECTION-SCREEN ON VALUE-REQUEST FOR p_upload.

    CALL METHOD cl_gui_frontend_services=>get_desktop_directory
    CHANGING
    desktop_directory = gv_desktop
    EXCEPTIONS
    cntl_error = 1
    error_no_gui = 2
    not_supported_by_gui = 3
    OTHERS = 4.
    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 METHOD cl_gui_frontend_services=>file_open_dialog
    EXPORTING
    window_title = 'Select Excel File'
    default_extension = 'XLSX'
    file_filter = 'Excel files (*.XLS)|*.XLS| Excel files (*.XLSX)|*.XLSX|'
    initial_directory = gv_desktop
    CHANGING
    file_table = gt_file_table
    rc = gv_rc
    EXCEPTIONS
    file_open_dialog_failed = 1
    cntl_error = 2
    error_no_gui = 3
    not_supported_by_gui = 4
    OTHERS = 5.

    IF sy-subrc = 0 AND gv_rc = 1.
    READ TABLE gt_file_table INTO gs_file_table INDEX 1 .
    p_upload = gs_file_table-filename.
    ENDIF.

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

    Now you can use the FM TEXT_CONVERT**** in selection area of program like below

    CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
    EXPORTING
    i_field_seperator = 'X'

    i_line_header = 'X'

    i_tab_raw_data = lt_tab_raw_data
    i_filename = p_upload
    TABLES
    i_tab_converted_data = <fs_dyntable>
    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.

    Thanks,

    Deeps

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 17, 2012 at 04:25 AM

    Hi,

    The problem is with the path from which they are uploading.

    Ask the user to change the path of the file once they download it either from mail or from somewhere else. If they will change the path and keep it on a different folder where the download was it will solve the issue.

    Hope it helps,

    Rgds,

    Sandeep katoch

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 17, 2012 at 05:17 AM

    Hello Chan,

    What is the error that you are getting.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Ya-Chun Liou

      Hello Chun,

      Do you mean that FM text_convert_xls_to_sap was returning Sy-subrc = 0, but you are not getting the data?

      if so Could you please provide how you are passing the file name, extenion of the fle you are using(can you put your code here)

      .

  • Posted on Oct 18, 2012 at 06:32 AM

    Ya-chun,

    Finally u solved....good 😊

    Regards,

    Amol

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 07, 2019 at 09:05 AM

    Hello,

    We are also facing error in SAP and persona when we are trying to upload XLSX file but same is working when using xls or txt file.

    Please do let us know if their is any solution to this issue.

    Regards

    Tanuja

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.