BAPI Upload Excel to SAP R/3

Hello,
i don't if this is the best place to put this topic, but here he goes.
I have a excel workbook and i have 3 buttons, one to connect remotely to Sap, one to download a table from a RFC function e another to upload data to another table in a rfc function.
The download is working well but the upload no. Here is the code:
DOWNLOAD(Working):
Private Sub DOWNLOAD_Click()
    On Error Resume Next
    ' The required BAPI
    Set objTable = Nothing
    Set objTeste = objBAPIControl.Add("ZPD_TESTE_EXCEL")
    If objTeste.Call Then
        Set objTable = objTeste.Tables("T_INTER")
        For i = 1 To objTable.RowCount
            ActiveSheet.Cells(8 + i, 1) = objTable.Cell(i, 1)
            ActiveSheet.Cells(8 + i, 2) = objTable.Cell(i, 2)
            ActiveSheet.Cells(8 + i, 3) = objTable.Cell(i, 3)
            ActiveSheet.Cells(8 + i, 3) = objTable.Cell(i, 4)
            ActiveSheet.Cells(8 + i, 3) = objTable.Cell(i, 5)
        Next i
    Else
        MsgBox "Erro a chamar a função."
    End If
' objTable.AppendGridData
End Sub
UPLOAD(Not working):
Private Sub UPLOAD_Click()
    On Error Resume Next
    ' The required BAPI
    Set objTable2 = Nothing
    Set objTeste2 = objBAPIControl.Add("ZPD_TESTE_EXCEL_UP")
    If objTeste2.Call Then
        Set objTable2 = objTeste2.Tables("T_INTER")
        For i = 1 To ActiveSheet.RowCount
            objTable2.Cell(i, 1) = ActiveSheet.Cells(8 + i, 1)
            objTable2.Cell(i, 2) = ActiveSheet.Cells(8 + i, 2)
            objTable2.Cell(i, 3) = ActiveSheet.Cells(8 + i, 3)
            objTable2.Cell(i, 4) = ActiveSheet.Cells(8 + i, 4)
            objTable2.Cell(i, 5) = ActiveSheet.Cells(8 + i, 5)
        Next i
    Else
        MsgBox "Erro a chamar a função."
    End If
End Sub

Hi Ricardo,
Have you looked this FM <b>ALSM_EXCEL_TO_INTERNAL_TABLE</b>?
Regards,
Ferry Lianto

