Skip to Content
0
Former Member
Aug 20, 2010 at 10:19 AM

Unable to upload excel file to SAP

548 Views

Hi Champs

I am trying to upload an excel fiel to SAP system.

Below is my code:

TYPES: BEGIN OF TY_ITAB,
  WF_NO(9),
  DR_CR,
  GL_ACCNT(6),
  CARDHOLDER(25),
  DESC_OF_CHARGE(30),
  VENDOR(25),
  COST_CENTER(5),
  AMOUNT(12),
  NETWORK(12),
  WBS(12),
  ACTV_NO(4),
  DATE_OF_TANSC(8),
  CHARGE_TYPE,
  COMPANY_CODE(4),
  POST_DATE(8),
  DOC_DATE(8),
  REF_NO(12),
  POST_INDIC,
  END OF TY_ITAB.

DATA: ITAB TYPE STANDARD TABLE OF TY_ITAB,
      WA_ITAB TYPE TY_ITAB.

DATA: FILENAME TYPE STRING.

PARAMETERS P_FILE TYPE LOCALFILE.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
CALL FUNCTION 'F4_FILENAME'
 EXPORTING
   PROGRAM_NAME        = SYST-CPROG
   DYNPRO_NUMBER       = SYST-DYNNR
*   FIELD_NAME          = ' '
 IMPORTING
   FILE_NAME           = P_FILE     .

FILENAME = P_FILE.

START-OF-SELECTION.

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
  EXPORTING
    FILENAME                      = FILENAME
    I_BEGIN_COL                   = 1
    I_BEGIN_ROW                   = 2
    I_END_COL                     = 14
    I_END_ROW                     = 2
  TABLES
    INTERN                        = ITAB
 EXCEPTIONS
   INCONSISTENT_PARAMETERS       = 1
   UPLOAD_OLE                    = 2
   OTHERS                        = 3
          .
IF SY-SUBRC <> 0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Here in my internal table the last 4 fields are extra and don't want to add data from my excel sheet , rather I want to update it later.

Its giving me a dump stating that:

The function module interface allows you to specify only

fields of a particular type under "FILENAME".

The field "FILENAME" specified here is a different

field type

Please help

Thanks in Advance

Please enclose your between ... tags for better readability.

Edited by: kishan P on Aug 20, 2010 4:04 PM