Upload data from excel to crm using BDOC possible or not
Hi all,
I need to upload data from excel to crm(opportunity management) .is it possible using bdoc or not. Please provide the list of methods to upload data from EXCEL and also provide the best method for this scenario .
BDocs are used to transfer data from one SAP system to another like from CRM to ECC or R3.
If u want to upload data from excel to CRM, this can be done with the help of idocs and not bdocs (method 1 - using LSMW).
Take help of a crm technical consultant and define lsmw projects. The project will take care of field mapping and conversion. Once that is done, 4 steps need to be done.
1. Read data
2. Convert data
3. Generate idocs
4. Post idocs
Once the posting of idocs happen error-free, the data will be available in crm system.
Another method will be using transaction SECATT.
Here u can define test scripts and record what all activities are done in a transaction. Then define ur test configs which will contain the excel sheet data and then upload the data.
Reward with points if this helps.
Similar Messages
-
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 form using webutil
Hi,
In the sample provided by Oracle
http://www.oracle.com/technology/products/forms/htdocs/webutil/howto_ole.html
Note 247606.1 How to Copy Records From a Form Into Excel
It shown the methods of how to copy data from form to excel but is there any sample to provide the step on how to read the cell from excel into Form in 10g.declare
args client_ole2.list_type;
application client_ole2.obj_type;
vworkbooks client_ole2.obj_type;
vdoc client_ole2.obj_type;
vworksheet client_ole2.obj_type;
vrange client_ole2.obj_type;
begin
-- create app object
application := client_ole2.create_obj('Excel.Application');
client_OLE2.SET_PROPERTY(application, 'Visible','True');
-- get workbooks object
vworkbooks := client_ole2.get_obj_property(application, 'Workbooks');
-- and open a file
args := client_ole2.create_arglist;
client_ole2.ADD_ARG(args, 'c:\tp_ae.xls');
vdoc :=client_ole2.INVOKE_OBJ(vworkbooks,'Open',args);
client_ole2.destroy_arglist(args);
-- get a worksheet object
-- for this to work you need to know the sheet name or its index
args := client_ole2.create_arglist;
client_ole2.ADD_ARG(args, 1); <-- name or index
vworksheet := client_ole2.get_obj_property(vdoc,'Worksheets',args);
client_ole2.destroy_arglist(args);
-- get a range object which in this case is just a cell
-- for this to work you need to know the cell coordinates
args := client_ole2.create_arglist;
client_ole2.ADD_ARG(args, 'B6');
vrange := client_ole2.get_obj_property(vworksheet,'Range',args);
client_ole2.destroy_arglist(args);
-- and here you get the value
message(client_ole2.get_char_property(vrange,'Value'));
-- release objects
client_ole2.release_obj(vrange);
client_ole2.release_obj(vworksheet);
client_ole2.release_obj(vdoc);
client_ole2.release_obj(vworkbooks);
client_ole2.release_obj(application);
end; -
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
kiranHi Taranam,
Use FM ALSM_EXCEL_TO_INTERNAL_TABLE.
Regards,
Atish -
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> -
To upload data from excel to internal table
hi
in excel sheet it contains 4 tabs.to upload data from excel to internal table i have used this fm
text_convert_xls_to_sap .but error wil comeing.that error in tables parameter.iternal table does not contain data.ple help me.(v 6.0) ple give me one example with codingHello,
Take a look on this: [ABAP - Upload data from Excel to Sap using OO|https://wiki.sdn.sap.com/wiki/x/xOw].
Regards. -
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... -
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 shuklaHi 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 -
Problem with uploading data from excel using BDC for tcode f-02
Hi All,
I am uploading data from excel using BDC for tcode f-02. The problem here is, while recording, the values of some fields are recording twice. I dont know why it's happening so. But if I run my abap program, I have to give those fields twice in my excel sheet. Otherwise data does not upload. But it is not the feasible way. We must give those fields once in excel. Please tell me, how I can solve the issue.
With regards,
Rosaline.Hi,
in BDC each and every action is recording. If your press enter in same screen that also recorded once aging may be this is your case repeating field values will appear. we can solve the problem for repeat fields like below.
suppose in your excel having repeated field X1 X2 X3 the X2 contains repeated field X3 means delete the X3 field.
Now In your itab having X1 and X2 fields. While in the LOOP the ITAB pass the X2 field to repeated the fields.
LOOP at ITAB to WA.
CLEAR bdcdata_wa.
bdcdata_wa-fnam = 'BDC_CURSOR'.
bdcdata_wa-fval = 'RM08M-EBELN'.
APPEND bdcdata_wa TO bdcdata_tab.
CLEAR bdcdata_wa.
bdcdata_wa-fnam = 'INVFO-BLDAT'.
bdcdata_wa-fval = wa-X2." 1st time pass the X2 fields
APPEND bdcdata_wa TO bdcdata_tab.
CLEAR bdcdata_wa.
bdcdata_wa-fnam = 'INVFO-BLDAT'.
bdcdata_wa-fval = wa-X2." pass the same value to repeated field
APPEND bdcdata_wa TO bdcdata_tab.
Endloop.
Hope you can understand.
Regards,
Dhina.. -
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
kamYes 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 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,
Jitendraif 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; -
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 KirschnerHI
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 (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
Maybe you are looking for
-
Hi MY report is base on the view wihich is a based on 10 unions of select statments. I am trying to improve the performance. I am planing to remove the view completelty and base a report on the SQL. Please see below ffor view structure create view XY
-
Master-detail problem in ADF JSP
Is there any way I can add a detail record in a master-detail JSP page without having to open a new page?ž Milos
-
I have been trying to transfer pictures from my iphone 4s to my pc running windows 7 there is nothing in my dcim folder but i have loads of pictures in loads of other folders on my phone that will not transfer do i have to pay for a program or can an
-
Can't update media on iPhone 4S over wifi
When I first made the switch to wifi syncing, everything worked fine. I occasionally have to restart iTunes to get it to see the iPhone on my network, but I feel like that's to be expected. But before I would go to bed, I would delete some movies f
-
I am using a Dell XPS GEN 5 PC with Windows Vista Premium Edition as the current OS installed. I have latested up date for Itunes and QuickTime (7.1.6) Installed. I have recently bought and downloaded 3 of the Original Star Trek Tv Shows from Itunes.