Printing Data to Excel through ActiveX
Hi I was wondering if I might get some help in writing some code to print to an Excel Spreadsheet through ActiveX. Attached is my current version of code that is not working the way I would like.
What I am hoping to do is to print every 5 seconds to the spreadsheet the data from the 4 sources I am collecting data from, as well as the time stamp of the current collection point. When the Start Log button is pressed, then it should start writing out to the Excel spreadsheet every 5 seconds. Then upon Stop Log being pressed, the data will stop being written.
Also if anyone has any general comments about things to change in the program overall, for better programming practice please let me know. I am still fairly new to LabVIEW, and I am trying to create a decently efficient program.
Thanks
Attachments:
All_test4.vi 656 KB
I coudln't look at where you were writing to the file because "Set Cell Value" was missing. However, the code in the image will enable you to change the worksheets (assuming that's what you meant by tabs). After you change the worksheet, just cast the value out into a worksheet, and continue on as I'm assuming you're already doing.
What Thomas said is also valid. Unless you need this real-time, it may be simpler to save to a CSV, and then import it back into excel if you want it all in one file.
EDIT: I forgot to mention that worksheets are NOT zero indexed. i.e. the left-most worksheet in excel is 1, not 0.
Message Edited by Will.D on 11-07-2006 11:33 AM
Attachments:
Sheet Index.jpg 35 KB
Similar Messages
-
Export data to Excel through a ABAP program run in batch mode
Dear Experts,
The requirement is that a ABAP report should run through background job, which will do the followiing :
1) Collect data from predifined CRM tables ( Activity , Order for example ).
2) Create a Excel file in a Application Server ( physical file server location ) location.
3) Push the data collected in the step 1 to the Excel file.
I have found 2 function modules which does the export to Excel after creating the Excel file. They are :
a) XXL_FULL_API
b) MS_EXCEL_OLE_STANDARD_DAT
But it seems that the ABAP report needs to run in the foreground ( correct me if i am wrong ) in order to create the Excel file.
Please can anyone suggest a possible ABAP code to achieve OR how to use these FMs in background mode ?
The excel creation needs to be automated and send to a administrator email id every day, so the need of exporting the data in background mode arises.
Thanks and regards,
Sudiptahi,
In SM36, you can create a job(give your report prog name)..
call the fun. module by storing all the values into final int. table it_data.
but u need to open one excel file in your desktop...
v_file = 'C:\file.xls'. " path should be like this...
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = v_file
filetype = 'xls'
has_field_separator = 'X'
HEADER_LENGTH = 0
read_by_line = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
IMPORTING
FILELENGTH =
HEADER =
TABLES
data_tab = it_data
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.
ENDIF.
regards
vijay -
How to set the Date in excel through Java?
now i am using
cell.setCellValue(date);
date is in format of "dd/MM/yyyy"
But when it set on excel , it sets as number.
I need the date as in same format as what i given.
Assist me.Consult the docs of the API you're using. We can't say much about it because you didn't even mention the API used and it is also not recognizeable as part of any standard Sun Java API's. It might help to consult their own forum/mailinglist -if any- as well.
-
hi all,
i made one program in which i get multiple tabs in one excel .n ow i want to fill data in it. but as soon as i do that my data is overwritten on my header. kindly help me for this.
this is my block of code which i am using:
CALL METHOD OF application 'Worksheets' = sheet
EXPORTING #1 = 2.
SET PROPERTY OF sheet 'Name' = 'region'.
CALL METHOD OF sheet 'Activate'.
LOOP AT IT_REGION.
index = row_max * ( sy-tabix - 1 ) + 1. " 1 - column name
CALL METHOD OF sheet 'Cells' = cells EXPORTING #1 = 1."index.
SET PROPERTY OF cells 'Value' = IT_REGION-REGIONName.
CALL METHOD OF sheet 'Cells' = cells EXPORTING #1 = 2."index.
SET PROPERTY OF cells 'Value' = IT_REGION-REGIONCode.
CALL METHOD OF sheet 'Cells' = cells EXPORTING #1 = 3."index.
SET PROPERTY OF cells 'Value' = IT_REGION-REGIONDescription.
CALL METHOD OF sheet 'Cells' = cells EXPORTING #1 = 4."index.
SET PROPERTY OF cells 'Value' = IT_REGION-CountryCode.
CALL METHOD OF sheet 'Cells' = cells EXPORTING #1 = 5."index.
SET PROPERTY OF cells 'Value' = IT_REGION-ChangeType.
ENDLOOP.
i want to take data from t005 table.
kindly help me for the same.
With Regards,
Sulabhby my own... use ole method to maintain multiple sheets in a excel
-
Bold data of a excel through forms 6i
I can send data into excel through forms 6i using DDE.POKE command. But I can not bold the data of a row.
Pls help me ASAP.Hi!
I have a same problem, please if you found the solution email me ([email protected])...
Thanks!!
René -
How to read and write data from Excel to TestStand without using LabVIEW VIs
Hi,
How can I read in columns of data from Excel into a TestStand array and write columns of data to Excel from TestStand without using LabVIEW VIs?
I don't think the Property Loader custom step type in TestStand will work because the data I would like to read in from Excel is in a column that is thousands of rows long and the data has to be in the proper format to use the Property Loader to load in an array from Excel.
Thanks for your help.That example does not use LabVIEW and it does about 40% of what you need to do by calling Excel through ActiveX. If you don't know how to use Excel through ActiveX then you'll need to brush up on that.
http://www.microsoft.com/en-us/download/details.aspx?id=16250
http://support.microsoft.com/kb/141759
http://support.microsoft.com/kb/302084
CTA, CLA, MTFBWY -
How to fetch data in Excel throuth oracle forms 10g on client machine
I am using developer suite 10g forms and i want to fetch data in excel through forms 10g on client machine
presently i m using OLE for fetching the data in excel , it is working fine but it generates the excel file on server machine and i want get the output excel on the client machine. Is there any parameter to set the destination {Server or Client} which decides the location of output file. If such is the case please let me know or please suggest what should i do. Please help me with proper solution.
thanks
ManojIf you have an "urgent" issue, I highly encourage you to contact Oracle Support. The forum probably isn't going to be your best source for "urgent" issues.
http://www.oracle.com/us/support/oracle-support-services-359636.html
https://support.oracle.com
This will be especially important if you are new to any of the products as you will likely need documentation and/or product updates in order to ensure the most stable environment possible.
There are a few publicly available documents which may help to get you started. In any case, these are just examples. They may or may not work to your liking. Further, in some cases they may not work at all. Many of the examples online are often outdated and do not function exactly as documented against other versions. Here is one:
http://www.oracle.com/technetwork/developer-tools/forms/howto-ole-090332.html
Additional documentation for using WebUtil is included in the Forms Builder online help. An update to the Builder Help files can be downloaded from here. Be sure to carefully review the included ReadMe before attempting to use them.
http://docs.oracle.com/cd/B25016_08/doc/dl/web/forms_help/frmhelp_update.zip -
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; -
Getting error while trying to upload the data in excel from SSIS package through sql agent job
We are getting below errors.
Error:
The Microsoft Jet database engine cannot open the file '\\serversdev\Documents\QC Files\Prod.xls'. It is already opened exclusively by another
user, or you need permission to view its data.
Please suggest ASAP
Regards,
Ramu
Ramu GadeHi Dikshan Gade,
According to your description, you want to upload data from excel to database, when you call ssis package through SQL Server Agent job, you got the error message.
To troubleshoot the problem, please refer to the following steps:
Validate that the account has permissions on the file and the folder.
Verify that the file and the data source name (DSN) are not marked as Exclusive.
Make sure SQL Server Agent Services service account has the permission to access the database.
We can check SQL Server Agent’s activity logs, Windows Event logs and SSIS logs to get more clues. Also the tool Process Monitor is helpful to track the cause of registry or file access related issues. For more information about the issue, please refer to
the following KB article:
http://support.microsoft.com/kb/306269
If you have any more questions, please feel free to ask.
Thanks,
Wendy Fu
Wendy Fu
TechNet Community Support -
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'shello 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 -
How to upload datas in excel sheet through BDC
Hi,
I know how to upload datas in Text format through BDC...Suppose even when datas are in .xls format,I saved that file as Text(tab delimited) format...then file become text format and it can be easily uploaded....
So, I want to know How to upload datas in excel sheet through BDChi,
try this Example, hope useful to u, assign me point.
report ZMSV1_BDC_CALL
no standard page heading line-size 255.
*include bdcrecx1.
*parameters: dataset(132) lower case.
DO NOT CHANGE - the generated data section - DO NOT CHANGE ***
If it is nessesary to change the data section use the rules:
1.) Each definition of a field exists of two lines
2.) The first line shows exactly the comment
'* data element: ' followed with the data element
which describes the field.
If you don't have a data element use the
comment without a data element name
3.) The second line shows the fieldname of the
structure, the fieldname must consist of
a fieldname and optional the character '_' and
three numbers and the field length in brackets
4.) Each field must be type C.
Generated data section with specific formatting - DO NOT CHANGE ***
data: begin of record,
data element: BUKRS
BUKRS_001(004),
data element: KTOKK
KTOKK_002(004),
data element: NAME1_GP
NAME1_003(035),
data element: SORTL
SORTL_004(010),
data element: ORT01_GP
ORT01_005(035),
data element: LAND1_GP
LAND1_006(003),
data element: SPRAS
SPRAS_007(002),
data element: BANKS
BANKS_01_008(003),
data element: BANKK
BANKL_01_009(015),
data element: BANKN
BANKN_01_010(018),
end of record.
End generated data section ***
data: itab like record occurs 0 .
data: it_bdc type bdcdata occurs 0 with header line.
data: it_msg type bdcmsgcoll occurs 0 with header line.
parameter p_file type rlgrap-filename default 'c:\vendor.txt' obligatory
start-of-selection.
perform open_dataset using p_file.
perform open_group.
*perform close_group.
*perform close_dataset using dataset.
*& Form open_dataset
text
-->P_P_FILE text
form open_dataset using p_p_file.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
CODEPAGE = ' '
FILENAME = p_file
FILETYPE = 'DAT'
HEADLEN = ' '
LINE_EXIT = ' '
TRUNCLEN = ' '
USER_FORM = ' '
USER_PROG = ' '
DAT_D_FORMAT = ' '
IMPORTING
FILELENGTH =
TABLES
data_tab = itab
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
NO_AUTHORITY = 10
OTHERS = 11
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endform. " open_dataset
*& Form open_group
text
--> p1 text
<-- p2 text
form open_group .
loop at itab into record.
perform bdc_dynpro using 'SAPMF02K' '0105'.
perform bdc_field using 'BDC_CURSOR'
'RF02K-KTOKK'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RF02K-BUKRS'
record-BUKRS_001.
perform bdc_field using 'RF02K-KTOKK'
record-KTOKK_002.
perform bdc_dynpro using 'SAPMF02K' '0110'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-ORT01'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFA1-NAME1'
record-NAME1_003.
perform bdc_field using 'LFA1-SORTL'
record-SORTL_004.
perform bdc_field using 'LFA1-ORT01'
record-ORT01_005.
perform bdc_field using 'LFA1-LAND1'
record-LAND1_006.
perform bdc_field using 'LFA1-SPRAS'
record-SPRAS_007.
perform bdc_dynpro using 'SAPMF02K' '0120'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-KUNNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0130'.
perform bdc_field using 'BDC_CURSOR'
'LFBK-KOINH(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'LFBK-BANKS(01)'
record-BANKS_01_008.
perform bdc_field using 'LFBK-BANKL(01)'
record-BANKL_01_009.
perform bdc_field using 'LFBK-BANKN(01)'
record-BANKN_01_010.
perform bdc_dynpro using 'SAPMF02K' '0130'.
perform bdc_field using 'BDC_CURSOR'
'LFBK-BANKS(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPMF02K' '0210'.
perform bdc_field using 'BDC_CURSOR'
'LFB1-AKONT'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0215'.
perform bdc_field using 'BDC_CURSOR'
'LFB1-ZTERM'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0220'.
perform bdc_field using 'BDC_CURSOR'
'LFB5-MAHNA'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
call transaction 'FK01' using it_bdc mode 'A' update 'S'
messages into it_msg.
write:/ sy-subrc.
perform message_formatwrite.
refresh it_bdc.
clear it_bdc.
endloop.
endform. " open_group
*& Form message_formatwrite
text
--> p1 text
<-- p2 text
form message_formatwrite .
data:l_msg(10).
loop at it_msg.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = SY-MSGID
LANG = sy-langu
NO = SY-MSGNO
V1 = SY-MSGV1
V2 = SY-MSGV2
V3 = SY-MSGV3
V4 = SY-MSGV4
IMPORTING
MSG = l_msg
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endloop.
endform. " message_formatwrite
*& Form bdc_dynpro
text
-->P_0112 text
-->P_0113 text
form bdc_dynpro using value(p_0112)
value(p_0113).
it_bdc-program = p_0112.
it_bdc-dynpro = p_0113.
it_bdc-dynbegin = 'X'.
append it_bdc.
clear it_bdc.
endform. " bdc_dynpro
*& Form bdc_field
text
-->P_0117 text
-->P_0118 text
form bdc_field using value(p_0117)
value(p_0118).
it_bdc-fnam = p_0117.
it_bdc-fval = p_0118.
append it_bdc.
clear it_bdc.
endform. " bdc_field
Regards
fareedas -
Unable to print e-mail messages from my Mac book pro directly to my HP ink jet printer. Can print from Word, Excel, Safari. E-mail messages only print the date And "sent to" name, the remainder is blank.
If you haven't done so already, try resetting the printing system.
Reset Printing System -
Upload data in excel sheet through BDC
Dear all,
How do we upload data in excel sheet through BDC?
Thanks in advance.
Regards,
Sandra.Hi,
The sample code is as given below:
REPORT upload_supply_area.
*include for dispaying icons in error log
INCLUDE <icon>.
*Declaration of structure.
TYPES:BEGIN OF x_struct,
werks TYPE v_pvbe-werks, "Plant
prvbe TYPE v_pvbe-prvbe, "Supply Area
pvbtx TYPE v_pvbe-pvbtx, "Production supply area description
lgort TYPE v_pvbe-lgort, "Storage Location
rgver TYPE v_pvbe-rgver, "Person responsible for one or more supply areas
END OF x_struct.
TYPES:BEGIN OF x_messages,
msgtyp(1) type c,
werks TYPE v_pvbe-werks, "Plant
prvbe TYPE v_pvbe-prvbe, "Supply Area
message(120) type c,
END OF x_messages.
DATA: it_messages TYPE STANDARD TABLE OF x_messages .
DATA: wa_messages TYPE x_messages.
DATA:it_msgtab TYPE STANDARD TABLE OF bdcmsgcoll,
wa_msgtab TYPE bdcmsgcoll.
*internal table for BDC
DATA: it_bdcdata TYPE STANDARD TABLE OF bdcdata.
DATA: wa_bdcdata TYPE bdcdata.
DATA:it_file TYPE STANDARD TABLE OF x_struct. "internal table which has same structure as file
DATA:wa_file TYPE x_struct. "work area which has same structure as file
DATA: it_excel TYPE STANDARD TABLE OF alsmex_tabline,
wa_excel TYPE alsmex_tabline.
DATA: x_ctuprms TYPE ctu_params.
DATA:nodata TYPE c VALUE '/'.
data:con(50) type c.
data:con1(50) type c.
*selection screen
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
*Enter file name on presentation server
PARAMETERS: p_file TYPE rlgrap-filename OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
*Function which enables the user to browse the files on hard disk
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
program_name = syst-repid
static = 'X'
CHANGING
file_name = p_file
EXCEPTIONS
mask_too_long = 1
OTHERS = 2.
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.
*Subroutine to upload excel file and read it
PERFORM upload.
*Subroutine to upload supply area data
PERFORM fill.
*& Form bdc_dynpro
Fill the BDC table
FORM bdc_dynpro USING program dynpro. "#EC *
CLEAR wa_bdcdata.
wa_bdcdata-program = program.
wa_bdcdata-dynpro = dynpro.
wa_bdcdata-dynbegin = 'X'.
APPEND wa_bdcdata TO it_bdcdata.
ENDFORM. "BDC_DYNPRO
*& Form bdc_field
Fill the BDC table
FORM bdc_field USING fnam fval. "#EC *
IF fval <> nodata.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = fnam.
wa_bdcdata-fval = fval.
APPEND wa_bdcdata TO it_bdcdata. "#EC
ENDIF.
ENDFORM. "BDC_FIELD
*& Form collect_messages
Collect the messages from transaction
FORM collect_messages . "#EC *
DATA: w_msg(100).
LOOP AT it_msgtab INTO wa_msgtab.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = wa_msgtab-msgid
lang = wa_msgtab-msgspra
no = wa_msgtab-msgnr
v1 = wa_msgtab-msgv1
v2 = wa_msgtab-msgv2
IMPORTING
msg = w_msg
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CONDENSE w_msg.
CLEAR wa_messages.
wa_messages-msgtyp = wa_msgtab-msgtyp.
wa_messages-message = w_msg.
wa_messages-werks = wa_file-werks.
wa_messages-prvbe = wa_file-prvbe.
if wa_messages-message eq 'Formatting error in the field V_PVBE-RGVER; see next message'.
wa_messages-message = 'Invalid name of the person responsible'.
endif.
if wa_messages-message eq 'Formatting error in the field V_PVBE-LGORT; see next message'.
wa_messages-message = 'Enter the storage location'.
endif.
APPEND wa_messages TO it_messages .
ENDLOOP.
REFRESH it_msgtab.
ENDFORM. "collect_messages
*& Form write_messages
Display the messages
FORM write_messages .
DELETE ADJACENT DUPLICATES FROM it_messages COMPARING werks prvbe.
LOOP AT it_messages INTO wa_messages .
WRITE:/1 sy-vline.
IF wa_messages-msgtyp = 'S'.
WRITE: 10 icon_green_light.
ELSEIF wa_messages-msgtyp = 'E'.
WRITE: 10 icon_red_light.
ELSEIF wa_messages-msgtyp = 'W'.
WRITE: 10 icon_yellow_light.
ENDIF.
WRITE: 20 sy-vline.
WRITE : 30 'Plant-', wa_messages-werks . "#EC NOTEXT
WRITE: 48 sy-vline.
WRITE : 49 'Supply Area-', wa_messages-prvbe . "#EC NOTEXT
WRITE: 79 sy-vline.
WRITE : 80 wa_messages-message .
WRITE: 180 sy-vline.
WRITE:/1 sy-vline.
ULINE 1(180).
ENDLOOP.
ENDFORM. " write_m
*& Form fill_params
Processing mode for the transaction
FORM fill_params .
x_ctuprms-dismode = 'N'.
x_ctuprms-updmode = 'A'.
x_ctuprms-defsize = 'X'.
ENDFORM. "fill_params
*& Form upload
Upload the excel file and read the data
FORM upload .
*Function to upload excel file
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_file
i_begin_col = 1
i_begin_row = 2
i_end_col = 5
i_end_row = 9999
TABLES
intern = it_excel
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.
CLEAR wa_file.
*Read the file row-wise
LOOP AT it_excel INTO wa_excel.
CASE wa_excel-col .
*Read plant
WHEN '1'.
wa_file-werks = wa_excel-value.
*Read supply area
WHEN '2'.
wa_file-prvbe = wa_excel-value.
*Read decription
WHEN '3'.
wa_file-pvbtx = wa_excel-value.
*Read storage location
WHEN '4'.
wa_file-lgort = wa_excel-value.
*Read Person responsible
WHEN '5'.
IF STRLEN( wa_excel-value ) = 1.
CONCATENATE '00' wa_excel-value INTO con.
wa_file-rgver = con.
ELSEIF STRLEN( wa_excel-value ) = 2.
CONCATENATE '0' wa_excel-value INTO con1.
wa_file-rgver = con1.
ELSE.
wa_file-rgver = wa_excel-value.
ENDIF.
ENDCASE.
AT END OF row.
CONDENSE:wa_file-werks,wa_file-prvbe,wa_file-pvbtx,wa_file-lgort,wa_file-rgver.
APPEND wa_file TO it_file.
CLEAR wa_file.
ENDAT .
ENDLOOP.
ENDFORM. " upload
*& Form fill
Call the transaction 'PK05'
FORM fill .
*Upload the data through transaction 'PK05'
PERFORM fill_params.
LOOP AT it_file INTO wa_file.
PERFORM bdc_dynpro USING 'SAPLSVIX' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'D0100_FIELD_TAB-LOWER_LIMIT(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=OKAY'.
PERFORM bdc_dynpro USING 'SAPL0PK1' '0020'.
PERFORM bdc_field USING 'BDC_CURSOR'
'V_PVBE-PVBTX(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=NEWL'.
PERFORM bdc_dynpro USING 'SAPL0PK1' '0021'.
PERFORM bdc_field USING 'BDC_CURSOR'
'V_PVBE-RGVER'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'V_PVBE-WERKS'
wa_file-werks.
PERFORM bdc_field USING 'V_PVBE-PRVBE'
wa_file-prvbe.
PERFORM bdc_field USING 'V_PVBE-PVBTX'
wa_file-pvbtx.
PERFORM bdc_field USING 'V_PVBE-LGORT'
wa_file-lgort.
PERFORM bdc_field USING 'V_PVBE-RGVER'
wa_file-rgver.
PERFORM bdc_dynpro USING 'SAPL0PK1' '0021'.
PERFORM bdc_field USING 'BDC_CURSOR'
'V_PVBE-WERKS'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=SAVE'.
PERFORM bdc_field USING 'V_PVBE-WERKS'
wa_file-werks.
PERFORM bdc_field USING 'V_PVBE-PRVBE'
wa_file-prvbe.
PERFORM bdc_field USING 'V_PVBE-PVBTX'
wa_file-pvbtx.
PERFORM bdc_field USING 'V_PVBE-LGORT'
wa_file-lgort.
PERFORM bdc_field USING 'V_PVBE-RGVER'
wa_file-rgver.
CALL TRANSACTION 'PK05'
USING it_bdcdata
OPTIONS FROM x_ctuprms
MESSAGES INTO it_msgtab.
REFRESH it_bdcdata.
PERFORM collect_messages.
CLEAR wa_file.
ENDLOOP.
PERFORM write_messages.
ENDFORM. " fill -
Problem in reading data from Excel sheet to 2D string array (ActiveX & LabView).
I am trying to read data from Excel sheet to 2D string array (ActiveX & LabView). Error -2147352571 is generated (type mismatch) if cell value is "#NULL!", "#N/A" etc. What should I do?
Hello �
Is the error happening when the cell value is #NULL or #NA only?
Sometimes these errors occur because of an ActiveX object mismatch. The version of the ActiveX object might have changed or been updated since the VI was created. The VI tries to use an earlier, incompatible version of the ActiveX object.
To solve the problem, you need to link automation refnum terminal to the correct ActiveX object. To do so, right-click an automation refnum terminal and choose Select ActiveX Class»Browse from the shortcut menu. From the Type Library pull-down menu, select the latest version of the library you want to use, such as Microsoft Excel Object Library. In the Objects list, select an ActiveX object, and click the OK button. Link ea
ch automation refnum terminal in the VI and its subVIs until the run arrow is not broken. Also, you might have to replace some or all of the Invoke Nodes and Property Nodes for the ActiveX objects.
Also, I came across this Knowledgebase. The error number is slightly different but it is always good to check it out and make sure it is not your case.
Hope this helps.
S Vences
Applications Engineer
National Instruments -
Facing problem in writing data to excel sheet using ActiveX
Hi.
I want to write data from a one dimesional array to a particular excel sheet in a particular row.Please see the attached vi for explantion.
It is giving error.But If I give a new file name when the appliation is getting closed it is writing data to the new excel file.
Please help.
Thanks in advance
Attachments:
Excel sheetWrite.vi 90 KBThanks Jhoskin and Rudi .......
I am able to write data to excel sheet now. I am attaching one"test.zip" file that contains a VI named "Squence.vi "that contains another subVI named "Write U94006 Table To XL.vi"which does the functionality of counting the number of rows in the excel sheet and writing data in the next blank row. I am using the same subVI in the VI named "Sequence.vi"two times so it is taking a lot of time in opening and closing the excel sheet. Will you please suggest some way of calling the subVI only one time.
Rikki
Attachments:
Test.zip 105 KB
Maybe you are looking for
-
Best practices for exporting for digital signage?
I am exporting video clips to be displayed in a PC-based digital signage system. My video was shot in 1080i60, and I imported and edited the footage using HDV sequence settings. My final export size needs to be 1920 x 1080. I have tried a couple of e
-
everytime i try to download itunes it freezes on the p ublishing product information bit, any ideas?
-
Hi, i have a scenario from idoc to flat file.There is two idoc that send message in same file.Without flat file content messages come succesfully.the format should be following: at the first row should be the first idoc, at the second row should be
-
Help please: given the following all class have the same RID class A class B derived from class A class C derived from class A Is there a way to have classes A,B,C in separate load file without using the Shareable interface communications mechanism.
-
Large tradeshow poster, size, resolution
Hi. Working with PS7 & on XP. If I want to have a poster be 30x36" (300 dpi) is it safe to create the file in PS one third it's size (10x12") at 600dpi? Or do you create it at one third its size at 300dpi & then enlarge it by 300%? Thank you. Jules