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: 

Upload data from excel:can we upload from .csv only?

Former Member
0 Kudos

Hi Experts,

Can we upload data from .CSV file only? Is this a limitation in ABAP? What if i have an excel sheet with multiple worksheets and I want to pick data from one of the worksheet. Is this scenario possible?

Thanks and Regards,

Rohit

4 REPLIES 4

Former Member
0 Kudos

Dear Rohit,

Uploading excel sheet data using Webdynpro for ABAP is not possible only data from CSV or text file is possible. This is not the case when you upload the data in General ABAP Approach.

Regards,

Murthy.

0 Kudos

Hi Murthy,

Thanks for your response. Actully I am using SAP CRM and other FMs for uploading data from excel like-ALSM_EXCEL_TO_INTERNAL_TABLE are not available in CRM. So my doubt was-is it a limitation that we can only use .csv files to upload data from excel in SAP CRM scenario?

Thanks and Regards,

Rohit

0 Kudos

Hi Rohit.

In CRM , it works somewhat differently. Following code snippet will help u.


AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_infile.

  CALL FUNCTION 'WS_FILENAME_GET'
    EXPORTING
      DEF_FILENAME     = 'p_infile'
      DEF_PATH         = ' '
      MASK             = '*.txt'
      MODE             = '0'
      TITLE            = 'UPLOAD TAB DELIMITED FILE'(078)
    IMPORTING
      FILENAME         = p_infile
*     RC               =
    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.

************************************************************************
*START-OF-SELECTION
START-OF-SELECTION.

  gd_file = p_infile.

  CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
      FILENAME                    = gd_file
*   FILETYPE                      = 'ASC'
      HAS_FIELD_SEPARATOR         = 'X'
*   HEADER_LENGTH                 = 0
*   READ_BY_LINE                  = 'X'
*   DAT_MODE                      = ' '
*   CODEPAGE                      = ' '
*   IGNORE_CERR                   = ABAP_TRUE
*   REPLACEMENT                   = '#'
*   CHECK_BOM                     = ' '
*   VIRUS_SCAN_PROFILE            =
*   NO_AUTH_CHECK                 = ' '
* IMPORTING
*   FILELENGTH                    =
*   HEADER                        =
    TABLES
      DATA_TAB                   = it_record
 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.
    write: 'Error' , sy-subrc .
    skip.
  ENDIF.

Former Member
0 Kudos

Hi,

Refer to this link..[Upload from CSV file|]

Refer to this link..[Data Upload from Excel Sheet. Two Worksheets.|]