Problem while opening data from mysql in Excel
Hi friends
when i try to download data from MySQL to excel sheet I am getting error of
This file is not in a recognizable format.
. If you know the file is from another program which is incompatible with Microsoft Office Excel,click Cancel then open this file in its original application.If you want to open the file later in Microsoft Office Excel,save it in a format that is compatible,such as text format.
etc
Code is
Class.forName("org.gjt.mm.mysql.Driver");
Connection conn = DriverManager.getConnection("xxxxxx");
Statement st = conn.createStatement();
StringBuffer sb = new StringBuffer();
sb.append("SAP#" + "\t");
sb.append("x-plant status" + "\t");
sb.append("Total Amount" +"\t");
sb.append(">90 days" + "\t");
sb.append("\n");
try
String query="select * from temp_Xplant";
ResultSet rs = st.executeQuery(query);
while(rs.next()){
sb.append(rs.getString("sapNo") + "\t");
sb.append(rs.getString("status")+ "\t");
sb.append(rs.getString("amt") + "\t");
sb.append(rs.getString("days") + "\t");
sb.append("\n");
conn.close();
st.close();
catch (Exception e)
out.println("error");
conn.close();
st.close();
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment; filename=\"test.XLS\"");
I can open them after clicking OK, but before that it is showing the above error message
Thank you
Edited by: priyap on Apr 3, 2008 4:54 AM
hi,
there are some specific restrictions in downloading data in alv.
i.e you cannot have morethan 1024 characters that can be downloaded in single row.
so change your report columns accordingly.
Similar Messages
-
Problem while transfering data from form to excel
Hi all.
I have a little problem. I have a procedure that fires on when-button-pressed trigger that goes to current block and download the data into an excel file.
The block has 2200 records.
The problem is that if I make the application visible all is ok; if I make the application not visible it remains "append" and nothing happens.
I'm on developer suite 10g.
Here is the code:
PROCEDURE pr_Forms_to_Excel(p_block_name IN VARCHAR2 DEFAULT NAME_IN('system.current_block')) IS
-- Declare the OLE objects
application OLE2.OBJ_TYPE;
workbooks OLE2.OBJ_TYPE;
workbook OLE2.OBJ_TYPE;
worksheets OLE2.OBJ_TYPE;
worksheet OLE2.OBJ_TYPE;
cell OLE2.OBJ_TYPE;
range OLE2.OBJ_TYPE;
range_col OLE2.OBJ_TYPE;
-- Declare handles to OLE argument lists
args OLE2.LIST_TYPE;
-- Declare form and block items
form_name VARCHAR2(100);
f_block VARCHAR2(100);
l_block VARCHAR2(100);
f_item VARCHAR2(100);
l_item VARCHAR2(100);
cur_block VARCHAR2(100) := NAME_IN('system.current_block');
cur_item VARCHAR2(100) := NAME_IN('system.current_item');
cur_record VARCHAR2(100) := NAME_IN('system.cursor_record');
item_name VARCHAR2(100);
baslik VARCHAR2(100);
row_n NUMBER;
col_n NUMBER;
filename VARCHAR2(100);
BEGIN
-- Start Excel
application:=OLE2.CREATE_OBJ('Excel.Application');
OLE2.SET_PROPERTY(application, 'Visible', 'TRUE');
-- Return object handle to the Workbooks collection
workbooks:=OLE2.GET_OBJ_PROPERTY(application, 'Workbooks');
-- Add a new Workbook object to the Workbooks collection
workbook:=OLE2.GET_OBJ_PROPERTY(workbooks,'Add');
-- Return object handle to the Worksheets collection for the Workbook
worksheets:=OLE2.GET_OBJ_PROPERTY(workbook, 'Worksheets');
-- Get the first Worksheet in the Worksheets collection
-- worksheet:=OLE2.GET_OBJ_PROPERTY(worksheets,'Add');
args:=OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(args, 1);
worksheet:=OLE2.GET_OBJ_PROPERTY(worksheets,'Item',args);
OLE2.DESTROY_ARGLIST(args);
-- Return object handle to cell A1 on the new Worksheet
go_block(p_block_name);
baslik := get_block_property(p_block_name,FIRST_ITEM);
f_item := p_block_name||'.'||get_block_property(p_block_name,FIRST_ITEM);
l_item := p_block_name||'.'||get_block_property(p_block_name,LAST_ITEM);
first_record;
LOOP
item_name := f_item;
row_n := NAME_IN('SYSTEM.CURSOR_RECORD');
col_n := 1;
LOOP
IF get_item_property(item_name,ITEM_TYPE)<>'BUTTON' AND
get_item_property(item_name,VISIBLE)='TRUE'
THEN
-- Set first row with the item names
IF row_n=1 THEN
baslik:=NVL(get_item_property(item_name,PROMPT_TEXT),baslik);
args:=OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(args, row_n);
OLE2.ADD_ARG(args, col_n);
cell:=OLE2.GET_OBJ_PROPERTY(worksheet, 'Cells', args);
OLE2.DESTROY_ARGLIST(args);
OLE2.SET_PROPERTY(cell, 'Value', baslik);
OLE2.RELEASE_OBJ(cell);
END IF;
-- Set other rows with the item values
args:=OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(args, row_n+1);
OLE2.ADD_ARG(args, col_n);
cell:=OLE2.GET_OBJ_PROPERTY(worksheet, 'Cells', args);
OLE2.DESTROY_ARGLIST(args);
IF get_item_property(item_name,DATATYPE)<>'NUMBER' THEN
OLE2.SET_PROPERTY(cell, 'NumberFormat', '@');
END IF;
OLE2.SET_PROPERTY(cell, 'Value', name_in(item_name));
OLE2.RELEASE_OBJ(cell);
END IF;
IF item_name = l_item THEN
exit;
END IF;
baslik := get_item_property(item_name,NEXTITEM);
item_name := p_block_name||'.'||get_item_property(item_name,NEXTITEM);
col_n := col_n + 1;
END LOOP;
EXIT WHEN NAME_IN('system.last_record') = 'TRUE';
NEXT_RECORD;
END LOOP;
-- Autofit columns
range := OLE2.GET_OBJ_PROPERTY( worksheet,'UsedRange');
range_col := OLE2.GET_OBJ_PROPERTY( range,'Columns');
OLE2.INVOKE( range_col,'AutoFit' );
OLE2.RELEASE_OBJ( range );
OLE2.RELEASE_OBJ( range_col );
-- Get filename and path
args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG( args, p_block_name );
OLE2.ADD_ARG( args,'Excel Workbooks (*.xls, *.xls');
filename := OLE2.INVOKE_CHAR( application,'GetSaveAsFilename',args );
OLE2.DESTROY_ARGLIST( args );
-- Save as worksheet
IF NVL(filename,'0')<>'0' THEN
args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG( args,filename );
OLE2.INVOKE( worksheet,'SaveAs',args );
OLE2.DESTROY_ARGLIST( args );
END IF;
-- Close workbook
OLE2.INVOKE( workbook ,'Close');
-- Release the OLE objects
OLE2.RELEASE_OBJ(worksheet);
OLE2.RELEASE_OBJ(worksheets);
OLE2.RELEASE_OBJ(workbook);
OLE2.RELEASE_OBJ(workbooks);
OLE2.INVOKE(application, 'Quit');
OLE2.RELEASE_OBJ(application);
-- Focus to the original location
go_block(cur_block);
go_record(cur_record);
go_item(cur_block||'.'||cur_item);
END;
Is there anyone that can help me????
Thanks,
FabrizioHi all.
I have a little problem. I have a procedure that fires on when-button-pressed trigger that goes to current block and download the data into an excel file.
The block has 2200 records.
The problem is that if I make the application visible all is ok; if I make the application not visible it remains "append" and nothing happens.
I'm on developer suite 10g.
Here is the code:
PROCEDURE pr_Forms_to_Excel(p_block_name IN VARCHAR2 DEFAULT NAME_IN('system.current_block')) IS
-- Declare the OLE objects
application OLE2.OBJ_TYPE;
workbooks OLE2.OBJ_TYPE;
workbook OLE2.OBJ_TYPE;
worksheets OLE2.OBJ_TYPE;
worksheet OLE2.OBJ_TYPE;
cell OLE2.OBJ_TYPE;
range OLE2.OBJ_TYPE;
range_col OLE2.OBJ_TYPE;
-- Declare handles to OLE argument lists
args OLE2.LIST_TYPE;
-- Declare form and block items
form_name VARCHAR2(100);
f_block VARCHAR2(100);
l_block VARCHAR2(100);
f_item VARCHAR2(100);
l_item VARCHAR2(100);
cur_block VARCHAR2(100) := NAME_IN('system.current_block');
cur_item VARCHAR2(100) := NAME_IN('system.current_item');
cur_record VARCHAR2(100) := NAME_IN('system.cursor_record');
item_name VARCHAR2(100);
baslik VARCHAR2(100);
row_n NUMBER;
col_n NUMBER;
filename VARCHAR2(100);
BEGIN
-- Start Excel
application:=OLE2.CREATE_OBJ('Excel.Application');
OLE2.SET_PROPERTY(application, 'Visible', 'TRUE');
-- Return object handle to the Workbooks collection
workbooks:=OLE2.GET_OBJ_PROPERTY(application, 'Workbooks');
-- Add a new Workbook object to the Workbooks collection
workbook:=OLE2.GET_OBJ_PROPERTY(workbooks,'Add');
-- Return object handle to the Worksheets collection for the Workbook
worksheets:=OLE2.GET_OBJ_PROPERTY(workbook, 'Worksheets');
-- Get the first Worksheet in the Worksheets collection
-- worksheet:=OLE2.GET_OBJ_PROPERTY(worksheets,'Add');
args:=OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(args, 1);
worksheet:=OLE2.GET_OBJ_PROPERTY(worksheets,'Item',args);
OLE2.DESTROY_ARGLIST(args);
-- Return object handle to cell A1 on the new Worksheet
go_block(p_block_name);
baslik := get_block_property(p_block_name,FIRST_ITEM);
f_item := p_block_name||'.'||get_block_property(p_block_name,FIRST_ITEM);
l_item := p_block_name||'.'||get_block_property(p_block_name,LAST_ITEM);
first_record;
LOOP
item_name := f_item;
row_n := NAME_IN('SYSTEM.CURSOR_RECORD');
col_n := 1;
LOOP
IF get_item_property(item_name,ITEM_TYPE)<>'BUTTON' AND
get_item_property(item_name,VISIBLE)='TRUE'
THEN
-- Set first row with the item names
IF row_n=1 THEN
baslik:=NVL(get_item_property(item_name,PROMPT_TEXT),baslik);
args:=OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(args, row_n);
OLE2.ADD_ARG(args, col_n);
cell:=OLE2.GET_OBJ_PROPERTY(worksheet, 'Cells', args);
OLE2.DESTROY_ARGLIST(args);
OLE2.SET_PROPERTY(cell, 'Value', baslik);
OLE2.RELEASE_OBJ(cell);
END IF;
-- Set other rows with the item values
args:=OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(args, row_n+1);
OLE2.ADD_ARG(args, col_n);
cell:=OLE2.GET_OBJ_PROPERTY(worksheet, 'Cells', args);
OLE2.DESTROY_ARGLIST(args);
IF get_item_property(item_name,DATATYPE)<>'NUMBER' THEN
OLE2.SET_PROPERTY(cell, 'NumberFormat', '@');
END IF;
OLE2.SET_PROPERTY(cell, 'Value', name_in(item_name));
OLE2.RELEASE_OBJ(cell);
END IF;
IF item_name = l_item THEN
exit;
END IF;
baslik := get_item_property(item_name,NEXTITEM);
item_name := p_block_name||'.'||get_item_property(item_name,NEXTITEM);
col_n := col_n + 1;
END LOOP;
EXIT WHEN NAME_IN('system.last_record') = 'TRUE';
NEXT_RECORD;
END LOOP;
-- Autofit columns
range := OLE2.GET_OBJ_PROPERTY( worksheet,'UsedRange');
range_col := OLE2.GET_OBJ_PROPERTY( range,'Columns');
OLE2.INVOKE( range_col,'AutoFit' );
OLE2.RELEASE_OBJ( range );
OLE2.RELEASE_OBJ( range_col );
-- Get filename and path
args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG( args, p_block_name );
OLE2.ADD_ARG( args,'Excel Workbooks (*.xls, *.xls');
filename := OLE2.INVOKE_CHAR( application,'GetSaveAsFilename',args );
OLE2.DESTROY_ARGLIST( args );
-- Save as worksheet
IF NVL(filename,'0')<>'0' THEN
args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG( args,filename );
OLE2.INVOKE( worksheet,'SaveAs',args );
OLE2.DESTROY_ARGLIST( args );
END IF;
-- Close workbook
OLE2.INVOKE( workbook ,'Close');
-- Release the OLE objects
OLE2.RELEASE_OBJ(worksheet);
OLE2.RELEASE_OBJ(worksheets);
OLE2.RELEASE_OBJ(workbook);
OLE2.RELEASE_OBJ(workbooks);
OLE2.INVOKE(application, 'Quit');
OLE2.RELEASE_OBJ(application);
-- Focus to the original location
go_block(cur_block);
go_record(cur_record);
go_item(cur_block||'.'||cur_item);
END;
Is there anyone that can help me????
Thanks,
Fabrizio -
Problem while downloadind data from ALV in excel format.
Hi Experts,
I have developed one ALV Report.
it have 53 columns. when i tried to download it in excel format using standard functionality, all columns are not coming in one line i.e 50 cloumns in one line and rest columns to the next line.
For Example.
Row 1 Header-> Fld1 Fld2 Fld3 Fld4 Fld5
Fld6 Fld7
Row 2 Values-> Val1 Val2 Val3 Val4 Val5
Val6 Val7
how i will get all these 53 columns in one line in EXCEL..
its urget........
Usefull answer will be rewarded...hi,
there are some specific restrictions in downloading data in alv.
i.e you cannot have morethan 1024 characters that can be downloaded in single row.
so change your report columns accordingly. -
Problem while retrving data from a view
Hi Friends
i have a problem while retriving data from a view <b>v_t685a</b>.
the error message is :""" "V_T685A" is not defined in the ABAP Dictionary as a table, projection view or database view."""
i wrote : select single VTEXT1 from V_T685A into w_cst_jin1 where
KSCHL = 'JIN1' and
KAPPL = 'V'.
how to retrive the data.
waiting for quick response
Regards
MukeshHi
This is a Maintenance View, not a Database View
SO can't fetch data using select statement.
You can use the Table <b>T685</b> directly to fetch the condition Types data straight away instead of the view. write the same select for this table and use.
Regards
Anji
Message was edited by:
Anji Reddy Vangala -
Problem while loading data from ODS to infoobject
Hi guys,
I am facing problem while loading data from <b>ODS to infoobject</b>.
If I load data via PSA it works fine but
if I load data without PSA its giving error as Duplicate records.
Do u have any idea why it is so.
Thanks in advance
savioHi,
when you load the data via the PSA, what did you select? Serial or Paralel?
If you select serial most likely you don't have duplicates within the same datapackage and your load can go through.
Loading directly in the IObj will happen thefore if you have the same key in two different packages, the "duplicate records" will be raised; you can perhaps flag your IPack with the option "ignore duplicate records" as suggested...
hope this helps...
Olivier. -
Problem while reading data from Serial Port
Hi All,
I am facing some problem while reading data from Serial Port.
As per the requirement I am writing the data on Serial Port and waiting for response of that data.
Notification for data availabilty is checked with method public void serialEvent(SerialPortEvent event) of javax.comm.SerialPortEventListener.
When we are writing data on the port one thread i.e. "main" thread is generated and when data availability event occures another thread "Win32SerialPort Notification thread" is generated. This creates problem for me as we can't control thread processing.
So can anybody pls explain me how to overcome this problem?
Regards,
NehaMy Problem is:-
I am simoultaneouly wrting data on port & reading data from port.
First I write data on port using outputStream.write() method. Now when target side sends me response back for the request on serial port DATA_AVAILABLE of SerialPortEventListner event occured,we are reading data from serial port.Now till the time we didn't get the response from target next command can't be written on the serial port. When we are writing data on port main thread is executed.Now my problem starts when DATA_AVAILABLE event occured.At this point another thread is created.Due to this my program writes data of next command without reading response of previous command.To solve this prob. I have used wait() & notify() methods as follows.But again due to this my pc hangs after execution of 2 commands. (PC hang in while loop in a code provided below.)
From SOPs I could figure it out that after 2 commands we are not able to write data on serial port so DATA_AVAILABLE event doesn't occure n pro. goes in wait state.
Can anybody help me to solve this issue.
Neha.
Code:
public void serialEvent(SerialPortEvent event)
switch (event.getEventType())
case SerialPortEvent.BI:
case SerialPortEvent.OE:
case SerialPortEvent.FE:
case SerialPortEvent.PE:
case SerialPortEvent.CD:
case SerialPortEvent.CTS:
case SerialPortEvent.DSR:
case SerialPortEvent.RI:
case SerialPortEvent.OUTPUT_BUFFER_EMPTY:
break;
case SerialPortEvent.DATA_AVAILABLE:
try
dataThread = Thread.currentThread();
dataThread.setPriority(10);
dataAvailable = true;
byte[] tempArray=new byte[availableBytes];
inputStream.read(tempArray);
catch (IOException io)
SOP(io, "Error in serialEvent callback call for event DATA_AVAILABLE");
public void writetoPort(byte[] data) throws IOException
outputStream.write(data);
while(finalTimeOut >= actualTime)
if( ! dataAvailable)
actualTime = System.currentTimeMillis();
else
synchronized (mainThread)
mainThread = Thread.currentThread();
mainThread.wait();
public void sendDatatoUser(byte[] b) throws Exception, HWCCSystemFailure
obj.returnData(b);
synchronized(mainThread)
mainThread.notify();
-
Problem while reading data from AL11
Hi Experts,
I am using OPEN DATASET
READ DATASET
CLOSE DATASET to read data from the application sever. In application sever the file type is .CSV. So after reading data from application layer(AL11) to a text variable, using statement ' SPLIT AT ',' ' all the values passing into correspoding internal table fields. And it getting updated successfully into DB also.
In above scenario my question is, if aquantity figure with coma seperator( 95,000,000.000), then while SPLIT it's creating problem. Same case in .XLS file, it will be created # seperator in the application layer. if any field having # then it will create problem again.
So can anybody suggest how can we over come the problem. Or is there any other way to read data properly from application layer(AL11)?
Thanks and regards,
Phani.to overcom this problem,
normally we use tab as sparator
so use CL_ABAP_CHAR_UTILITIES=>VERTICAL_TAB to separate your fields!
grx
Andreas -
Error while exporting data from ABAP to Excel
Hello All,
iam trying to download data from ABAP scrn to Excel using I_OI_SPREADSHEET METHODS. I get an error in method 'SET_RANGES_DATA' - 'Memory protection fault occurred in document interface'.
I have pasted my code below. Kindly help me to solve this issue.
Create container ??
CALL METHOD c_oi_container_control_creator=>get_container_control
IMPORTING
control = g_control
error = g_error.
Initialize
CALL METHOD g_control->init_control
EXPORTING
r3_application_name = 'Basis'
parent = g_container
register_on_close_event = c_reg_on_close_event
register_on_custom_event = c_reg_on_custom_event
no_flush = c_no_flush
IMPORTING
error = g_error.
Set Doc type
g_document_type = 'Excel.Sheet'.
Create Proxy
CALL METHOD g_control->get_document_proxy
EXPORTING
document_type = g_document_type
IMPORTING
document_proxy = g_document
error = g_error.
CALL METHOD g_document->create_document
EXPORTING
document_title = 'Excel'. "#EC NOTEXT
CALL METHOD g_document->get_spreadsheet_interface
IMPORTING
sheet_interface = g_handle.
CHECK g_document IS NOT INITIAL.
read selected line data from gtab
READ TABLE g_tab_data INDEX 1 INTO l_wa_pos_trans.
Get Field Descriptions
CALL FUNCTION 'DDIF_FIELDINFO_GET'
EXPORTING
tabname = 'TRIGS_EXPORT_EXCEL'
langu = sy-langu
TABLES
dfies_tab = lt_dfies
EXCEPTIONS
not_found = 1
internal_error = 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.
Header for User Data
l_h_cnt = 1.
LOOP AT lt_dfies INTO lwa_dfies.
IF lwa_dfies-fieldname EQ 'USER_ID' OR
lwa_dfies-fieldname EQ 'EXCEL_DATE' OR
lwa_dfies-fieldname EQ 'EXCEL_TIME' OR
lwa_dfies-fieldname EQ 'SECURITY_ACCOUNT' OR
lwa_dfies-fieldname EQ 'SECURITY_ID' OR
lwa_dfies-fieldname EQ 'COMPANY_CODE'.
PERFORM fill_cell USING l_h_cnt 1 1 lwa_dfies-scrtext_m.
l_h_cnt = l_h_cnt + 1.
ENDIF.
ENDLOOP.
Fill Header Values
PERFORM fill_cell USING 1 2 1 sy-uname.
PERFORM fill_cell USING 2 2 1 sy-datum.
PERFORM fill_cell USING 3 2 1 sy-uzeit.
PERFORM fill_cell USING 4 2 1 l_wa_pos_trans-company_code .
PERFORM fill_cell USING 5 2 1 l_wa_pos_trans-security_account.
PERFORM fill_cell USING 6 2 1 l_wa_pos_trans-security_id.
Texts
l_h_cnt = l_h_cnt + 1.
PERFORM fill_cell USING l_h_cnt 1 1 text-011.
PERFORM fill_cell USING l_h_cnt 3 1 text-012.
Range for header
range_item-name = 'RANGE1'.
range_item-rows = '7'.
range_item-columns = '3'.
range_item-code = g_handle->spreadsheet_insertall.
APPEND range_item TO range_list.
CALL METHOD g_handle->set_selection
EXPORTING
left = 1
top = 1
rows = 7
columns = 3
IMPORTING
retcode = retcode.
CALL METHOD g_handle->insert_range
EXPORTING
columns = 3
rows = 7
name = 'RANGE1'
IMPORTING
retcode = retcode.
CALL METHOD g_handle->set_ranges_data
EXPORTING
ranges = range_list
contents = gt_cell_data
IMPORTING
retcode = retcode.
Columns for PC
CLEAR: gt_cell_data[].
l_pc_cnt = l_h_cnt + 1.
LOOP AT lt_dfies INTO lwa_dfies.
IF lwa_dfies-fieldname EQ 'SBWHR' OR
lwa_dfies-fieldname CP '_PC'.
PERFORM fill_cell USING l_pc_cnt 1 0 lwa_dfies-scrtext_m.
l_pc_cnt = l_pc_cnt + 1.
ENDIF.
ENDLOOP.
Pos Curr - Values
PERFORM fill_cell USING 9 2 0 trls_position_value-sbwhr.
PERFORM fill_cell USING 10 2 0 trls_position_value-purch_pc.
PERFORM fill_cell USING 11 2 0 trls_position_value-charge_pc.
PERFORM fill_cell USING 12 2 0 trls_position_value-impmnt_pc.
PERFORM fill_cell USING 13 2 0 trls_position_value-amort_pc.
PERFORM fill_cell USING 14 2 0 trls_position_value-val_ti_pc.
PERFORM fill_cell USING 15 2 0 trls_position_value-val_idx_pc.
PERFORM fill_cell USING 16 2 0 trls_position_value-val_ch_ti_pc.
PERFORM fill_cell USING 17 2 0 trls_position_value-val_ti_npl_pc.
PERFORM fill_cell USING 18 2 0 trls_position_value-val_idx_npl_pc.
PERFORM fill_cell USING 19 2 0 trls_position_value-val_ch_ti_npl_pc.
PERFORM fill_cell USING 20 2 0 trls_position_value-book_val_pc.
Columns for VC
l_vc_cnt = l_h_cnt + 1.
LOOP AT lt_dfies INTO lwa_dfies.
IF lwa_dfies-fieldname EQ 'SBWHR' OR
lwa_dfies-fieldname CP '_VC'.
PERFORM fill_cell USING l_vc_cnt 3 0 lwa_dfies-scrtext_m.
l_vc_cnt = l_vc_cnt + 1.
ENDIF.
ENDLOOP.
Val Curr
PERFORM fill_cell USING 9 4 0 trls_position_value-svwhr.
PERFORM fill_cell USING 10 4 0 trls_position_value-purch_vc.
PERFORM fill_cell USING 11 4 0 trls_position_value-charge_vc.
PERFORM fill_cell USING 12 4 0 trls_position_value-impmnt_vc.
PERFORM fill_cell USING 13 4 0 trls_position_value-amort_vc.
PERFORM fill_cell USING 14 4 0 trls_position_value-val_ti_vc.
PERFORM fill_cell USING 15 4 0 trls_position_value-val_fx_vc.
PERFORM fill_cell USING 16 4 0 trls_position_value-val_idx_vc.
PERFORM fill_cell USING 17 4 0 trls_position_value-val_ch_ti_vc.
PERFORM fill_cell USING 18 4 0 trls_position_value-val_ch_fx_vc.
PERFORM fill_cell USING 19 4 0 trls_position_value-val_fx_npl_vc.
PERFORM fill_cell USING 20 4 0 trls_position_value-val_ti_npl_vc.
PERFORM fill_cell USING 21 4 0 trls_position_value-val_idx_npl_vc.
PERFORM fill_cell USING 22 4 0 trls_position_value-val_ch_ti_npl_vc.
PERFORM fill_cell USING 23 4 0 trls_position_value-val_ch_fx_npl_vc.
PERFORM fill_cell USING 24 4 0 trls_position_value-book_val_vc.
Range for PC and VC
CLEAR: range_list[].
range_item-name = 'RANGE2'.
range_item-rows = '17'.
range_item-columns = '4'.
range_item-code = g_handle->spreadsheet_insertall.
APPEND range_item TO range_list.
CALL METHOD g_handle->set_selection
EXPORTING
left = 1
top = 9
rows = 17
columns = 4
IMPORTING
retcode = retcode.
CALL METHOD g_handle->insert_range
EXPORTING
columns = 4
rows = 17
name = 'RANGE2'
IMPORTING
retcode = retcode.
CALL METHOD g_handle->set_ranges_data
EXPORTING
ranges = range_list
contents = gt_cell_data
IMPORTING
retcode = retcode.
***********************************Form routine****************
FORM fill_cell USING i j bold val.
DATA:
wa_cell_data TYPE soi_generic_item.
wa_cell_data-row = i.
wa_cell_data-column = j.
wa_cell_data-value = val.
APPEND wa_cell_data TO gt_cell_data.
ENDFORM. "FILL_CELLSolved
-
Problem while reading data from USB with JSR80
Hi
Iam using Fedora 9 with 32 bit.
Iam using JSR80 api to read the data from USB devices.
I successfully set-up the code as per given on JSR80 site on my eclipsce ide.
below is my code which iam using to read data from usb
import com.ibm.jusb.*;
import java.util.List;
import javax.usb.*;
import java.util.List;
public class USBReader {
public static UsbInterface interf = null;
public static void main(String[] args) {
try
{// Access the system USB services, and access to the root
// hub. Then traverse through the root hub.
System.out.println("Application started");
UsbServices services = UsbHostManager.getUsbServices();
UsbHub rootHub = services.getRootUsbHub();
traverse(rootHub);
testIO(rootHub);
} catch (Exception e) {
System.out.println("The Exception occured"+e.getMessage());
public static void traverse(UsbDevice device){
System.out.println("Iam in traverse ");
if (device.isUsbHub()){
// This is a USB Hub, traverse through the hub.
System.out.println("The device is hub");
List attachedDevices = ((UsbHub) device).getAttachedUsbDevices();
System.out.println("The attached devices size:"+attachedDevices.size());
for (int i=0; i<attachedDevices.size(); i++){
traverse((UsbDevice) attachedDevices.get(i));
if(attachedDevices !=null){
for(int j=0;j<attachedDevices.size();j++){
System.out.println("The device is"+attachedDevices.get(j));
else{
// This is a USB function, not a hub.
// Do something.
System.out.println("The device is not hub");
public static void testIO(UsbDevice device) throws UsbClaimException, UsbNotActiveException, UsbDisconnectedException, UsbException{
System.out.println("Iam in testIO");
try{
// Access to the active configuration of the USB device, obtain
// all the interfaces available in that configuration.
UsbConfiguration config = device.getActiveUsbConfiguration();
List totalInterfaces = config.getUsbInterfaces();
System.out.println("The Total interfaces: "+totalInterfaces.size());
// Traverse through all the interfaces, and access the endpoints
// available to that interface for I/O.
for (int i=0; i<totalInterfaces.size(); i++){
interf = (UsbInterface) totalInterfaces.get(i);
System.out.println("The interfaces are "+totalInterfaces.get(i));
String strinf=interf.getInterfaceString();
System.out.println("Claimed Status: "+interf.isClaimed());
System.out.println("Active status : "+interf.isActive());
System.out.println("Settings :"+interf.getNumSettings());
//interf.release();
interf.claim();
List totalEndpoints = interf.getUsbEndpoints();
for (int j=0; j<totalEndpoints.size(); j++){
// Access the particular endpoint, determine the direction
// of its data flow, and type of data transfer, and open the
// data pipe for I/O.
UsbEndpoint ep = (UsbEndpoint) totalEndpoints.get(i);
int direction = ep.getDirection();
int type = ep.getType();
UsbPipe pipe = ep.getUsbPipe();
pipe.open();
// Perform I/O through the USB pipe here.
pipe.close();
interf.release();
} catch (Exception e) {
System.out.println("Exception in TestIO"+e.getMessage());
e.printStackTrace();
}When i execute the above code i get the following exception
Exception in TestIOCannot claim an interface on a virtual root hub.
javax.usb.UsbException: Cannot claim an interface on a virtual root hub.
at com.ibm.jusb.VirtualRootUsbHubImp$VirtualRootUsbInterfaceOsImp.claim(VirtualRootUsbHubImp.java:143)
at com.ibm.jusb.os.DefaultUsbInterfaceOsImp.claim(DefaultUsbInterfaceOsImp.java:54)
at com.ibm.jusb.UsbInterfaceImp.claim(UsbInterfaceImp.java:109)
at com.ibm.jusb.UsbInterfaceImp.claim(UsbInterfaceImp.java:83)
at USBReader.testIO(USBReader.java:60)
at USBReader.main(USBReader.java:15)iam not getting the clue for it .Cannot claim an interface on a virtual root hubSo don't do that? I have no idea how to tell, but clearly you need to test a few more attributes before you claim. Or else just log the claim error and continue with the next interface.
-
Problem while Fetchign data from
Hi,
I am fetching the data from table CDHDR but though there exists data in the database table, the select query is giving 0 Entries..Please look into my code.
SELECT-OPTIONS: s_lifnr FOR lfa1-lifnr, "Account Number of Vendor or Creditor
s_kunnr FOR kna1-kunnr, "Customer Number
s_bp FOR but000-partner, "Business Partner
s_udate FOR cdhdr-udate OBLIGATORY. "Create/Change Date
TYPES: BEGIN OF ty_cdhdr_v,
MANDANT type MANDT, "Client
objectclas TYPE cdobjectcl, "Object class
objectid TYPE cdobjectv, "Object value
changenr TYPE cdchangenr, "Document change number
username TYPE cdusername, "User name of the person responsible in change document
udate TYPE cddatum, "Creation date of the change document
tcode TYPE cdtcode, "Transaction in which a change was made
langu TYPE langu, "Language Key
END OF ty_cdhdr_v.
DATA : it_cdhdr_v TYPE STANDARD TABLE OF ty_cdhdr_v.
start-of-selection.
Get data from CDHDR for Vendors
SELECT MANDANT "Client
objectclas "Object class
objectid "Object value
changenr "Document change number
username "User name of the person responsible in change document
udate "Creation date of the change document
tcode "Transaction in which a change was made
langu "Language Key
INTO TABLE it_cdhdr_v
FROM cdhdr
WHERE objectclas EQ 'KRED'
AND objectid EQ s_lifnr
AND udate EQ s_udate
AND tcode IN ('XK01','XK02')
AND langu EQ sy-langu.
Regards,
Deepthi.Get data from CDHDR for Vendors
SELECT MANDANT "Client
objectclas "Object class
objectid "Object value
changenr "Document change number
username "User name of the person responsible in change document
udate "Creation date of the change document
tcode "Transaction in which a change was made
langu "Language Key
INTO TABLE it_cdhdr_v
FROM cdhdr
WHERE objectclas EQ 'KRED'
AND objectid IN s_lifnr
AND udate IN s_udate
AND tcode IN ('XK01','XK02')
AND langu EQ sy-langu. -
Problem while selecting data from external tables
Hi All,
I am facing a problem with external tabels. I have created an external table
create table ext_org_table
( id varchar2(10)
, name varchar2(100)
,id_parent varchar2(10)
,name_parent varchar2(100))
organization external
( type oracle_loader
default directory MYDIR
access parameters
records delimited by newline
nologfile
nobadfile
fields terminated by ','
missing field values are null
location ('Orgdata.csv')
reject limit unlimited;
The problem is that when i give select * from ext_org_table , i get following error
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-04040: file Orgdata.csv in MYDIR not found
ORA-06512: at "SYS.ORACLE_LOADER", line 19
ORA-06512: at line 1
Now , i have file Orgdata.csv in the specified directory.
I have created directory in oracle using create directory command.
I have granted read,write permission on the directory to user.
I have given all read,write and execute permissions to folder where my files resides.My file resides in /appl/home/kk
Now i don't understand why it is giving error file in Mydir not found.
Kindly suggest.
Regards
KrishHi,
You are obviously doing someting wrong.
May be the direcotry is not present or may be the file is not rpesent in the directory.
I just tried ths
Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.1.0
Connected as SYS
create directory mydir as 'c:\csv';
grant read,write on directory mydir to scott;From Scott
create table ext_org_table
( id varchar2(10)
, name varchar2(100)
,id_parent varchar2(10)
,name_parent varchar2(100))
organization external
( type oracle_loader
default directory MYDIR
access parameters
records delimited by newline
nologfile
nobadfile
fields terminated by ','
missing field values are null
location ('Orgdata.csv')
reject limit unlimited;
select * from ext_org_table;Ofcourse i made up some dummy data to test and its all OK.
again,
You may want to check if
1) If the directory exists (select * from all_directories where directory_name='MYDIR');
2) If the user has the read/write permissions on that directory
3) If the file orgdata exists in that directory.
Regards,
Bhushan -
Problem while uploading data from flat file
hi friends,
suppose if there are 100 records in flat file , if 20 records uploaded with out any problem and if error occurs while uploading remaing data . is necessary to upload entire data again or else only remaining data should be uploaded?
i had used call transaction for purchase order application?
please give me reply soon its urgent
thanks & regards
priyaHi Hari,
you have to upload the remaining data.
as u have used CT method, do 1 thing trap the error data in runtime & prepare another flat file. next time correct the data in new flat file. & run the DBC program again with this new flat file.
Reward if useful
Regards
ANUPAM -
Problem while loading data from quality to production
Hai,
We are using standard extractor 2LIS_11_VASCL, and in test case in QTY 300, we were able to make some changes and see the changes and see the results of the changes in T-CODE RSA3. When we try the same changes in PRD300, No Changes are triggered and T-CODE RSA3 shows no changes.
Can any one suggest me regarding this prolem...Hi bandi,
Instead of trying for the same changes in production, why cant you do the transport the object from Quality to Production & then check for the changes in RSA3.
You are transporting the object only from Quality to production.
As no data is present in PRD, u may not be finding any changes in RSA3.
Hope it helps. -
Problem while downloading data from Application server.
Hi
I have create a file on the application server.
When i tried to download the file from application server into Excel file , all the fields in the file appear in the same column.
How can place the fields separately in different columns in the Excel.
Thanks
Subha
Edited by: subhacp on Sep 5, 2011 8:32 AMHi,
Try to use below function module where you need not to do anything new, just give path of the directory where you want to store on your workstation in the parameter I_FILE_FRONT_END and give path of your application server from where you want to pick file which is in .XLS format in the FM parameter I_FILE_APPL .
It will simply copy the file from Apllication server to your workstation in the same format and with the same characters.
CALL FUNCTION 'C13Z_FILE_DOWNLOAD_BINARY'
EXPORTING
I_FILE_FRONT_END = pr_down
I_FILE_APPL = l_w_file
I_FILE_OVERWRITE = 'X'
* IMPORTING
* E_FLG_OPEN_ERROR =
* E_OS_MESSAGE =
EXCEPTIONS
FE_FILE_OPEN_ERROR = 1
FE_FILE_EXISTS = 2
FE_FILE_WRITE_ERROR = 3
AP_NO_AUTHORITY = 4
AP_FILE_OPEN_ERROR = 5
AP_FILE_EMPTY = 6
OTHERS = 7
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Hope it will solve your query. -
Problem while retreiving data from a text file
AOA
I tried to retreive text from a .txt file.
By using following code, i get junk box after every character retreived. What may be the reason.
public void run()
try
FileReader reader = new FileReader(uidsFile);
BufferedReader bin = new BufferedReader(reader);
while((line = bin.readLine()) != null )
String uid =line;// line.substring(0,4);
System.out.println(uid.trim());
catch(Exception x)
JOptionPane.showMessageDialog(null ,
x.getStackTrace(),
JOptionPane.INFORMATION_MESSAGE);
}The reason would be that that is what your text file looks like (namely UTF-16) while you use a FileReader without specifying any encoding, which means that it will choose your platform default - which is not UTF-16.
Maybe you are looking for
-
Forcing a page to open at an anchor
Hi, I'm new to Muse and web design in general. Is there a way, perhaps with anchors, to make a page load at certain point maybe 1/4 of the way down a page. I ask because I've used scroll effects to make the header on my home page shrink to a smaller
-
Used Iweb to upload to ftp but now all my mobileme sites show up on ftp
I created a website on Iweb, then uploaded to Mobile me for final drafting process. When the client was satisfied, I moved the website to their designated ftp server using Iweb. Now, however, all the other websites I've been creating on Iweb and uplo
-
All of a sudden usb ports quit working
usb ports quite working. There does not seem to be anything in them. Any ideas.
-
Automatically set "volumes for work"
For every project I want to keep all relevant files together. Thus for each project I want to set the path for "working volumes" ( Final Cut Pro --> system settings --> volumes for work) and waveform cache, pictogramm cache and auto save automaticall
-
No sound when AT2020 USB mic is connected.
Followed set up instructions I can see logic pro x recognizes the mic but I get no sound. I will only get sound from my USB keyboard when the USB mic is disconnected.