Upload data from excel into database through pl/sql

Hi All,
I have excel which contains data lets say employee details,
I have one upload button ,which is used to upload excel and then i want to map the cell of excel to the database column and through plsql code i want to upload the excel data into database.
In short ,i want to upload the data from excel into database using plsql code,
or suggest me any other way to do this.(except the data load method present in apex)
Thanks,
Jitendra

if you use APEX 4 you can define you own table
the code below is for APEX 3
PROCEDURE pro_carga_planilla_prosp( p_archivo VARCHAR2) IS
v_blob_data BLOB;
v_blob_len NUMBER;
v_position NUMBER;
v_raw_chunk RAW(10000);
v_char CHAR(1);
c_chunk_len number := 1;
v_line VARCHAR2 (32767) := NULL;
v_data_array wwv_flow_global.vc_arr2;
v_rows number;
v_sr_no number := 1;
v_ok boolean := true;
v_local_ok BOOLEAN := TRUE;
v_reg_ok NUMBER := 0;
v_reg_ko NUMBER := 0;
v_localidad_id NUMBER;
v_departamento_id NUMBER;
v_cargo_id NUMBER;
v_prospecto_id NUMBER;
v_asesor_id NUMBER;
V_REG prospectos%rowtype;
BEGIN
-- Read data from wwv_flow_files</span>
select blob_content into v_blob_data
from wwv_flow_files
where name= p_archivo;
v_blob_len := dbms_lob.getlength(v_blob_data);
v_position := 1;
-- Read and convert binary to char</span>
WHILE ( v_position <= v_blob_len ) LOOP
v_raw_chunk := dbms_lob.substr(v_blob_data,c_chunk_len,v_position);
v_char := chr(hex_to_decimal(rawtohex(v_raw_chunk)));
v_line := v_line || v_char;
-- pro_log('linea '||v_line);
v_position := v_position + c_chunk_len;
-- When a whole line is retrieved </span>
IF v_char = CHR(10) THEN
-- Convert comma to : to use wwv_flow_utilities </span>
v_line := replace(REPLACE (v_line, ',', ':'), ';',':');
v_line := replace(replace(v_line, chr(10)),chr(13));
if substr(v_line,1,1)= ':' then
v_line := '0'||v_line;
end if;
if instr(v_line,':',1,21) = 0 then
if instr(v_line,':',1,20) = 0 then
v_line:=v_line||':';
end if;
v_line:=v_line||':';
end if;
-- pro_log(v_line);
-- Convert each column separated by : into array of data </span>
v_data_array := wwv_flow_utilities.string_to_table (v_line);
-- Insert data into target table </span>
IF v_data_array(1) IS NOT NULL AND
v_sr_no <> 1 THEN
V_REG.NOMBRE:=ltrim(rtrim(v_data_array(2)));
V_REG.RAZON_SOCIAL:=v_data_array(3);
V_REG.DIRECCION := v_data_array(4)||' '||v_data_array(5);
-- PRO_LOG('PROSP 1 ' ||v_sr_no);
v_localidad_id := pack_empresas.get_localidad(v_data_array(6));
-- PRO_LOG('PROSP 1.1 '||v_sr_no);
V_REG.LOCALIDAD_ID:=v_localidad_id;
-- PRO_LOG('PROSP 1.2 '||v_sr_no);
V_REG.CODIGO_POSTAL:=LTRIM(RTRIM(v_data_array(7)) );
-- PRO_LOG('PROSP 1.3 '||v_sr_no);
-- PRO_LOG('PROSP 1.1 '||v_sr_no);
v_departamento_id := pack_empresas.get_departamento(v_data_array(8));
-- PRO_LOG('PROSP 1.4 '||v_sr_no);
V_REG.DEPARTAMENTO_ID:=v_departamento_id;
-- PRO_LOG('PROSP 1.5 '||v_sr_no);
V_REG.TELEFONO:=v_data_array(9);
--PRO_LOG('PROSP 1.6 '||v_sr_no);
V_REG.TELEFONO2:=v_data_array(10);
-- PRO_LOG('PROSP 1.7 '||v_sr_no);
V_REG.RUBRO:=v_data_array(11);
-- PRO_LOG('PROSP 1.8 '||v_sr_no);
V_REG.RUC:=ltrim(rtrim(v_data_array(12)));
-- PRO_LOG('PROSP 1.9 '||v_sr_no);
-- pro_log(v_data_array(1));
-- pro_log(v_data_array(2));
V_REG.CANTIDAD_EMPLEADOS:=RTRIM(LTRIM(v_data_array(13)));
-- PRO_LOG('PROSP 1.10 '||v_sr_no);
-- pro_log(v_data_array(14));
V_REG.CANTIDAD_BENEFICIARIOS:=RTRIM(LTRIM(v_data_array(14)));
--PRO_LOG('PROSP 1.11 '||v_sr_no);
V_REG.MAIL:=v_data_array(19);
-- pro_log(V_REG.MAIL);
-- PRO_LOG('PROSP 1.12 '||v_sr_no);
-- v_data_array(20):= replace(replace(v_data_array(20),chr(10)),chr(13));
if not v_data_array.exists(20) then
-- pro_log('existe');
-- pro_log(ltrim(rtrim(replace(replace(v_data_array(20),chr(10)),chr(13)))));
V_REG.Proveedor:= ltrim(rtrim(replace(replace(v_data_array(20),chr(10)),chr(13))));
else
v_data_array(20):=null;
end if;
-- V_REG.PROVEEDOR:=v_data_array(20);
-- PRO_LOG('PROSP 1.13 '||v_sr_no);
if not v_data_array.exists(21) then
V_REG.OBSERVACIONES:=v_data_array(21);
else
v_data_array(21):=null;
end if;
-- PRO_LOG('PROSP 1.14 '||v_sr_no);
-- PRO_LOG('PROSP 1.2 '||v_sr_no);
insert into prospectos (nombre,razon_social, direccion,localidad_id,codigo_postal,
departamento_id, telefono, telefono2, rubro,ruc,cantidad_empleados,
cantidad_beneficiarios,mail,proveedor,observaciones)
values (nvl(ltrim(rtrim(v_data_array(2))),v_data_array(3)), v_data_array(3),
v_data_array(4)||' '||v_data_array(5),
v_localidad_id, LTRIM(RTRIM(v_data_array(7))),v_departamento_id, v_data_array(9),
v_data_array(10),v_data_array(11), ltrim(rtrim(v_data_array(12))), RTRIM(LTRIM(v_data_array(13))),
RTRIM(LTRIM(v_data_array(14))),v_data_array(19),v_data_array(20), v_data_array(21))
returning prospecto_id INTO v_prospecto_id;
-- PRO_LOG('PROSP 2');
v_cargo_id := pack_empresas.get_cargo(v_data_array(17));
-- PRO_LOG('PROSP 3');
insert into prospecto_contactos (prospecto_id,nombre,apellido,cargo_id,
telefono,mail)
values (v_prospecto_id, nvl(v_data_array(15),'S/N'), nvl(v_data_array(16),'S/A'),
v_cargo_id, v_data_array(18), v_data_array(19));
-- PRO_LOG('PROSP 4');
v_asesor_id := pack_empresas.get_asesor(v_data_array(1));
-- PRO_LOG('PROSP 5');
insert into asignaciones (prospecto_id,asesor_id,fecha_asignacion)
values (v_prospecto_id, v_asesor_id, trunc(sysdate));
-- PRO_LOG('PROSP 6');
END IF;
-- Clear out
v_line := NULL;
v_sr_no := v_sr_no + 1;
END IF;
END LOOP;
delete wwv_flow_files
where name= p_archivo;
END pro_carga_planilla_prosp;
function hex_to_decimal
--this function is based on one by Connor McDonald
--http://www.jlcomp.demon.co.uk/faq/base_convert.html
( p_hex_str in varchar2 ) return number
is
v_dec number;
v_hex varchar2(16) := '0123456789ABCDEF';
begin
v_dec := 0;
for indx in 1 .. length(p_hex_str)
loop
v_dec := v_dec * 16 + instr(v_hex,upper(substr(p_hex_str,indx,1)))-1;
end loop;
return v_dec;
end hex_to_decimal;