Similar Messages

  • Budgeting upload excel to SAP

    Hi all,
    We have budget data cost centre and cost elment wise in excel.
    Kindly advice me what is the best way to upload the same in SAP.
    If i have go through LSMW or BDC, wat is the tcode  for uploading budget data.
    Thanks,
    Bhaskar.
    help.sap.com

    HI Bhaskar,
    I think you are referring to cost center plan upload. If Yes we can load the plan data in KP06. You can activate option of excel upload in the planning profile-transaction KP34. Once this option activated, you just copy paste your planning information from excel.
    Regards,
    Radha

  • Upload data from Excel to Sap-Crm

    Hi All,
    I need to upload data from EXCEL to SAP-CRM system.The problem is in crm there is no ALSM_EXCEL_INTO_INTERNAL_TABLE or corresponding function modules exist.Using GUI_UPLOAD I can upload data from excel to CRM but the main problem with this is it supports only 255 chars for entire line, in my excel file it contains more than 255 chars.Please help me out.

    Try the following :
    Class: CL_GUI_FRONTEND_SERVICES
    Method: GUI_UPLOAD
    Thanks
    <b>Allot points if this helps!</b>

  • Upload data from Excel into SAP CRM using webservices

    Hi,
               I want to upload the data from EXCEL into SAP CRM using a web  service, can anyone say me the process and also how to map the excel and the source code structures.
    Thanks,
    Sanju.

    Try the following :
    Class: CL_GUI_FRONTEND_SERVICES
    Method: GUI_UPLOAD
    Thanks
    <b>Allot points if this helps!</b>

  • How to upload data from excel to SAP using VB script or Macros

    Hi Guys,
    I want to make a macro enabled Excel sheet which  i can use to upload huge data on SAP . I read some discussion but didnt get anything. Please help me with a step by step document.

    Hi,
    Please refer below link.
    Need help from Excel and SAP expert! [SOLVED]
    http://visualbasic.ittoolbox.com/groups/technical-functional/vb-vba-l/call-transaction-in-sap-from-excel-vba-macro-and-download-alv-list-object-results-to-spreadsheet-3335996
    Regards,
    Rafi

  • How to upload data from excel to SAP and options to be used

    How to upload data from excel to SAP and options to be used
    thank you,
    Regards,
    Jagrut Bharatkumar shukla

    Hi Jagrut,
        You can use gui_upload.
    chk the sample program mentioned below.
    REPORT ZFTP .
    DATA: BEGIN OF I_FILE OCCURS 0,
    DATA(2000) TYPE C,
    END OF I_FILE.
    DATA: BEGIN OF I_FILE2 OCCURS 0,
    DATA(2000) TYPE C,
    END OF I_FILE2.
    DATA: W_COUNT TYPE I.
    PARAMETERS: P_FILEN TYPE STRING,
    P_FILE2 TYPE STRING,
    P_NUM(4) TYPE N..
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILEN.
    PERFORM F_FILE_GET USING P_FILEN TEXT-G01.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE2.
    PERFORM F_FILE_GET USING P_FILE2 TEXT-G01.
    START-OF-SELECTION.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = P_FILEN
    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 = I_FILE
    IF SY-SUBRC <> 0.
    MESSAGE E024(Z1).
    ENDIF.
    LOOP AT I_FILE.
    W_COUNT = W_COUNT + 1.
    IF NOT W_COUNT > P_NUM.
    MOVE I_FILE TO I_FILE2.
    APPEND I_FILE2.
    ENDIF.
    ENDLOOP.
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    BIN_FILESIZE =
    filename = P_FILE2
    FILETYPE = 'ASC'
    APPEND = ' '
    WRITE_FIELD_SEPARATOR = 'X'
    HEADER = '00'
    TRUNC_TRAILING_BLANKS = ' '
    WRITE_LF = 'X'
    COL_SELECT = ' '
    COL_SELECT_MASK = ' '
    DAT_MODE = ' '
    CONFIRM_OVERWRITE = ' '
    NO_AUTH_CHECK = ' '
    CODEPAGE = ' '
    IGNORE_CERR = ABAP_TRUE
    REPLACEMENT = '#'
    WRITE_BOM = ' '
    TRUNC_TRAILING_BLANKS_EOL = 'X'
    WK1_N_FORMAT = ' '
    WK1_N_SIZE = ' '
    WK1_T_FORMAT = ' '
    WK1_T_SIZE = ' '
    IMPORTING
    FILELENGTH =
    tables
    data_tab = I_FILE2
    FIELDNAMES =
    *& Form F_FILE_GET
    text
    -->P_P_FILEN text
    -->P_TEXT_G01 text
    FORM F_FILE_GET USING L_FILENA L_TEXT.
    CALL FUNCTION 'WS_FILENAME_GET'
    EXPORTING
    DEF_FILENAME = ' '
    DEF_PATH = ' '
    MASK = ',.,*.TXT.'
    MODE = 'O'
    TITLE = L_TEXT
    IMPORTING
    FILENAME = L_FILENA
    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.
    Reward if helpful.
    Regards,
    Harini.S

  • How to Upload Excel sheet in DB or internal table using SAP NetWeaver ABAP

    Dear All experts,
    Pls provide guidance  to Upload Excel sheet in DB or internal table using ABAP in  ( SAP NetWeaver stack  )
    Regards
    Machindra
    Edited by: Machindra Patade on Apr 8, 2010 3:07 PM

    Please search before posting.
    Thread locked.
    Thomas

  • ERROR while uploading data from EXCEl to sap using ALSM_EXCEL FUNCION MODULE

    Hi Experts,
    I am uploading excel data into sap suing function module ALSM_EXCEl_TO_INTERNAL_TABLE , used this funcion module in the program while running the program one blank excel sheet is opening and data is not uploading into internal table . even same blank sheet is opeining if we user
    CONVERT_EXCEL_TO_INTERNAL function module also.
    can you please tell me why this error is coming how to over come this error.
    My excel sheet data records are less then 10000.
    Thanks & regards
    kiran

    Hi Taranam,
    Use FM ALSM_EXCEL_TO_INTERNAL_TABLE.
    Regards,
    Atish

  • Error message while upload excel file (with macro) to sap (iw28)

    While upload excel file to sap through iw28, i get error message (vb)
    u2022     i have to say that the excel file contain macro , with out the macro , work fine .
    u2022     The error display just in refresh command.
    the error message :
    Public Sub ALV_CUS_Exit()
    Dim objs As ChartObjects
    Dim obj As ChartObject
    Dim sheet As Worksheet
    Dim r As Range
    For Each sheet In Sheets
    Set objs = sheet.ChartObjects
    For Each obj In objs
    Set r = Sheets("RawData").UsedRange
    obj.Chart.SetSourceData Source:=r
    Next obj
    Next sheet
    End Sub

    hi,
    This is releated to the ABAP coding...There might be some ouput problem in the Abap list viewer...Pls check it with the ABAP consultant...
    Regards
    Priyanka.P

  • Upload excel file in SAP BI-7.0

    Hi ,
    i  need to  upload an excel  file in SAP BI 7.0 where the standard r/3 fm are not available.
    Currently we uploading a file in CSV format but now we want to upload using XLS also.
    ia way to upload excel  file in SAP BI 7.0
    Best Regards,
    Sharad
    Edited by: sharad narayan on Jan 7, 2011 10:58 AM
    while searching the forum i  found the fm MS_EXCEL_OLE_STANDARD_DAT .
    but while using this FM i  am getting the exception file not exist.
    Kindlu  suggest what  to  do
    i  even tried the FM TMP_GUI_GET_FILE_EXIST' to  check  the existence of the file.
    even then same problem.
    Please suggest
    Edited by: sharad narayan on Jan 10, 2011 2:51 PM

    Hi,
    Scheduled jobs are the jobs for which we have scheduled for a time, may be daily so that each day the scheduled jobs will trigger at the time given.So that every time u need not to trigger the job manully urself as the schedule time will hit the job will trigger itself.
    Released job means the job which is in between Sheduled state and active state.say For eg: 10 jobs are Scheduled in a queue Job no 1 is released from the queue that means any moment it will be in active state.So it is the state between Schedule and Active state of a job.
    Thanks
    Varun

  • Uploading Excel file to SAP

    Hi Friends,
    Iam trying to Upload Excel file into SAP using the FM
    ALSM_EXCEL_TO_INTERNAL_TABLE. But it is going to dump n the error is                                                                             
    The call to the function module "ALSM_EXCEL_TO_INTERNAL_TABLE" is incorrect:                                                                               
    In the function module interface, you can specify only                          
    fields of a specific type and length under "INTERN".                            
    Although the currently specified field                                          
    "ITAB" is the correct type, its length is incorrect.                            
    I have attached the code also.
    Please let me know where iam getting the error.
    Code :
    Tables : mara,
             ztable.
    parameters : p_infile like rlgrap-filename.
    data : begin of itab occurs 0,
           matnr like mara-matnr,
           mbrsh like mara-mbrsh,
           matkl like mara-matkl,
           end of itab.
           CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
             EXPORTING
               FILENAME                      = p_infile
               I_BEGIN_COL                   = 1
               I_BEGIN_ROW                   = 1
               I_END_COL                     = 100
               I_END_ROW                     = 100
             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.
    sort itab by matnr.
    loop at itab.
    write:/ itab.
    *modify ztable from table itab.
    endloop.

    hi check this code:
    DATA : BEGIN OF TYP_INPUT ,
               MATNR LIKE MARA-MATNR,
               WERKS LIKE MARC-WERKS,
               LGORT LIKE MARD-LGORT,
               LGNUM LIKE MLGN-LGNUM,
               LGTYP LIKE MLGT-LGTYP,
               LTKZA LIKE MLGN-LTKZA,
               LTKZE LIKE MLGN-LTKZE,
               LGBKZ LIKE MLGN-LGBKZ,
               LGPLA LIKE MLGT-LGPLA,
            END OF TYP_INPUT.
    *Input File Data
    DATA : IT_FILE LIKE TYP_INPUT OCCURS 0 WITH HEADER LINE.
    *"INTERNAL TAB TO TAKE EXCEL SHEET.
    DATA : IT_EXCEL    LIKE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.
           CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
            EXPORTING
                 FILENAME                = P_PFILE
                 I_BEGIN_COL             = 1
                 I_BEGIN_ROW             = 2
                 I_END_COL               = 9
                 I_END_ROW               = 6000
            TABLES
                 INTERN                  = IT_EXCEL
            EXCEPTIONS
                 INCONSISTENT_PARAMETERS = 1
                 UPLOAD_OLE              = 2
                 OTHERS                  = 3.
    * IT_EXCEL CONTAINS DATA IN THE FORM OF ROW, COL, VALUE       *
    * CONVERTING THAT INTERNAL TABLE TO FORMAT THAT OF EXCEL SHEET *
       IF NOT IT_EXCEL[] IS INITIAL.
         SORT IT_EXCEL BY ROW COL.
         LOOP AT IT_EXCEL.
           CASE IT_EXCEL-COL.
            WHEN 1.
                  IT_FILE-MATNR = IT_EXCEL-VALUE.
            WHEN 2.
                  IT_FILE-WERKS = IT_EXCEL-VALUE.
            WHEN 3.
                  IT_FILE-LGORT = IT_EXCEL-VALUE.
            WHEN 4.
                  IT_FILE-LGNUM = IT_EXCEL-VALUE.
            WHEN 5.
                  IT_FILE-LGTYP = IT_EXCEL-VALUE.
            WHEN 6.
                  IT_FILE-LTKZA = IT_EXCEL-VALUE.
            WHEN 7.
                  IT_FILE-LTKZE = IT_EXCEL-VALUE.
            WHEN 8.
                  IT_FILE-LGBKZ = IT_EXCEL-VALUE.
            WHEN 9.
                  IT_FILE-LGPLA = IT_EXCEL-VALUE.
           ENDCASE.
           AT END OF ROW.
             APPEND IT_FILE.
             CLEAR IT_FILE.
           ENDAT.
         ENDLOOP.
       ELSE.
         MESSAGE I000  WITH 'The input file is empty'.
         STOP.
       ENDIF.

  • Data upload from excel into SAP

    Hi Gurus
    Could anyone please guide me how to upload excel data into SAP?
    I need to update existing Gross weight and Net weight data. Got new data in excel format.So need to upload excel file straight into SAP and update the data.
    Step by step procedure will be much appreciated.
    Rgds
    Utpal

    try with bdc .....
    below coding is move the data from excel to internal table ....
    TYPES: BEGIN OF s_ovro,
              VKORG LIKE V_TVSFK-VKORG,
              VTWEG LIKE V_TVSFK-VTWEG,
              SPART LIKE V_TVSFK-SPART,
              STGKU LIKE V_TVSFK-STGKU,
              STGAK LIKE V_TVSFK-STGAK,
              STAFO LIKE V_TVSFK-STAFO,
           END OF s_ovro.
    DATA: I_OVRO TYPE TABLE OF s_ovro,
          w_ovro type s_ovro.
    data : request(15) type c,
            i type c.
    DATA : IT_EXCEL TYPE STANDARD TABLE OF ALSMEX_TABLINE WITH HEADER LINE.
    FIELD-SYMBOLS: <FS1> TYPE ANY.
    include bdcrecx1.
    SELECTION-SCREEN BEGIN OF BLOCK DATA WITH FRAME.
    PARAMETERS: P_FILE TYPE  RLGRAP-FILENAME DEFAULT 'C:\Documents and Settings\itfactory\Desktop\sd1.xls' OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK DATA.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          PROGRAM_NAME  = SYST-CPROG
          DYNPRO_NUMBER = SYST-DYNNR
          FIELD_NAME    = 'P_FILE'
        IMPORTING
          FILE_NAME     = P_FILE.
    start-of-selection.
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        EXPORTING
          FILENAME                = P_FILE
          I_BEGIN_COL             = 1
          I_BEGIN_ROW             = 1
          I_END_COL               = 24
          I_END_ROW               = 60000
        TABLES
          INTERN                  = IT_EXCEL
        EXCEPTIONS
          INCONSISTENT_PARAMETERS = 1
          UPLOAD_OLE              = 2
          OTHERS                  = 3.
      LOOP AT IT_EXCEL.
        ASSIGN COMPONENT IT_EXCEL-COL OF STRUCTURE
        W_ovro TO <FS1>.
        <FS1> = IT_EXCEL-VALUE.
        AT END OF ROW.
         MOVE-CORRESPONDING: Wib TO Iib.
          APPEND w_ovro to I_ovro.
          CLEAR W_ovro.
        ENDAT.
      ENDLOOP.
    through bdc program update the data from internal table to bdc...

  • Error Raised while uploading Excel file to SAP

    Hi All,
    I am getting error while uploading excel file into SAP using the function module 'TEXT_CONVERT_XLS_TO_SAP'.
    Error Message is UX(893) -  'Excel file & cannot be processed' .
    Please let me know what went wrong.
    Regards,
    Deepthi

    Hi,
    1 .TEXT_CONVERT_XLS_TO_SAP  Funtion module will work if you have installed Microsoft Excel at front end.
    2. Whenyou declare internal table for upload, specify the char only in the strcture ,don't specify any data element or dictionary reference.    If the data element and dictionaly reference is character field then its ok.
    eg.
    types:begin of st_data,
               field1 type char15,
               field2 type char23,
              endif.
    3. Close the excel before you upload
    Hope this might solve your issue.
    Regards
    Aromal R

  • Uploading Excel File in SAP In Background Mode

    Dear All,
    We require to upload Excel File in SAP in Background Mode.
    Could anyone suggest me the Function Module for this?
    Or any other method..........please.
    Thanks in advance for ur kind help.
    Best Regards,
    Prasad

    hi check this..
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/9831750a-0801-0010-1d9e-f8c64efb2bd2
    Download in Background
    http://sapabap.iespana.es/sap/info/rfcexec/rfcexec_e.htm
    Reward if find useful

  • Uploading excel files from ITS to sap

    Hi all,
    I want to upload excel files from ITS to sap system ECC 6.0 .I am using standalone ITS.Someone please help me find a solution for this.What are the steps involved in it?
    Thanks in advance
    Shinu

    Hi Shinu,
    this seems to be a misunderstanding. The ITS does not have excel files.
    Did you mean to say that you have an application which allows to upload
    files? This application might work using the webgui service of the ITS.
    Try it out!
    best regards
    Tobias

Maybe you are looking for