Gettin Entire cell in MS-Excel Sheet?
Hi Friends,
I'm trying to get the data from MS-Excel and then try to persists in the data base...
here my code goes like this:
try {
Long OID;
String Pricing_Type;
Float Min_Spend = null;
Float Max_Spend = null;
String Pricing_Access_Type = null;
int Pricing_Term_Commitment = 0;
String State;
String Jurisdiction = null;
Float Pricing_Min;
Float Pricing_Max;
POIFSFileSystem pofilesystem=new POIFSFileSystem(new FileInputStream("D:\\abbrivations\\Enterprise Connections Pricing.xls"));
HSSFWorkbook hbook=new HSSFWorkbook(pofilesystem);
HSSFSheet hsheet=hbook.getSheetAt(0);
String Judisdiction;
Judisdiction=hbook.getSheetName(0);
System.out.println("NAME:::::::::"+hbook.getSheetName(0));
Iterator rows = hsheet.rowIterator();
while( rows.hasNext() ) {
HSSFRow row = (HSSFRow) rows.next();
System.out.println("Row number"+row.getRowNum());
Iterator cells = row.cellIterator();
do {
HSSFCell cell = (HSSFCell) cells.next();
// HSSFCellStyle style=cell.getCellStyle();
// int index=style.getFontIndex();
Pricing_Type="VCM Pricing";
int count=0;
switch ( cell.getCellType() ) {
case HSSFCell.CELL_TYPE_STRING:
String stringcell=cell.getStringCellValue ();//+" ";
System.out.print( cell.getStringCellValue () +" ");
break;
case HSSFCell.CELL_TYPE_FORMULA:
String stringdate=cell.getCellFormula();
System.out.print( cell.getCellFormula()+" " );
break;
case HSSFCell.CELL_TYPE_NUMERIC:
String string=String.valueOf(cell.getNumericCellValue());
System.out.print( cell.getNumericCellValue() +" ");
break;
case HSSFCell.CELL_TYPE_ERROR:
//String string=String.valueOf(cell.getNumericCellValue())+" ";
System.out.print( "+++++++++"+cell.getErrorCellValue() );
break;
case HSSFCell.CELL_TYPE_BOOLEAN:
String stringencoding=String.valueOf(cell.getBooleanCellValue());
System.out.print( "Error in Boolean"+cell.getBooleanCellValue());
break;
} while( cells.hasNext() );
} catch (IOException ioe) {
System.err.println(ioe.getMessage());
Actually My MS-Excel sheet having the data as
Title
Tiers | Swiched | Dedicated
|1 Year | 2 Year | 3 Year | 1 Year | 2 Year | 3Year
Here the Tiers wil consists of the data as $1000-$9000......
my job is to select the $1000 as minmum and $9000 as Maxmimum.......type of the system...like Swiched or Dedicated......term condition like 1 year or 2 year.....
and then persiste in data base....wht my code is doing is...trying to get each row in the sheet and then try to get each column...instead can i do it any other form.....or is there any method of getting the entire column elements at a time....
wating for reply...needed importantly......
thanq friend
[email protected]
I would go to Open Office and its SDK and use it to work with Excel cells and many other document formats.
www.openoffice.org
Similar Messages
-
How to handle merge cells in the excel sheet while uploading
Hi guys,
I have a requirement where i need to upload the excel sheet. The data is given below.
field1 field2 field3 field4
a x 1 1
2 2
3 3
y1 4 4
y2 5 5
y3 6
The output must be
a x 1 1
a x 2 2
a x 3 3
a y1 4 4
a y2 5 5
a y3 5 6
Here the field1 column is merged.
Please let me know if you guys have sample code to handle the merge cells in the excel sheet, that would be of gereat help.
Regards,
KarthikHi guys,
I have a requirement where i need to upload the excel sheet. The data is given below.
field1 field2 field3 field4
a x 1 1
2 2
3 3
y1 4 4
y2 5 5
y3 6
The output must be
a x 1 1
a x 2 2
a x 3 3
a y1 4 4
a y2 5 5
a y3 5 6
Here the field1 column is merged.
Please let me know if you guys have sample code to handle the merge cells in the excel sheet, that would be of gereat help.
Regards,
Karthik -
How to get(copy) the contents i.e the cell of an excel sheet to other excel
How to get(copy) the contents i.e the cells of an excel sheet to another excel sheet.
I can read the contents i.e the text in the cells and able to display it in the Java console
i want these contents to be copied to another excel sheet with the cells data.
I am using Java Swing for the UI, POI framework for the excel work.
Please anyone suggest some code to this requirement.[spreadsheets with poi|http://poi.apache.org/spreadsheet/converting.html] Hi
on the poi apache site there's a number of good examples...
I started with poi only a week ago, but just from reading these examples
(especially SS Usermodel code) i managed all i needed to know (so far).
kind regards
BB
Edited by: BugBunny on Feb 22, 2010 4:36 AM -
How to synchronize a cell in form with a cell in MS excel sheet
dear all
I can successfuly export data to excell using the ole2 package. But the problem is that exporting data from A datablock in a form to Excel sheet is not enough.
I need to automaticaly copy updates occures on the datablock to its equilivant in the excel sheet. In other words , i need to synchronize my datablock items with facing cells in the excel sheet,so the cells'values in excel sheet automatiacly changes to be the values in the datablock items
please helpDear all
I can successfuly export data to excell using the ole2 package. But the problem is that exporting data from A datablock in a form to Excel sheet is not enough.
I need to automaticaly copy updates occures on the datablock to its equilivant in the excel sheet. In other words , I need to synchronize my datablock items with facing cells in the excel sheet,so the cells'values in excel sheet automatiacly changes to be the values in the datablock items
I searched the web several times . Some people adviced me to use "Apache-jakarta-poi" . It is a pure java code. But my knoledge in java is limited.I asked on Oracle forums -
how to synchronize a cell in form with a cell in MS excel sheet - but no one can help
I tried the oracle forms demo "OLEEXCEL.fmb" . But this form is not working correct .
I need to embed ole2 in my form that holds excel sheet and passes values from text items to the excel sheet.
My last try is that I did the following :
1- in the main canvas i insert the OLE2 control
2- Right Click and choose insert
3- from the dialog i chosed Excel Sheet
4- I placed a button on my canvas then i on the button I write this code
declare
worksheet ole2.obj_type;
cell ole2.obj_type;
args ole2.list_type;
begin
forms_ole2.activate_server('block1.excel_sheet');
worksheet := forms_ole2.get_interface_pointer('block1.excel');
args := ole2.create_arglist;
ole2.add_arg(args,1) -- column1
ole2.add_arg(args,1) -- cell1
cell := ole2.invoke_obj(worksheet,'cell',args);
ole2.destroy_arglist(args);
ole2.set_property('cell','value',:text1);
ole2.release_obj(cell);
ole2.release_obj(worksheet);
end;
I get this error ora-305500
and when i debug , the code stop in this line : cell := ole2.invoke_obj(worksheet,'cell',args);
please help -
Change the default setting of 'Match entire cell contents' in Excel 2007
Hi,
I am using Excel 2007 on Windows 7 and need to search the contents of cells in a large spreadsheet on a regular basis.
When I open the Find and Replace dialogue box, the Match entire cell contents option is always checked. I deselect this to search for the cell contents I require. If I then enter any values into a cell and try to search for another cell,
the Match entire cell contents option is activated again.
Is there a way to change the default setting for this checkbox to be off rather than on?
Thank you,
Nitin SunejaHi Chad,
I will check if it is something localised to the spreadsheet itself as it is shared by a number of people and all are having this problem with this sheet.
Thanks for looking into this for me.
Nitin. -
How to get the Last cell in HSSFCell (Excel sheet)
Hello
I am trying to convert an excel sheet to a tab limited file.
I am using HSSF and unable to track how do i know if the cell encountered is a last filled cell in excel sheet
Some of the cells in the sheet can be blank. In that case i am just using inputting a '\t' for that cell and read the next one. But coz of this when i get the last cell, a tab is included for that too.
Can someone let me know how can i rectify this?
it seems like HSSFCell does not have any methos like lastCell or so
Thanxthen use getLastCellNum() in org.apache.poi.hssf.usermodel.HSSFRow
-
How to change the cell value in Excel Sheet in WD Java?
HI,
I have an application which is used to upload and download excel sheet.I can upload the excel sheet through Upload UI element and also able to download the same file through Download UI.But before download I want to validate the excel sheet.If data is not proper in the excel then I have to put some comment (cell comment).I am able to read each cell value,but not ble to put any comment.Once I pt commen in the cell,the download file should display the commented in the excel sheet.
Please let me know how to update hte excel sheet.
Sandiphi Sandeep,
I'm not sure about the HSSF apis, however, i inserted the Cell Comments using jexcel apis. There is a method setComment(java.lang.String s, double width, double height) in class WritableCellFeatures using which you can insert cell comments
For more details refer [link|http://jexcelapi.sourceforge.net/resources/javadocs/current/docs/jxl/write/WritableCellFeatures.html]
Abhinav -
How to dowload data in particular cell of designed excel sheet
hi everyone
i want to dowload the data in a excel sheet, but this excel sheet is designed in such a format that i have download each field of internal table in a specified cell only , <b>gui_download</b> function module simply download the data in excel sheet by taking the first cell for first field but i dont want thatHi Neetu,
you can use OLE in that case.
REPORT ZTEST_EXCEL .
INCLUDE ole2incl.
DATA: application TYPE ole2_object,
workbook TYPE ole2_object,
sheet TYPE ole2_object,
cells TYPE ole2_object.
CONSTANTS: row_max TYPE i VALUE 256.
DATA index TYPE i.
DATA: BEGIN OF itab1 OCCURS 0,
first_name(10),
last_name(10),
END OF itab1.
START-OF-SELECTION.
itab1-first_name = '123445'.
itab1-last_name = 'tesst'.
append itab1.
clear itab1.
itab1-first_name = '123446'.
itab1-last_name = 'tesst'.
append itab1.
clear itab1.
CREATE OBJECT application 'excel.application'.
SET PROPERTY OF application 'visible' = 1.
CALL METHOD OF application 'Workbooks' = workbook.
CALL METHOD OF workbook 'Add'.
* Create first Excel Sheet
CALL METHOD OF application 'Worksheets' = sheet
EXPORTING #1 = 1.
CALL METHOD OF sheet 'Activate'.
SET PROPERTY OF sheet 'Name' = 'Sheet1'.
LOOP AT itab1.
index = row_max * ( sy-tabix - 1 ) + 1. " 1 - column name
CALL METHOD OF sheet 'Cells' = cells EXPORTING #1 = index.
SET PROPERTY OF cells 'Value' = itab1-first_name.
index = index + 1. " 1 - column name
CALL METHOD OF sheet 'Cells' = cells EXPORTING #1 = index.
SET PROPERTY OF cells 'Value' = itab1-last_name.
ENDLOOP.
* Save excel speadsheet to particular filename
CALL METHOD OF sheet 'SaveAs'
EXPORTING #1 = 'c:tempexceldoc1.xls' "filename
#2 = 1. "fileFormat
Regards
vijay -
Protect The Cells in the Excel Sheet Even After giving the password.
Hi All,
I need to protect the cells in the report even after unprotecting the sheet after giving password.
That is, i have used some excel formulas in some cells, these cells are to be protected.
In Reports using EVDRE all the cells are getting, "Locked" option selected in the Protection tab by default. Even if we change that Option and refresh the sheet Locked is getting selected again.
So once we Protect the sheet using password all cells are getting locked. But once we remove password all cells are free to enter.
I want the user of the Sheet to use only certain columns in the Sheet. and all the other columns should not be user editable.
Please help me out in solving this issue.
Thanks in Advance,
Regards,
G.Vijaya KumarHi Vijaya,
I tested in my test environment and even after refresh , the range cells are still editable, they didnt get locked. I did the following:
1. Selected the range or column in Excel, then Tools - Protection - Allow users to edit range. I selected the range and gave the password.
2. Next I protected the complete sheet.
3. Now entire sheet is protected. Now again I selected the range in which I want to edit, first time it will ask for password which you gave for the range. So I gave and I was able to edit the cells.
4. I selected other cells and was not able to edit it so they are still locked.
5. I tried to refresh the report , and then I selected the range cells to edit and still I was able to edit it. Those cells didnt get locked.
So did you do the same things?
Thanks. -
Can we embed Excel sheet in another excel cell through ABAP
Hi Gurus,
Is it possible to embed .doc or .txt or .xls file in fixed(reference cell eg: E30) excel sheet cell using abap ?
Thanks in advance.
Regards,
PrasadHi Venkat,
See this coding.
CONCATENATE 'put UEMPORDE0' '
' sy-host '\Order\salesord_t_e'
INTO gv_name3.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
handle = lv_hdl
command = gv_name3
compress = lv_compress
TABLES
data = lt_result
EXCEPTIONS
tcpip_error = 1
command_error = 2
data_error = 3
OTHERS = 4.
Rajesh -
Hi,
we all sometime or the other have faced the problem with SO_NEW_DOCUMENT_ATT_SEND_API1, it passes all the data into a single excel sheet. the following is the code i have written using the same standard FM to resolve the issue.
Problem's Facing : To send the output of a report as mail attachment (Excel sheet) from SAP, to the User's outlook or TCP/IP
What is happening : All the data which is being passed to the excel is being put in a single cell of the excel sheet.
Cause : the difficulty lies in getting the internal table from SAP report, passing it to email Function Module If the structure of the internal Table is unknown .
Solution:
if the user while sending data to the Function module ( created using the following code) puts a '#' between field values, all the fields gets separated into individual cells and the data gets printed as required.
<b>advantages</b> of the following code are:
1) User just need to type userid or multiple userid's separated by comma.
2) Performs multiple tasks with one function module.
3) It can be used to send file with subject only
4) It can be used to send file with subject and body
5) It can be used to send file with subject, body, and attachment
6) Attachment can be of 'TXT' format or 'XLS' format depending upon the choice of the user.
7) User specific parameters for EMAILID, subject, body and attachment type avoiding the dump error of "Type conflict"
8) If the user requires to send output of a report as an excel file, then a single internal table will store the total output separating the field values by ' # ' and the data gets printed evenly. the ' # ' symbol is used as Tab delimiter.
FUNCTION zemail_attachment.
""Local Interface:
*" IMPORTING
*" REFERENCE(EMAILID)
*" REFERENCE(SUBJECT)
*" REFERENCE(ATYPE)
*" TABLES
*" ATTACH_FILE STRUCTURE SOLISTI1
*" BODY OPTIONAL
*" EXCEPTIONS
*" INCORRECT_PARAMETERS
This table requires information about how the data in the
tables OBJECT_HEADER, CONTENTS_BIN and CONTENTS_TXT are
to be distributed to the documents and its attachments.
DATA it_objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
This table must contain the summarized data dependent on each object type.
SAPscript objects store information here about forms and styles,
for example. Excel list viewer objects store the number of rows and columns
amongst other things and PC objects store their original file name.
DATA it_objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE.
This table must contain the summarized content of the objects identified as binary objects.
DATA it_objbin TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
This table must contain the summarized content of the objects identified as ASCII objects.
DATA it_objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE.
This table must contain the document recipients.
DATA it_reclist LIKE somlreci1 OCCURS 5 WITH HEADER LINE .
This structure must contain the attributes of the document to be sent.
DATA: doc_ching LIKE sodocchgi1.
DATA: tab_lines LIKE sy-tabix.
Create the internal table for body , subject
DATA: it_body LIKE solisti1 OCCURS 10 WITH HEADER LINE.
*creation of internal table for Email-id.
DATA: BEGIN OF it_mailid OCCURS 0,
email LIKE kna1-name1 ,
END OF it_mailid.
*VARIABLES
DATA : v_hash(1) TYPE c VALUE '#'.
DATA: v_string1 LIKE kna1-name1,
v_string2 LIKE kna1-name1,
v_string3(12) TYPE c VALUE '@GMAIL.COM'.
*CONSATNTS
CONSTANTS: c_con_cret TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,
c_con_tab TYPE c VALUE cl_abap_char_utilities=>cr_lf,
c_raw(3) TYPE c VALUE 'RAW',
c_comma(1) TYPE c VALUE ',',
c_rec_type(1) TYPE c VALUE 'U',
c_space(1) TYPE c VALUE ''.
Move Body to Internal Table (body into it_body)
LOOP AT body .
MOVE body TO it_body .
APPEND it_body .
ENDLOOP.
doc_ching-obj_descr = subject. "Subject of the Email
Move the Subject and Body to OBJTXT
it_objtxt[] = it_body[].
DESCRIBE TABLE it_objtxt LINES tab_lines.
READ TABLE it_objtxt INDEX tab_lines.
doc_ching-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( it_objtxt ).
CLEAR it_objpack-transf_bin.
it_objpack-head_start = 1.
it_objpack-head_num = 0.
it_objpack-body_start = 1.
it_objpack-body_num = tab_lines.
it_objpack-doc_type = c_raw.
APPEND it_objpack.
Convert to Excel format
IF NOT attach_file[] IS INITIAL.
IF atype IS INITIAL.
RAISE INCORRECT_PARAMETERS.
ELSEIF atype = 'XLS' .
LOOP AT attach_file .
CONCATENATE attach_file v_hash INTO attach_file.
REPLACE ALL OCCURRENCES OF v_hash IN attach_file WITH c_con_cret.
IF sy-tabix = 1.
MOVE attach_file TO it_objbin.
ELSE.
CONCATENATE c_con_tab attach_file INTO it_objbin.
ENDIF.
APPEND it_objbin.
ENDLOOP.
ELSEIF atype = 'TXT' .
Convert to Text format
LOOP AT attach_file .
REPLACE ALL OCCURRENCES OF v_hash IN attach_file WITH c_con_cret.
CONCATENATE attach_file c_con_tab INTO it_objbin .
APPEND it_objbin .
ENDLOOP.
ENDIF.
DESCRIBE TABLE it_objbin LINES tab_lines.
it_objhead = subject. APPEND it_objhead.
Creating the entry for the compressed attachment
it_objpack-transf_bin = 'X'.
it_objpack-head_start = 1.
it_objpack-head_num = 1.
it_objpack-body_start = 1.
it_objpack-body_num = tab_lines.
*check for XLS ,TXT files
IF atype = 'XLS'.
it_objpack-doc_type = atype.
ELSEIF atype = 'TXT'.
it_objpack-doc_type = c_raw.
ENDIF.
it_objpack-obj_name = 'ATTACHMENT'.
it_objpack-obj_descr = 'ATTACHMENT'. "Attachment File Name
it_objpack-doc_size = tab_lines * 255.
APPEND it_objpack..
ENDIF.
Entering names in the distribution list
Concatenating the email with '@GMAIL.COM if the user doesnot specify any mail extension
recipent type as U - for internet usage
SPLIT emailid AT c_comma INTO TABLE it_mailid.
APPEND it_mailid.
LOOP AT it_mailid.
SHIFT it_mailid-email LEFT DELETING LEADING c_space.
SPLIT it_mailid-email AT '@' INTO: v_string1 v_string2.
IF v_string2 IS INITIAL AND NOT it_mailid-email IS INITIAL.
CONCATENATE v_string1 v_string3 INTO it_reclist-receiver.
it_reclist-rec_type = c_rec_type.
APPEND it_reclist.
CLEAR: v_string1,v_string2.
ELSE.
it_reclist-receiver = it_mailid-email.
it_reclist-rec_type = c_rec_type.
APPEND it_reclist.
ENDIF.
ENDLOOP.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = doc_ching
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = it_objpack
object_header = it_objhead
contents_bin = it_objbin
contents_txt = it_objtxt
receivers = it_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
OTHERS = 99.
ENDFUNCTION.
If anyone, has a better solution, please share
Cheers
Ajayissue resolved
-
How to convert an excel sheet as pdf and sent mail?
Hi,
I have to open an excel file from report and display a value in a cell, based on that value in excel, macros will automatically trigger and the remaining data will fill in excel sheet.
This sheet i need to convert as pdf and sent as attachment to mail.
Regards,
ShreeHi,
I know how to do with word documents using OLE. But i dont know how to work with Excel sheets.
I have worked on word documents like displaying data in word document from SAP and saving it into local system.
But here my requirement is i need to pass pernr to a cell in an Excel sheet, based on pernr in excel some macros will trigger and fill the details. After that, the filled sheet i need to convert as pdf and sent as mail.
Regards,
Shree. -
How to create Links in a cell to other Excel docs Cell in Planning layout
Hi All,
I have a requirement to replace an existing forecasting process using normal Excel with BPS with Excel in place. One difficulty I came across is that the existing Excel input template has cells with links to many other excel files so users does not to open all other Excel documents and copy and paste the figures in.
I am stuck on replicate this function in BPS as I cannot create links to to other Excel directly in a cell in BPS Excel layout. My initial idea is to create a Macro to copy the data across but in deeper thought this might not be the best solution as the number of excel link can be a lot and the name and location of these files might change quite frequently and I cannot hard code it in the macro..
Any ideas?
Thanks.Hi Marc,
The reason to use BPS is once the data is in the layout, we need to run the data in a true forecast / simulation model (i.e. compare actuals, copy data between differnt planning versions, Foreign Exchange rate planning , allocation, revaluation, etc...) on a different hierarchy level.
The problem is the starting point data is scattered in lots of other Excel file from local drives from different users. I guess this is the same reason why the csv file upload technique exist, (i.e. to load data to the layout )but in my case the data location needed to be very dynamic and comes from large / different source of data.
I have now developed a solution to reference data from cells in different Excel sheet to the layout. Once set up, it should be able to save users significant amount of time to bring the base data into the layout, especially if their data is source from many ither Excel files.
Regards,
Danny -
I am using the type pools OLE2 to put colors in the Excel sheet.
What is the property to fill color in the Excel sheet cell.
Also I need to merge cells in the excel sheet.
Can some one send me some sample code if you have?
Please help.Its urgent.hi rowal,
Hi Ashutosh...Use the below code i think it will be helpful
This program demonstrates how to send abap data to excel sheet
using OLE automation
include ole2incl.
*handles for OLE object
data: h_excel type ole2_object, " Excel object
h_mapl type ole2_object, " list of workbooks
h_map type ole2_object, " workbook
h_zl type ole2_object, " cell
h_f type ole2_object. " font
data: h type i.
types: begin of t_bkpf,
bukrs type bkpf-bukrs,
belnr type bkpf-belnr,
gjahr type bkpf-gjahr,
blart type bkpf-blart,
budat type bkpf-budat,
end of t_bkpf.
data: it_bkpf type standard table of t_bkpf,
wa_bkpf type t_bkpf.
********start-of-selection*******************
start-of-selection.
select bukrs
belnr
gjahr
blart
budat into table it_bkpf
from bkpf
up to 10 rows.
call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
PERCENTAGE = 0
text = text-001
exceptions
others = 1.
Start excel
create object h_excel 'EXCEL.APPLICATION'.
perform err_hdl.
set property of h_excel 'Visible' = 1.
perform err_hdl.
call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
PERCENTAGE = 0
text = text-002
exceptions
others = 1.
call method of h_excel 'workbooks' = h_mapl.
perform err_hdl.
Add a new workbook
call method of h_mapl 'Add' = h_map.
perform err_hdl.
call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
PERCENTAGE = 0
text = text-003
exceptions
others = 1.
Output Column Headings to active excel sheet
perform fill_cell using 1 1 1 text-004.
perform fill_cell using 1 2 1 text-005.
perform fill_cell using 1 3 1 text-006.
perform fill_cell using 1 4 1 text-007.
perform fill_cell using 1 5 1 text-008.
Copy internal table to excel sheet
loop at it_bkpf into wa_bkpf.
h = sy-tabix + 1.
perform fill_cell1 using h 1 0 wa_bkpf-bukrs.
perform fill_cell2 using h 2 0 wa_bkpf-belnr.
perform fill_cell1 using h 3 0 wa_bkpf-gjahr.
perform fill_cell1 using h 4 0 wa_bkpf-blart.
perform fill_cell1 using h 5 0 wa_bkpf-budat.
endloop.
disconnect from Excel
free object h_excel.
perform err_hdl.
*& Form err_hdl
text
--> p1 text
<-- p2 text
form err_hdl .
if sy-subrc <> 0.
write: / 'Error in OLE Automation'.
stop.
endif.
endform. " err_hdl
*& Form fill_cell
text
-->P_1 text
-->P_1 text
-->P_1 text
-->P_TEXT_004 text
form fill_cell using i j bold val.
call method of h_excel 'Cells' = h_zl exporting #1 = i #2 = j.
perform err_hdl.
set property of h_zl 'Value' = val .
perform err_hdl.
get property of h_zl 'Font' = h_f.
perform err_hdl.
set property of h_f 'Bold' = bold .
perform err_hdl.
set property of h_f 'colorindex' = 10.
endform. " fill_cell
*& Form fill_cell1
text
-->P_H text
-->P_1 text
-->P_0 text
-->P_WA_BKPF_BUKRS text
form fill_cell1 using i j bold val.
call method of h_excel 'Cells' = h_zl exporting #1 = i #2 = j.
perform err_hdl.
set property of h_zl 'Value' = val .
perform err_hdl.
get property of h_zl 'Font' = h_f.
perform err_hdl.
set property of h_f 'Bold' = bold .
perform err_hdl.
endform. " fill_cell1
*& Form fill_cell2
text
-->P_H text
-->P_2 text
-->P_0 text
-->P_WA_BKPF_BELNR text
form fill_cell2 using i j bold val.
call method of h_excel 'Cells' = h_zl exporting #1 = i #2 = j.
perform err_hdl.
set property of h_zl 'Value' = val .
perform err_hdl.
get property of h_zl 'Font' = h_f.
perform err_hdl.
set property of h_f 'Bold' = bold .
perform err_hdl.
set property of h_f 'colorindex' = 13.
endform. " fill_cell2
hope the code will help you to solve the problem,
reward points if usefull,
Thanks ,
kalyan. -
Field seperator in excel sheet.
Hi experts,
I am using GUI_DOWNLOAD to populate fields from internal table into excel sheet. I need to seperate the fields with ~ symbol. How should i do this?Hi,
Just uncomment the Export parameter write_field_seperator with ' ' blanck space, in GUI_DOWNLOAD FM.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
filename = pbk
FILETYPE = 'ASC'
APPEND = ' '
write_field_separator = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
The data in each field will be in each cell of the Excel sheet.
Regards
Krishna
Maybe you are looking for
-
I'm using Mail 4.4. Recently most of the e-mails I receive with embedded photos now show a blue box with a question mark instead of a photo. This has only been happening for a couple of months. Photos added as an attachment can be viewed all right in
-
DB version: 11.2 OS : AIX 6.1 We have a 2 node RAC. We have one Disk group for all datafiles, tempfiles, redo logs,..etc. Currenly in our primary DB, Redo logs look like SQL> SELECT a.group#, b.thread#, a.member, b.bytes FROM v$logfile a, v$log b WHE
-
9.2 deployment problem.
I created a simple portal on 9.2 beta and deployed. Deployment was not successful and here is the dump in console. Pl. help. \weblogic.policy weblogic.Server Listening for transport dt_socket at address: 8453 <Jun 8, 2006 10:57:11 AM EDT> <Notice> <W
-
No XML Messeges generation in SRM
Dear Experts, I am working on SRM-SUS scenarion on SRM Server 7.0, I have correctly configured XI ESOA Scenario and also transferred vendors from SRM to SUS through SupplierPortalTradingPartner_CreateOrChange_Out messege type but PurchaseOrderReque
-
In some idocs if the idocs are not posted there would be multiple error message for the particular idoc.Where can we view the multiple error messages?