Similar Messages

  • 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>

  • Uploading data from Excel into data dictionary

    Hi all,
    I am new to ABAP.  I have a huge excel spreadsheet and I want to develop some graphs and reports using ABAP ALVs.  I want to know if I can import an excel spreadsheet into data dictionary, create a table and then develop an ALV report. 
    Plz let me know. 
    Thank you.
    Krish.

    Refer to this sample code
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/36f08758-0a01-0010-c291-c03004aeb1af">Function Module To Upload Data From</a>
    or
    Use ALSM_EXCEL_TO_INTERNAL_TABLE function module to upload.
    Example programs added
    http://www.sapdevelopment.co.uk/file/file_upexcel.htm
    excel upload program
    UPLOADING FROM EXCEL TO Z TABLE
    Regds
    Manohar
    Message was edited by: Manohar Reddy

  • Uploading data from excel sheets through BDC's into sap system

    hi guys,
    can you please help me with this. As we use gui_upload to upload data from flat file to sap system, which function module you use to upload data from Excel sheet to sap system through bdc's

    hello pavan,
    welcome to SDN
    check the below program
    REPORT ZEXCEL_TO_INTERNAL .
    data: begin of itab occurs 0,
          name(20) type c,
          addre(20) type c,
          end of itab.
    DATA : ITAB1 LIKE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.
    DATA : B1 TYPE I VALUE 1,
           C1 TYPE I VALUE 1,
           B2 TYPE I VALUE 100,
           C2 TYPE I VALUE 9999.
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
      EXPORTING
        FILENAME                   =
        'C:\Documents and Settings\administrator\Desktop\ppcon001bd_24.xls'
        I_BEGIN_COL                   = B1
        I_BEGIN_ROW                   = C1
        I_END_COL                     = B2
        I_END_ROW                     = C2
      TABLES
        INTERN                        = itab1
    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.
    loop at itab1.
    write:/ itab1.
    Endlop.
    Regards,
    Naveen

  • Upload data from excel (not the excle file) into SAP

    Guys,
    how can we upload data from excel sheet into SAP? I mean just the data not the entire file,
    I have a requirement where user press a button in excel sheet and the data in the sheet will get uploaded into SAP.
    I am sure we have to use BAPI and some VB programming for macros, I will really appriciate if anyone can help how to achive this.
    some sample code exampe will help.
    Cheers!

    I think u r writing BDC for Uploading the data from excel flile to sap. for this is the code I am sending u can use then for Uploading data from excel to sap.
    DATA: lv_filename TYPE rlgrap-filename.
    FIELD-SYMBOLS : <fs>.
    DATA : l_intern TYPE alsmex_tabline OCCURS 0 WITH HEADER LINE.
    DATA : l_index TYPE i.
    PARAMETERS : startcol TYPE i ,
          startrow TYPE i ,
          endcol TYPE i ,
          endrow TYPE i .
    PARAMETERS: p_flnam LIKE rlgrap-filename.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_flnam.
      CALL FUNCTION 'F4_FILENAME'
    EXPORTING
       program_name        = sy-repid
      FIELD_NAME          = ' '
       IMPORTING
         file_name           = p_flnam .
      MOVE p_flnam TO lv_filename.
    Uploading the flat file from the desktop
    START-OF-SELECTION.
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        EXPORTING
          filename                      = lv_filename
          i_begin_col                   = startcol
          i_begin_row                   = startrow
          i_end_col                     = endcol
          i_end_row                     = endrow
        TABLES
          intern                        = l_intern
    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 l_intern BY row col.
      LOOP AT l_intern.
        MOVE l_intern-col TO l_index.
        ASSIGN COMPONENT l_index OF STRUCTURE itab TO <fs>.
        MOVE l_intern-value TO <fs>.
        AT END OF row.
          APPEND itab.
          CLEAR itab.
        ENDAT.
      ENDLOOP.
    I hope it will help u.
    Regards
    Nayan

  • Upload data from excel file to Oracle table

    Dear All,
    I have to upload data from excel file to Oracle table without using third party tools and without converting into CSV file.
    Could you tell me please how can i do this using PLSQl or SQL Loader.
    Thnaks in Advance..

    Dear All,
    I have to upload data from excel file to
    Oracle table without using third party tools and
    without converting into CSV file.
    Could you tell me please how can i do this
    using PLSQl or SQL Loader.
    Thnaks in Advance..As billy mentioned using ODBC interface ,the same HS service which is a layer over using traditional ODBC to access non oracle database.Here is link you can hit and trial and come out here if you have any problem.
    http://www.oracle-base.com/articles/9i/HSGenericConnectivity9i.php[pre]
    Khurram                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Uploading data from EXCEL

    Is any standard transaction to upload data from excel to a z table?
    i mean, to avoid to make a zreport using gui_upload fm and then make the insert into the ztable?

    hi.....
    upload the excel file in your internal table and then use BDC to updated the database table.
    FM's to upload Excel:
    GUI_UPLOAD
    KCD_EXCEL_OLE_TO_INT_CONVERT
    ALSM_EXCEL_TO_INTERNALTABLE
    refer to the link:
    http://diocio.wordpress.com/2007/02/12/sap-upload-excel-document-into-internal-table-2/
    http://www.sap-img.com/abap/learning-bdc-programming.htm
    thanks
    nikita

  • Change Value While Uploading data From Excel File

    Dear Expert,
    Please guide me is it Possible?, if yes then How?
    We have one BDC Uploader there After uploading data from Excel File, i want to check one field like this....
    if it_f65data-newbs contains any Alphabet.
    then user Should be able to change value on the same time while executing Program in table.
    Please tell me how i can change value in running program
    Regards'
    Shelly Malik

    Hi,
    What you can probably do is, perform a consistency check on your data in the internal table and segregate all those rows that have inconsistent data (in your case, the field NEWBS containing albhabets) into another temporary internal table. Display the temporary internal table in an editable ALV grid saying that these data have not been inserted to the database, coz they have inconsistent data in the field NEWBS. Allow the user to edit and then save the data which will consequently refresh the internal table contents.

  • Upload data from excel to Ztable with statistics

    Hi,
    I have a requirement to upload data from excel sheet to ztable .
    Here i need tp provide the user with the execution statistics like
    1.Number of records read from the Excel spread-sheet
    2. Number records processed successfully
    3. Number records with Error
    4. Name and location of Error Log-file (text-file format)
    5. Name and location of the file containing error records (Excel spread-sheet format)
    I would appreciate if any of you have code written for the same

    See the below example code to upload from xl file to sap
    REPORT ZLWMI151_UPLOAD no standard page heading
                           line-size 100 line-count 60.
    *tables : zbatch_cross_ref.
    data : begin of t_text occurs 0,
           werks(4) type c,
           cmatnr(15) type c,
           srlno(12) type n,
           matnr(7) type n,
           charg(10) type n,
           end of t_text.
    data: begin of t_zbatch occurs 0,
          werks like zbatch_cross_ref-werks,
          cmatnr like zbatch_cross_ref-cmatnr,
          srlno like zbatch_cross_ref-srlno,
          matnr like zbatch_cross_ref-matnr,
          charg like zbatch_cross_ref-charg,
          end of t_zbatch.
    data : g_repid like sy-repid,
           g_line like sy-index,
           g_line1 like sy-index,
           $v_start_col         type i value '1',
           $v_start_row         type i value '2',
           $v_end_col           type i value '256',
           $v_end_row           type i value '65536',
           gd_currentrow type i.
    data: itab like alsmex_tabline occurs 0 with header line.
    data : t_final like zbatch_cross_ref occurs 0 with header line.
    selection-screen : begin of block blk with frame title text.
    parameters : p_file like rlgrap-filename obligatory.
    selection-screen : end of block blk.
    initialization.
      g_repid = sy-repid.
    at selection-screen on value-request for p_file.
      CALL FUNCTION 'F4_FILENAME'
           EXPORTING
                PROGRAM_NAME = g_repid
           IMPORTING
                FILE_NAME    = p_file.
    start-of-selection.
    Uploading the data into Internal Table
      perform upload_data.
      perform modify_table.
    top-of-page.
      CALL FUNCTION 'Z_HEADER'
      EXPORTING
        FLEX_TEXT1       =
        FLEX_TEXT2       =
        FLEX_TEXT3       =
    *&      Form  upload_data
          text
    FORM upload_data.
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
           EXPORTING
                FILENAME                = p_file
                I_BEGIN_COL             = $v_start_col
                I_BEGIN_ROW             = $v_start_row
                I_END_COL               = $v_end_col
                I_END_ROW               = $v_end_row
           TABLES
                INTERN                  = itab
           EXCEPTIONS
                INCONSISTENT_PARAMETERS = 1
                UPLOAD_OLE              = 2
                OTHERS                  = 3.
      IF SY-SUBRC <> 0.
        write:/10 'File '.
      ENDIF.
      if sy-subrc eq 0.
        read table itab index 1.
        gd_currentrow = itab-row.
        loop at itab.
          if itab-row ne gd_currentrow.
            append t_text.
            clear t_text.
            gd_currentrow = itab-row.
          endif.
          case itab-col.
            when '0001'.
              t_text-werks = itab-value.
            when '0002'.
              t_text-cmatnr = itab-value.
            when '0003'.
              t_text-srlno = itab-value.
            when '0004'.
              t_text-matnr = itab-value.
            when '0005'.
              t_text-charg = itab-value.
          endcase.
        endloop.
      endif.
      append t_text.
    ENDFORM.                    " upload_data
    *&      Form  modify_table
          Modify the table ZBATCH_CROSS_REF
    FORM modify_table.
      loop at t_text.
        t_final-werks = t_text-werks.
        t_final-cmatnr = t_text-cmatnr.
        t_final-srlno = t_text-srlno.
        t_final-matnr = t_text-matnr.
        t_final-charg = t_text-charg.
        t_final-erdat = sy-datum.
        t_final-erzet = sy-uzeit.
        t_final-ernam = sy-uname.
        t_final-rstat = 'U'.
        append t_final.
        clear t_final.
      endloop.
      delete t_final where werks = ''.
      describe table t_final lines g_line.
      sort t_final by werks cmatnr srlno.
    Deleting the Duplicate Records
      perform select_data.
      describe table t_final lines g_line1.
      modify zbatch_cross_ref from table t_final.
      if sy-subrc ne 0.
        write:/ 'Updation failed'.
      else.
        Skip 1.
        Write:/12 'Updation has been Completed Sucessfully'.
        skip 1.
        Write:/12 'Records in file ',42 g_line .
        write:/12 'Updated records in Table',42 g_line1.
      endif.
      delete from zbatch_cross_ref where werks = ''.
    ENDFORM.                    " modify_table
    *&      Form  select_data
          Deleting the duplicate records
    FORM select_data.
      select werks
             cmatnr
             srlno from zbatch_cross_ref
             into table t_zbatch for all entries in t_final
             where werks = t_final-werks
             and  cmatnr = t_final-cmatnr
             and srlno = t_final-srlno.
      sort t_zbatch by werks cmatnr srlno.
      loop at t_zbatch.
        read table t_final with key werks = t_zbatch-werks
                                    cmatnr = t_zbatch-cmatnr
                                    srlno = t_zbatch-srlno.
        if sy-subrc eq 0.
          delete table t_final .
        endif.
        clear: t_zbatch,
               t_final.
      endloop.
    ENDFORM.                    " select_data
    Reward Points if it is helpful
    Thanks
    Seshu

  • Upload data from excel to screen

    Hi
    I have created one Table Maintanence Generator with only one screen (Table control ). Here i have to upload data from excel to table control. How to upload data from excel to table control.

    Hi,
    Use this code to get data from excel to internal table. Later put the logic in PBO of the screen to fill the table control from internal table.
    PARAMETERS: po_file TYPE rlgrap-filename DEFAULT 'E:test.xls'.
    TYPES: BEGIN OF t_final,
              empno(10) TYPE c,
              name(30) TYPE c,
              state(25) TYPE c,
           END OF t_final.
    PARAMETERS: po_file TYPE rlgrap-filename.
    DATA: i_tab    TYPE STANDARD TABLE OF alsmex_tabline,
          i_final  TYPE STANDARD TABLE OF t_final,
          wa_tab   TYPE alsmex_tabline,
          wa_final TYPE t_final.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR po_file.
    PERFORM open_folder.
    START-OF-SELECTION.
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
         EXPORTING
              filename                = po_file
              i_begin_col             = 1
              i_begin_row             = 1
              i_end_col               = 3
              i_end_row               = 65256
         TABLES
              intern                  = i_tab
         EXCEPTIONS
              inconsistent_parameters = 1
              upload_ole              = 2
              OTHERS                  = 3.
    CHECK NOT i_tab[] IS INITIAL.
    LOOP AT i_tab INTO wa_tab.
      CASE wa_tab-col.
        WHEN 1.
          wa_final-empno = wa_tab-value.
        WHEN 2.
          wa_final-name = wa_tab-value.
        WHEN 3.
          wa_final-state = wa_tab-value.
      ENDCASE.
      AT END OF row.
        APPEND wa_final TO i_final.
        CLEAR wa_final.
      ENDAT.
    ENDLOOP.
    FORM open_folder .
      DATA: li_file  TYPE TABLE OF sdokpath,
            lwa_file TYPE sdokpath.
      CLEAR: p_fname, lwa_file.
      REFRESH li_file[].
      CALL FUNCTION 'TMP_GUI_FILE_OPEN_DIALOG'
           TABLES
                file_table = li_file
           EXCEPTIONS
                cntl_error = 1
                OTHERS     = 2.
      IF sy-subrc IS INITIAL.
        READ TABLE li_file INTO lwa_file INDEX 1.
        IF sy-subrc IS INITIAL.
         p_fname = lwa_file-pathname.
        ENDIF.
      ENDIF.
    ENDFORM.                    " open_folder
    Thanks,
    Vinod.
    Edited by: Vinod Reddy Vemuru on Jul 28, 2008 4:50 PM

  • Upload data from excel to oracle table

    Hi,
    if i'm user and using an application and i want to upload data from excel to oracle table on button click . Is it possible by using sql loader.
    If yes then please clarify it .
    is it possible from client end.
    thanks
    kam

    Yes it is possible using SQL*LDR, External tables and ORCL Export Utility. Though I didn't try Export Utility to load the external files.
    SQLLdr sysntax:
    Create a control file.
    It looks like this
    Load data
    Infile 'source.dat' 
    Into Table tablename
    Fields terminated by ',' optionally enclosed by '"'
    {code}
    then use sqlldr command from your OS.
    {code}
    sqlldr userid/password@sid control = filename.ctl, data = source.dat, log = logname.log, bad = badname.log, discard = discardname.discard
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Upload data from excel to application server

    Hi all,
    Is there any process to upload data from excel to application server other than reading the data from excel to z program through gui_upload and transferring the data to application server.
    I want to run background job for a BDC program with the data present in the excel file.
    Thanks & regards
    sreehari p.

    Hi Sreehari,
    Please use the tcode - CG3Z, where you can transfer the file from presentation server to the application server.
    Regards,
    Selva K.

  • Upload data from excel with vba by calling a function module

    Hello all,
    i have a problem with the function module "ALSM_EXCEL_TO_INTERNAL_TABLE". I will call this function module with vba to load data from excel to sap with a Buttonclick. I have copied this function module and set it remotable. But i can´t call it from excel.
    Can you give me some tips how can i
    upload data from excel with vba by click a button.
    The problem seems the function: call method cl_gui_frontend_services=>clipboard_import in the function module, because when i comment this function call the vba-call is true but no results. 
    How can I call the function module correct with vba?
    Thanks a lot for your tips!!!!
    Chris
    Message was edited by:
            Christoph Kirschner

    HI
    Uploading data directly from Excel file format
    * Upload data direct from excel.xls file to SAP
    REPORT ZEXCELUPLOAD.
    PARAMETERS: filename LIKE rlgrap-filename MEMORY ID M01,
                begcol TYPE i DEFAULT 1 NO-DISPLAY,
                begrow TYPE i DEFAULT 1 NO-DISPLAY,
                endcol TYPE i DEFAULT 100 NO-DISPLAY,
                endrow TYPE i DEFAULT 32000 NO-DISPLAY.
    * Tick don't append header
    PARAMETERS: kzheader AS CHECKBOX.
    DATA: BEGIN OF intern OCCURS 0.
            INCLUDE STRUCTURE  alsmex_tabline.
    DATA: END OF intern.
    DATA: BEGIN OF intern1 OCCURS 0.
            INCLUDE STRUCTURE  alsmex_tabline.
    DATA: END OF intern1.
    DATA: BEGIN OF t_col OCCURS 0,
           col LIKE alsmex_tabline-col,
           size TYPE i.
    DATA: END OF t_col.
    DATA: zwlen TYPE i,
          zwlines TYPE i.
    DATA: BEGIN OF fieldnames OCCURS 3,
            title(60),
            table(6),
            field(10),
            kz(1),
          END OF fieldnames.
    * No of columns
    DATA: BEGIN OF data_tab OCCURS 0,
           value_0001(50),
           value_0002(50),
           value_0003(50),
           value_0004(50),
           value_0005(50),
           value_0006(50),
           value_0007(50),
           value_0008(50),
           value_0009(50),
           value_0010(50),
           value_0011(50),
           value_0012(50),
           value_0013(50),
           value_0014(50),
           value_0015(50),
           value_0016(50),
           value_0017(50),
           value_0018(50),
           value_0019(50),
           value_0020(50),
           value_0021(50),
           value_0022(50),
           value_0023(50),
           value_0024(50),
           value_0025(50),
           value_0026(50),
           value_0027(50),
           value_0028(50),
           value_0029(50),
           value_0030(50),
           value_0031(50),
           value_0032(50),
           value_0033(50),
           value_0034(50),
           value_0035(50),
           value_0036(50),
           value_0037(50),
           value_0038(50),
           value_0039(50),
           value_0040(50),
           value_0041(50),
           value_0042(50),
           value_0043(50),
           value_0044(50),
           value_0045(50),
           value_0046(50),
           value_0047(50),
           value_0048(50),
           value_0049(50),
           value_0050(50),
           value_0051(50),
           value_0052(50),
           value_0053(50),
           value_0054(50),
           value_0055(50),
           value_0056(50),
           value_0057(50),
           value_0058(50),
           value_0059(50),
           value_0060(50),
           value_0061(50),
           value_0062(50),
           value_0063(50),
           value_0064(50),
           value_0065(50),
           value_0066(50),
           value_0067(50),
           value_0068(50),
           value_0069(50),
           value_0070(50),
           value_0071(50),
           value_0072(50),
           value_0073(50),
           value_0074(50),
           value_0075(50),
           value_0076(50),
           value_0077(50),
           value_0078(50),
           value_0079(50),
           value_0080(50),
           value_0081(50),
           value_0082(50),
           value_0083(50),
           value_0084(50),
           value_0085(50),
           value_0086(50),
           value_0087(50),
           value_0088(50),
           value_0089(50),
           value_0090(50),
           value_0091(50),
           value_0092(50),
           value_0093(50),
           value_0094(50),
           value_0095(50),
           value_0096(50),
           value_0097(50),
           value_0098(50),
           value_0099(50),
           value_0100(50).
    DATA: END OF data_tab.
    DATA: tind(4) TYPE n.
    DATA: zwfeld(19).
    FIELD-SYMBOLS: <fs1>.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
           EXPORTING
                mask      = '*.xls'
                static    = 'X'
           CHANGING
                file_name = filename.
    START-OF-SELECTION.
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
           EXPORTING
                filename                = filename
                i_begin_col             = begcol
                i_begin_row             = begrow
                i_end_col               = endcol
                i_end_row               = endrow
           TABLES
                intern                  = intern
           EXCEPTIONS
                inconsistent_parameters = 1
                upload_ole              = 2
                OTHERS                  = 3.
      IF sy-subrc <> 0.
        WRITE:/ 'Upload Error ', SY-SUBRC.
      ENDIF.
    END-OF-SELECTION.
      LOOP AT intern.
        intern1 = intern.
        CLEAR intern1-row.
        APPEND intern1.
      ENDLOOP.
      SORT intern1 BY col.
      LOOP AT intern1.
        AT NEW col.
          t_col-col = intern1-col.
          APPEND t_col.
        ENDAT.
        zwlen = strlen( intern1-value ).
        READ TABLE t_col WITH KEY col = intern1-col.
        IF sy-subrc EQ 0.
          IF zwlen > t_col-size.
            t_col-size = zwlen.
    *                          Internal Table, Current Row Index
            MODIFY t_col INDEX sy-tabix.
          ENDIF.
        ENDIF.
      ENDLOOP.
      DESCRIBE TABLE t_col LINES zwlines.
      SORT intern BY row col.
      IF kzheader = 'X'.
        LOOP AT intern.
          fieldnames-title = intern-value.
          APPEND fieldnames.
          AT END OF row.
            EXIT.
          ENDAT.
        ENDLOOP.
      ELSE.
        DO zwlines TIMES.
          WRITE sy-index TO fieldnames-title.
          APPEND fieldnames.
        ENDDO.
      ENDIF.
      SORT intern BY row col.
      LOOP AT intern.
        IF kzheader = 'X'
        AND intern-row = 1.
          CONTINUE.
        ENDIF.
        tind = intern-col.
        CONCATENATE 'DATA_TAB-VALUE_' tind INTO zwfeld.
        ASSIGN (zwfeld) TO <fs1>.
        <fs1> = intern-value.
        AT END OF row.
          APPEND data_tab.
          CLEAR data_tab.
        ENDAT.
      ENDLOOP.
      CALL FUNCTION 'DISPLAY_BASIC_LIST'
           EXPORTING
                file_name     = filename
           TABLES
                data_tab      = data_tab
                fieldname_tab = fieldnames.
    *-- End of Program
    <b>Excel Upload Alternative - KCD_EXCEL_OLE_TO_INT_CONVERT</b>
    *Title : Excel Uploading
    TYPES:   BEGIN OF t_datatab,
             col1(25)  TYPE c,
             col2(30)  TYPE c,
             col3(30)  TYPE c,
             col4(30)  TYPE c,
             col5(30)  TYPE c,
             col6(30)  TYPE c,
             col7(30) TYPE c,
             col8(30)  TYPE c,
             col9(30)  TYPE c,
             col10(30)  TYPE c,
             col11(30)    TYPE c,
           END OF t_datatab.
    DATA: it_datatab TYPE STANDARD TABLE OF t_datatab INITIAL SIZE 0,
          wa_datatab TYPE t_datatab.
    Data : p_table type t_datatab occurs 0 with header line.
    DATA : gd_scol   TYPE i VALUE '1',
           gd_srow   TYPE i VALUE '1',
           gd_ecol   TYPE i VALUE '256',
           gd_erow   TYPE i VALUE '65536'.
    DATA: it_tab TYPE filetable,
          gd_subrc TYPE i.
    field-symbols : <fs>.
    *Selection screen definition
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS:  p_file LIKE rlgrap-filename
                   DEFAULT 'c:test.xls' OBLIGATORY.   " File Name
    SELECTION-SCREEN END OF BLOCK b1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      REFRESH: it_tab.
      CALL METHOD cl_gui_frontend_services=>file_open_dialog
        EXPORTING
          window_title     = 'Select File'
          default_filename = '*.xls'
          multiselection   = ' '
        CHANGING
          file_table       = it_tab
          rc               = gd_subrc.
      LOOP AT it_tab INTO p_file.
    *    so_fpath-sign = 'I'.
    *    so_fpath-option = 'EQ'.
    *    append so_fpath.
      ENDLOOP.
    START-OF-SELECTION.
      PERFORM upload_excel_file TABLES   it_datatab
                                 USING   p_file
                                         gd_scol
                                         gd_srow
                                         gd_ecol
                                         gd_erow.
    * END-OF-SELECTION.
    END-OF-SELECTION.
      LOOP AT it_datatab INTO wa_datatab.
        WRITE:/ wa_datatab-col1,
                wa_datatab-col2,
                wa_datatab-col3,
                wa_datatab-col4,
                wa_datatab-col5,
                wa_datatab-col6,
                wa_datatab-col7,
                wa_datatab-col8,
                wa_datatab-col9,
                wa_datatab-col10,
                wa_datatab-col11.
      ENDLOOP.
    *&      Form  UPLOAD_EXCEL_FILE
    *       upload excel spreadsheet into internal table
    *      -->P_TABLE    Table to return excel data into
    *      -->P_FILE     file name and path
    *      -->P_SCOL     start column
    *      -->P_SROW     start row
    *      -->P_ECOL     end column
    *      -->P_EROW     end row
    FORM upload_excel_file TABLES   p_table
                           USING    p_file
                                    p_scol
                                    p_srow
                                    p_ecol
                                    p_erow.
      DATA : lt_intern TYPE  kcde_cells OCCURS 0 WITH HEADER LINE.
    * Has the following format:
    *             Row number   | Colum Number   |   Value
    *      i.e.     1                 1             Name1
    *               2                 1             Joe
      DATA : ld_index TYPE i.
    * Note: Alternative function module - 'ALSM_EXCEL_TO_INTERNAL_TABLE'
      CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
        EXPORTING
          filename                = p_file
          i_begin_col             = p_scol
          i_begin_row             = p_srow
          i_end_col               = p_ecol
          i_end_row               = p_erow
        TABLES
          intern                  = LT_INTERN
        EXCEPTIONS
          inconsistent_parameters = 1
          upload_ole              = 2
          OTHERS                  = 3.
      IF sy-subrc <> 0.
        FORMAT COLOR COL_BACKGROUND INTENSIFIED.
        WRITE:/ 'Error Uploading file'.
        EXIT.
      ENDIF.
      IF lt_intern[] IS INITIAL.
        FORMAT COLOR COL_BACKGROUND INTENSIFIED.
        WRITE:/ 'No Data Uploaded'.
        EXIT.
      ELSE.
        SORT lt_intern BY row col.
        LOOP AT lt_intern.
         MOVE lt_intern-col TO ld_index.
         assign component ld_index of structure
         p_table to <fs>.
    move : lt_intern-value to <fs>.
    *     MOVE lt_intern-value TO p_table.
          AT END OF row.
            APPEND p_table.
            CLEAR p_table.
          ENDAT.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    "UPLOAD_EXCEL_FILE
    Regards
    Pavan

  • Upload data from excel where one column has text of 3000 characters

    Guyz,
    I have a query. One of my requirments is to upload data from excel sheet & create a material. In the excel sheet one of the columns has text for BASIC DATA TEXT under ADDITIONAL DATA of a Material. This is a text of running length.
    the selection screen has feature of file upload & the users will upload excel files from their respective presentation servers.
    Now my problem is that I need a function module which can convert this column in excel sheet into an internal table & later call the BAPI for MM creation.
    I have used TEXT_CONVERT_XLS_TO_SAP & when i read my internal table to check this column length, it shows only 255 characters where as data in the excel sheet has 3000 characters (say for eg.)
    Can anybody throw some light on this.
    Thanks in advance
    GPK

    Hi,
    You can try using this function module and see that whether all your data is coming into the internal table properly.
    MS_EXCEL_OLE_STANDARD_DAT
    For the other part you needed to convert the internal table data into the structure as need by the BAPI and then call the create BAPI to create the materials in the SAP System.
    Hope this helps.
    Thanks,
    Samantak.

  • Upload data from excel( XLS/xs format) in SAP CRM

    Upload data from excel( XLS/xs format) in SAP CRM  7.0 as there is no *ALSM*EXCEL*ITAB* like FM there unlike ECC 6.0...?

    hello Buddy,
    plz go through below links
    http://wiki.scn.sap.com/wiki/display/CRM/CRM+Web+UI+-+Uploading+data+from+Excel+files
    http://scn.sap.com/docs/DOC-50732
    http://scn.sap.com/docs/DOC-31985
    Hope This will Help You...

Maybe you are looking for

  • The document "03540 phone numbers" could not be opened.

    strange problem with numbers: suddenly have following message: The document "03540 phone numbers" could not be opened. have it on every file I try to open with numbers. Pages works normally. Anyone experienced something like this? How to get round it

  • Car Demo on MyFaces implementation doesn't run !

    I'm trying to use the myfaces 0.9.1 implementation for the cardemo sample from the JSF 1.0 FCS. The error I'm getting is - java.lang.NullPointerException: Could not find factory configuration in faces-factoryConfig at net.sourceforge.myfaces.config.c

  • Phone handset not ringing

    BT are dealing with this so am not seeking solutions but before contacting them I saw other threads on this which didn't seem to answer the basic questions so am posting for reference only for others with this problem. My handset(s) weren't ringing e

  • FOUND ERROR WITH TRIGGER

    Please, i want a found a field that cause error in a trigger, how can capture this field and sending to a table_error. thanks

  • Using AutomatedTesting tools with Livecycle

    Hi All, I wanted to know the possiblity of using automated testing tools with LivecycleES Workflows. Does livecycle support integration with RFT or any other testing tools.Any pointers will be highly appreciated. Thanks , Leena