Removing JScrollPane column header
Hi
I have created a JScrollPane containg a table.
JTable d_pointDataTable;
JScrollPane pointDataPane;
d_pointDataTable = new JTable(15,15);
d_pointDataPane = new JScrollPane(d_pointDataTable);
But my scroll pane appears with a column header as A,B, C, etc.
How can I remove the same. Besides no matter how much I set the JTable to be , my Jscrollpane takes some default size. How do I set the size of the JScrollPane ?
Regards,
Anand
Hi,
The setTableHeader(null) removes the table header. But somehow I am not getting the horizontal scroll bar. It is only the vertical scroll bar that appears. How can i get both the horizontal and vertical scroll bar considering that my table is larger than the view port size?
Regards,
Anand
Similar Messages
-
No column heading in second page in alv report when save in excel file
Hi Expert,
How can i remove the column header from Alv report when program execute in background and save in excel file right now
its comming column header in each page. Client dont want header column in excel from second page. is this possible?
with regards
chandan_vijiHi Ravi,
thanks for reply i have solved this problm throug line count and NEW-PAGE LINE COUNT 10000 bcoz client want output in excel file only one page header.
with regards
chandan_viji -
Report Header and Column Header Removal
Hi,
we wanted remove report headers and Column header in each downloaded report. we are planning on using the Report header specifiers while reading each line, specifiers like "Report Name:","Report Time:","Time Zone:","Report
Filter:", etc.,
Here the question is are these values changes in a given version for each report? OR is it better to go by using line numbers i.e say first 8 lines always represents Report Headers and Next line is always blank and 10th line is always Column Header?
Report Name: Budget Summary
Report Time: 1/18/2015
Time Zone: Various
Last Completed Available Day: N/A
Last Completed Available Hour: N/A
Report Aggregation: Day
Report Filter:
Rows: 615
Date Account number
Account name Campaign name
Currency code
ThanksGood question. Yes the reports all generally follow the pattern you described. I have reached out to the feature team, and will follow up with the suggested best practice.
-
[ADF FACES] How to remove the "select" header in selection column
Hi,
Is there a way I can prevent the "select" header to be rendered (or customize this header) for the selection column in a af:table when using either af:tableSelectOne or af:tableSelectMany?
Emmanuel.Hi, I've read you filed an ER (in 2004, it's 2007 now) to be able to remove/adjust the header in a selection column. Until now I can only find threads/posts about people facing the same issue, the header can't be adjusted. The answer of one of the Oracle-employees is that it isn't supported and we can extend the adf-source code but this isn't supported by Oracle.
What's the official answer of Oracle on this?
This is a very popular issue that needs to be adressed to pleaze the customer that was convinced to use Oracle ADF ... and now we can't answer his requests?
This issue has been around for quite a long time now, from 2004, there has to be a solution for this, wright? -
Removing columns heading for a perticular page in ALV list display
Dear All,
For last page of my ALV list display i need to remove columns heading (Strictly for single page only).
Kindly help me with possible solution.
I am triggering page break by using group attribute in the sort catalogue.( l_v_sortcat-group = '* '. )
Best Regards
Ravishekar Thallapallyif u can catch the page number,
while building fieldcat, put the condition
if sy-page = (page number)
ls_fielcact-fieldname = fieldname.
ls_fieldcat-tech = 'X'.
LS_FIELDCAT-NO_OUT = 'x'.
modify lt_fielcat from ls_fieldcat.
but how r u catching page number?? can u pls tell
endif.
Message was edited by: Hymavathi Oruganti -
How to display column header of a JTable in JScrollpane's RowHeader
Can anyone tell me if it's possible to display the colum headers of a JTable which acts as the row headers of a JScrollpane object?
If the answer is yes, could he/she point me to the right direction?
Thanks,I'm guessing the answer is no because the column header is layed out horizontally and a row header is layed out vertically. But it should be easy enough to test:
scrollPane.setRowHeaderView(table.getTableHeader());
Its not hard to create your own row header. Search the forum using "+setrowheaderview +camickr" to find examples I've posted. -
Removing Icons in column header
Hi,
I am getting Icons before each column header like that of rows in my Query output. I want to display only the column header text without any icon. Is there any way?
Regards,
KrishnaHi,
Thanks for your reply. Hi,
I have used only RKFs and CKFs in Columns. I cannot find display as 'text' properties for these Key Figures. Are there any other options? -
Hi all,
I have searched for jtable without column header... and if it´s possible how can I make?
thanksOverride JTable#configureEnclosingScrollPane() to do nothing or remove the table header manually ( jScrollPane.setColumnHeader(null) ) after you added the table to the scroll pane.
-
Supress Column Heading - File Content Conversion in Sender Adapter
Hi,
Let me give a more clear picture about my scenario. I need to convert CSV File to XML output:-
My source file has column heading and values. The sample data is mentioned hereunder:-
PERNR;KID;PNALT;NACHN;NAME2;VORNA
;1200;1200;Angus
I have created a data type as under:-
DT_LegacyEmployee (Category - Complex Type)
Employees (Category - Element, Occurence - 1)
Header (Category - Element, Occurence - 0...1)
PERNR_H
KID_H
PNALT_H
NACHN_H
NAME2_H
VORNA_H
Employee (Categroy - Element, Type - DT_LegacyEmployee_Row, Occurence - 0...unbounded)
PERNR
KID
PNALT
NACHN
NAME2
VORNA
The file conversion parameters in the file sender adapter are mentioned hereunder:-
Document Name - MT_LegacyEmployee
Document Namespace - http://abc.com/xi
Recordset Name - Employees
Rescordset Structure - Header,1,Employee,*
Recordsets per Message - 1
Key Field Type - String (Case Sensitive)
Employee.fieldSeparator - ;
Employee.endSeparator - 'nl'
Employee.fieldNames - PERNR,KID,PNALT,NACHN,NAME2,VORNA
I dont' have a key field value. How do we remove the header and show only the values in the xml output. I have searched the forum topics as well checked many blogs related to file content conversion, but nothing helped. Kindly advice how to fix this issue. Thanks in advance.
Regards.
PraveenHi Praveen,
Change your File Adapter as below
Document Name - MT_LegacyEmployee
Document Namespace - http://abc.com/xi
Recordset Name - Employees
Rescordset Structure - Employee,*
Recordsets per Message - 1
Key Field Type - String (Case Sensitive)
Employee.fieldSeparator - ;
Employee.endSeparator - 'nl'
Employee.fieldNames - PERNR,KID,PNALT,NACHN,NAME2,VORNA
There is no need for the Header required in the data type.
DT_LegacyEmployee (Category - Complex Type)
Employees (Category - Element, Occurence - 1)
Employee (Categroy - Element, Type - DT_LegacyEmployee_Row, Occurence - 0...unbounded)
PERNR
KID
PNALT
NACHN
NAME2
VORNA
Now the trick is in the mapping program
Lets assume your mapping looks like
MT_LegacyEmployee ---> MT_TargetEmployee
- Employees ---> Records
- Employee ---> Record
- PERNR ---> TargetPERNR
- .. so on
When you do a mapping from Employee ---> Record apply the following logic.
(PERNR)--->
(TestEquals =) --->(NOT)--->
(Constant) ---> (IF)
(PERNR) (IF Without Else) ---> (Record)
(THEN)
(Employee)--->
When doing this make sure RightClick on PERNR and Select Context ---> Employees.
By default context would be from Employee and it will give you an error of XSD format. So make sure you are changing the context. -
How can i bring the column heading downloaded in excel sheet?
hi all,
I am using FM SAP_CONVERT_TO_XLS_FORMAT to downloading populated internal table data into excel sheet by using filename type rlgrap-filename.
Now I need the column heading(field name) for downloaded data in excel sheet.
pls tell me how can i merge the col heading with data perfectly. Is there any FM fulfills this requirement.
pls give me a suitable approch.
Thanks
PRRHI,
Go thru this code.
REPORT ZRMM0056 NO STANDARD PAGE HEADING
MESSAGE-ID ZZ
LINE-SIZE 300
LINE-COUNT 65.
Program : ZRMM0056
Title : Non Inventory PO's
Description : Non Inventory Purchase Orders details with
Vendor and Invoice Receipts and Goods Receipts.
Input :
Select-options : 1. G/L Account No
Parameters : 1.File Paths for the Excel sheet
Others (Specify):
Output : Extract Files in the application server
Report :
Hear Ticket # : 113392
Created by : Srinivas Rao.M
Created on : 12/15/2005
Version : 1
Request : D10K944304
Transaction Code : Z420
Change History *
Date Programmer Search String Description *
12/19/2005 Srinivas D10K944316 Removed Purchasing document
Company code and Plant from
Select-Options and Inculded
G/L Account No and changed
code accordingly.
T A B L E S *
TABLES: EKBE, " History of Purchasing Document
EKPO, " Purchasing Document Item
EKKO, " Purchasing Document Header
LFA1, " Vendor master (general section)
EKKN. " Account Assignment in Purchasing Doc
INTERNAL TABLES
*--Internal table to store Purchasing document header data
DATA : BEGIN OF IT_POHEADER OCCURS 0,
EBELN LIKE EKKO-EBELN, "Purchasing document
AEDAT LIKE EKKO-AEDAT, "Created on
ERNAM LIKE EKKO-ERNAM, "Created by
LIFNR LIKE EKKO-LIFNR, "Vendor
END OF IT_POHEADER.
*--Internal table to store Purchasing document Item data
DATA : BEGIN OF IT_POITEM OCCURS 0,
EBELN LIKE EKPO-EBELN, "Purchasing document
EBELP LIKE EKPO-EBELP, "Item Number
MATNR LIKE EKPO-MATNR, "Material number
BUKRS LIKE EKPO-BUKRS, "Company code
WERKS LIKE EKPO-WERKS, "Plant
MATKL LIKE EKPO-MATKL, "Material Group
MENGE LIKE EKPO-MENGE, "Order Quantity
NETPR LIKE EKPO-NETPR, "Net Price
PEINH LIKE EKPO-PEINH, "Price unit
NETWR LIKE EKPO-NETWR, "Net Value
END OF IT_POITEM.
*--Internal table to hold final display data.
DATA : BEGIN OF IT_FINAL OCCURS 0,
EBELN LIKE EKKO-EBELN, "Purchasing document
EBELP LIKE EKPO-EBELP, "Item Number
AEDAT LIKE EKKO-AEDAT, "Created on
ERNAM LIKE EKKO-ERNAM, "Created by
MATNR LIKE EKPO-MATNR, "Material number
BUKRS LIKE EKPO-BUKRS, "Company code
WERKS LIKE EKPO-WERKS, "Plant
MATKL LIKE EKPO-MATKL, "Material Group
MENGE LIKE EKPO-MENGE, "Order Quantity
NETPR LIKE EKPO-NETPR, "Net Price
PEINH LIKE EKPO-PEINH, "Price unit
NETWR LIKE EKPO-NETWR, "Net Value
LIFNR LIKE EKKO-LIFNR, "Vendor
NAME1 LIKE LFA1-NAME1, "Vendor Name
GSBER LIKE EKKN-GSBER, "Business area
*--IR details
IR_BELNR LIKE EKBE-BELNR, "IR-Number of Material Document
IR_BUZEI LIKE EKBE-BUZEI, "IR-Item in material Document
IR_BUDAT LIKE EKBE-BUDAT, "IR-Posting date
IR_MENGE LIKE EKBE-MENGE, "IR-Quantity
*--GR details
GR_BELNR LIKE EKBE-BELNR, "GR-Number of Material Document
GR_BUZEI LIKE EKBE-BUZEI, "GR-Item in material Document
GR_BUDAT LIKE EKBE-BUDAT, "GR-Posting date
GR_MENGE LIKE EKBE-MENGE, "GR-Quantity
END OF IT_FINAL.
*--Internal table to store History per Purchasing Document data
DATA : BEGIN OF IT_HISTORY OCCURS 0,
EBELN LIKE EKBE-EBELN, "Purchasing document
EBELP LIKE EKBE-EBELP, "Item
VGABE LIKE EKBE-VGABE, "Trans/Event type
BELNR LIKE EKBE-BELNR, "Number of Material Document
BUZEI LIKE EKBE-BUZEI, "Item in material Document
BUDAT LIKE EKBE-BUDAT, "Posting date
MENGE LIKE EKBE-MENGE, "Quantity
BEWTP LIKE EKBE-BEWTP, "Posting history category
END OF IT_HISTORY.
*--Internal table to store vendor name.
DATA : BEGIN OF IT_VENDOR OCCURS 0,
LIFNR LIKE LFA1-LIFNR, "Vendor Number
NAME1 LIKE LFA1-NAME1, "Vendor Name
END OF IT_VENDOR.
*--Internal table to store Business area for Purchasing document
DATA : BEGIN OF IT_BUSINESS OCCURS 0,
EBELN LIKE EKKN-EBELN, "Purchasing document
EBELP LIKE EKKN-EBELP, "Purchasing Item
SAKTO LIKE EKKN-SAKTO, "G/L Account No
GSBER LIKE EKKN-GSBER, "Business area
END OF IT_BUSINESS.
DATA : BEGIN OF FIELDNAMES OCCURS 0,
TEXT(40),
END OF FIELDNAMES.
VARIABLES DECLARATION *
DATA: V_FILE LIKE IBIPPARMS-PATH, "File path
V_FLD LIKE DYNPREAD-FIELDNAME, "Dynpread fieldname
V_FLAG(1) VALUE SPACE. "FLAG VARIABLE
SELECTION-SCREEN *
SELECTION-SCREEN BEGIN OF BLOCK S1 WITH FRAME TITLE TEXT-001.
*--Begin of change D10K944316
SELECT-OPTIONS : S_SAKTO FOR EKKN-SAKTO. "G/L Accoun no.
*--End of change D10K944316
SELECTION-SCREEN END OF BLOCK S1.
SELECTION-SCREEN BEGIN OF BLOCK S2 WITH FRAME TITLE TEXT-002.
PARAMETERS : P_EXCEL AS CHECKBOX DEFAULT ' ' . " download to excel
PARAMETERS : C_FILE(128) DEFAULT : 'C:\ZRMM0056.xls'.
SELECTION-SCREEN END OF BLOCK S2.
A T S E L E C T I O N - S C R E E N *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR C_FILE.
*-Form to get file path for download of data
PERFORM GET_FILE_PATH.
AT SELECTION-SCREEN.
PERFORM SCREEN_VALIDATIONS.
START-OF-SELECTION
START-OF-SELECTION.
*--Extract Purchasing document header data.
PERFORM GET_PO_HEADER_DATA.
*--Extract Purchasing document Item data.
IF NOT IT_BUSINESS[] IS INITIAL.
PERFORM GET_PO_ITEM_DATA.
*--Get complete required data in final internal table
PERFORM GET_FINAL_DATA.
ENDIF.
END-OF-SELECTION
END-OF-SELECTION.
IF V_FLAG IS INITIAL.
*--Display Purchasing document details
IF NOT IT_FINAL[] IS INITIAL.
PERFORM DISPLAY_PODATA.
IF P_EXCEL = 'X'.
*--To down load data to excel sheet
PERFORM DOWN_LOAD_TO_EXCEL.
ENDIF.
ENDIF.
ELSE.
MESSAGE I001(ZZ) WITH 'No data found'(003).
ENDIF.
TOP-OF-PAGE
TOP-OF-PAGE.
*--To display page header
PERFORM PAGE_HEADER.
*& Form GET_PO_HEADER_DATA
To Get Purchasing header data
FORM GET_PO_HEADER_DATA .
*--To extract Business Area details
CLEAR IT_BUSINESS.
REFRESH IT_BUSINESS.
SELECT EBELN "Purchasing document
EBELP "Purchasing document item
SAKTO "G/L Account no
GSBER "Business area
FROM EKKN
INTO TABLE IT_BUSINESS
WHERE SAKTO IN S_SAKTO.
IF SY-SUBRC <> 0.
V_FLAG = 'X'.
MESSAGE I001(ZZ) WITH
'No data selected for the given selection criteria'(004).
STOP.
ELSE.
*--To extract Purchasing document details with respect
to G/L Account no
CLEAR IT_POHEADER.
REFRESH IT_POHEADER.
SELECT EBELN "Purchasing document
AEDAT "Created on
ERNAM "Created by
LIFNR "Vendor
FROM EKKO
INTO TABLE IT_POHEADER
FOR ALL ENTRIES IN IT_BUSINESS
WHERE EBELN = IT_BUSINESS-EBELN.
IF NOT IT_POHEADER[] IS INITIAL.
CLEAR IT_VENDOR.
REFRESH IT_VENDOR.
*--Extracting Vendor details
SELECT LIFNR "Vendor #
NAME1 "Name
FROM LFA1
INTO TABLE IT_VENDOR
FOR ALL ENTRIES IN IT_POHEADER
WHERE LIFNR = IT_POHEADER-LIFNR.
ENDIF.
ENDIF.
ENDFORM. " GET_PO_HEADER_DATA
*& Form GET_PO_ITEM_DATA
To extract Purchasing document item data
FORM GET_PO_ITEM_DATA .
CLEAR IT_POITEM.
REFRESH IT_POITEM.
SELECT EBELN "Purchasing document
EBELP "Item Number
MATNR "Material number
BUKRS "Company code
WERKS "Plant
MATKL "Material Group
MENGE "Order Quantity
NETPR "Net Price
PEINH "Price unit
NETWR "Net Value
FROM EKPO
INTO TABLE IT_POITEM
FOR ALL ENTRIES IN IT_BUSINESS
WHERE EBELN = IT_BUSINESS-EBELN
AND EBELP = IT_BUSINESS-EBELP.
IF NOT IT_POITEM[] IS INITIAL.
CLEAR IT_HISTORY.
REFRESH IT_HISTORY.
SELECT EBELN "Purchasing document
EBELP "Item
VGABE "Trans/Event type
BELNR "Number of Material Document
BUZEI "Item in material Document
BUDAT "Posting date
MENGE "Quantity
BEWTP "Posting history category
FROM EKBE
INTO TABLE IT_HISTORY
FOR ALL ENTRIES IN IT_POITEM
WHERE EBELN = IT_POITEM-EBELN
AND EBELP = IT_POITEM-EBELP
AND ( VGABE = '1' OR VGABE = '2' ) "1 = GR , 2 = IR
AND ( BEWTP = 'Q' OR BEWTP = 'E' ). "Q = GR , R = IR
IF SY-SUBRC = 0.
SORT IT_HISTORY BY EBELN EBELP.
ENDIF.
ENDIF.
ENDFORM. " GET_PO_ITEM_DATA
*& Form GET_FILE_PATH
Select file path
FORM GET_FILE_PATH .
CLEAR V_FILE.
MOVE 'p_flname' TO V_FLD.
MOVE C_FILE TO V_FILE.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = V_FLD
IMPORTING
FILE_NAME = V_FILE
EXCEPTIONS
OTHERS = 1.
MOVE V_FILE TO C_FILE.
ENDFORM. " GET_FILE_PATH
*& Form PAGE_HEADER
To Print page header and other details
FORM PAGE_HEADER .
*--Page Header
ULINE AT /1(300).
FORMAT COLOR 1.
WRITE:/ 'Run Date:'(005), SY-DATUM, 45 'Stanley Works'(006),
100 'Page No:'(007), SY-PAGNO LEFT-JUSTIFIED, 298 ''.
WRITE:/ 'Run Time:'(008), SY-UZEIT, 43 SY-TITLE, 100 SY-UNAME, 298 ''.
WRITE:/ 'Source :'(009), SY-SYSID, 100 SY-CPROG, 298 ''.
FORMAT COLOR OFF.
ULINE AT /1(300).
FORMAT COLOR 4.
WRITE : / SY-VLINE , (10) 'Purchasing Doc'(010),
SY-VLINE, (5) 'Item'(011),
SY-VLINE, (10) 'Created On'(012),
SY-VLINE, (7) 'Crea By'(013),
SY-VLINE, (10) 'Material'(014),
SY-VLINE, (6) 'Com cd'(015),
SY-VLINE, (5) 'Plant'(016),
SY-VLINE, (10) 'Mat Group'(017),
SY-VLINE, (13) 'Order Qty'(018),
SY-VLINE, (11) 'Net Price'(019),
SY-VLINE, (10) 'Price Unit'(020),
SY-VLINE, (13) 'Net Value'(021),
SY-VLINE, (8) 'Bus Area'(022),
SY-VLINE, (10) 'Vendor'(023),
SY-VLINE, (28) 'Vendor Name'(024),
*--IR details
SY-VLINE, (10) 'IR-Mat Doc'(025),
SY-VLINE, (5) 'IR-It'(026),
SY-VLINE, (9) 'IR-Post dt'(027),
SY-VLINE, (13) 'IR-Quantity'(028),
*--GR details
SY-VLINE, (10) 'GR-Mat Doc'(029),
SY-VLINE, (5) 'GR-It'(030),
SY-VLINE, (9) 'GR-Post dt'(031),
SY-VLINE, (13) 'GR-Quantity'(032), SY-VLINE.
FORMAT COLOR OFF.
ULINE AT /1(300).
ENDFORM. " PAGE_HEADER
*& Form SCREEN_VALIDATIONS
Selection screen validations
FORM SCREEN_VALIDATIONS .
*--Validation for G/L Account No
IF NOT S_SAKTO IS INITIAL.
SELECT SAKNR UP TO 1 ROWS
INTO EKKN-SAKTO
FROM SKA1 WHERE
SAKNR IN S_SAKTO.
ENDSELECT.
IF SY-SUBRC <> 0.
MESSAGE E001(ZZ) with 'Please enter a valid G/L Account no'(048).
ENDIF.
ENDIF.
*--Validation for Excel file path
IF P_EXCEL = 'X'.
IF C_FILE = ' '.
MESSAGE E001(ZZ) with 'Please enter a valid Excle Path'(035).
ENDIF.
ENDIF.
ENDFORM. " SCREEN_VALIDATIONS
*& Form DISPLAY_PODATA
To Display Purchasing Document details
FORM DISPLAY_PODATA .
FORMAT COLOR 2.
SORT IT_FINAL BY EBELN EBELP AEDAT BUKRS WERKS.
LOOP AT IT_FINAL.
WRITE : / SY-VLINE ,(10) IT_FINAL-EBELN, "Purchasing Doc
SY-VLINE, (5) IT_FINAL-EBELP, "Item
SY-VLINE, (10) IT_FINAL-AEDAT, "Created On
SY-VLINE, (7) IT_FINAL-ERNAM, "Created By
SY-VLINE, (10) IT_FINAL-MATNR, "Material
SY-VLINE, (6) IT_FINAL-BUKRS, "Company code
SY-VLINE, (5) IT_FINAL-WERKS, "Plant
SY-VLINE, (10) IT_FINAL-MATKL, "Material Group
SY-VLINE, (13) IT_FINAL-MENGE, "#EC UOM_IN_MES
"Order Qty
SY-VLINE, (11) IT_FINAL-NETPR, "#EC UOM_IN_MES
"Net Price
SY-VLINE, (10) IT_FINAL-PEINH, "#EC UOM_IN_MES
"Price Unit
SY-VLINE, (13) IT_FINAL-NETWR, "#EC UOM_IN_MES
"Net Value
SY-VLINE, (8) IT_FINAL-GSBER, "Bus Area
SY-VLINE, (10) IT_FINAL-LIFNR, "Vendor
SY-VLINE, (28) IT_FINAL-NAME1, "Vendor name
*--IR details
SY-VLINE, (10) IT_FINAL-IR_BELNR, "IR-Mat Doc
SY-VLINE, (5) IT_FINAL-IR_BUZEI, "IR-It
SY-VLINE, (9) IT_FINAL-IR_BUDAT, "IR-Post dt
SY-VLINE, (13) IT_FINAL-IR_MENGE, "#EC UOM_IN_MES
"IR-Quantity
*--GR details
SY-VLINE, (10) IT_FINAL-GR_BELNR, "GR-Mat Doc
SY-VLINE, (5) IT_FINAL-GR_BUZEI, "GR-It
SY-VLINE, (9) IT_FINAL-GR_BUDAT, "GR-Post dt
SY-VLINE, (13) IT_FINAL-GR_MENGE, SY-VLINE.
"#EC UOM_IN_MES
"GR-Quantity
ENDLOOP.
FORMAT COLOR OFF.
ENDFORM. " DISPLAY_PODATA
*& Form DOWN_LOAD_TO_EXCEL
text
FORM DOWN_LOAD_TO_EXCEL .
<b>REFRESH FIELDNAMES.
FIELDNAMES-TEXT = TEXT-010.
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = TEXT-011.
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = TEXT-012.
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = 'Created By'(036).
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = TEXT-014.
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = 'Company Code'(037).
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = TEXT-016.
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = 'Material Group'(038).
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = 'Order Quantity'(039).
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = TEXT-019.
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = TEXT-020.
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = TEXT-021.
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = 'Business Area'(040).
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = TEXT-023.
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = TEXT-024.
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = 'IR Material Doc'(041).
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = 'IR Item'(042).
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = 'IR Posting Date'(043).
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = TEXT-028.
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = 'GR Material Doc'(044).
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = 'GR Item'(045).
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = 'GR Posting Date'(046).
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = TEXT-032.
APPEND FIELDNAMES.CLEAR FIELDNAMES.
*--FM to download data to Excel sheet
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
FILENAME = C_FILE
FILETYPE = 'DAT'
TABLES
DATA_TAB = IT_FINAL
FIELDNAMES = FIELDNAMES
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TABLE_WIDTH = 4
INVALID_TYPE = 5
NO_BATCH = 6
UNKNOWN_ERROR = 7
GUI_REFUSE_FILETRANSFER = 8
OTHERS = 9.
IF SY-SUBRC <> 0.
MESSAGE E001(ZZ) WITH 'Data could not downloaded'(047).
ENDIF.</b>ENDFORM. " DOWN_LOAD_TO_EXCEL
*& Form GET_FINAL_DATA
To Populate required data in final internal table
FORM GET_FINAL_DATA .
CLEAR IT_FINAL.
REFRESH IT_FINAL.
LOOP AT IT_POITEM.
CLEAR IT_POHEADER.
READ TABLE IT_POHEADER WITH KEY EBELN = IT_POITEM-EBELN.
IF SY-SUBRC = 0.
MOVE : IT_POHEADER-EBELN TO IT_FINAL-EBELN, "Purchasing Doc
IT_POITEM-EBELP TO IT_FINAL-EBELP, "Item
IT_POHEADER-AEDAT TO IT_FINAL-AEDAT, "Created On
IT_POHEADER-ERNAM TO IT_FINAL-ERNAM, "Created By
IT_POITEM-MATNR TO IT_FINAL-MATNR, "Material
IT_POITEM-BUKRS TO IT_FINAL-BUKRS, "Company code
IT_POITEM-WERKS TO IT_FINAL-WERKS, "Plant
IT_POITEM-MATKL TO IT_FINAL-MATKL, "Material Group
IT_POITEM-MENGE TO IT_FINAL-MENGE, "Order Qty
IT_POITEM-NETPR TO IT_FINAL-NETPR, "Net Price
IT_POITEM-PEINH TO IT_FINAL-PEINH, "Price Unit
IT_POITEM-NETWR TO IT_FINAL-NETWR, "Net Value
IT_POHEADER-LIFNR TO IT_FINAL-LIFNR. "Vendor
*--To Insert IR details
CLEAR IT_HISTORY.
READ TABLE IT_HISTORY WITH KEY EBELN = IT_POITEM-EBELN
EBELP = IT_POITEM-EBELP
VGABE = '2'
BEWTP = 'Q'.
IF SY-SUBRC = 0.
MOVE :
IT_HISTORY-BELNR TO IT_FINAL-IR_BELNR, "IR-Number of Mat Doc
IT_HISTORY-BUZEI TO IT_FINAL-IR_BUZEI, "IR-Item in mat Doc
IT_HISTORY-BUDAT TO IT_FINAL-IR_BUDAT, "IR-Posting date
IT_HISTORY-BUDAT TO IT_FINAL-IR_MENGE. "IR-Quantity
ENDIF.
*--To insert GR details
CLEAR IT_HISTORY.
READ TABLE IT_HISTORY WITH KEY EBELN = IT_POITEM-EBELN
EBELP = IT_POITEM-EBELP
VGABE = '1'
BEWTP = 'E'.
IF SY-SUBRC = 0.
MOVE :
IT_HISTORY-BELNR TO IT_FINAL-GR_BELNR, "IR-Number of Mat Doc
IT_HISTORY-BUZEI TO IT_FINAL-GR_BUZEI, "IR-Item in mat Doc
IT_HISTORY-BUDAT TO IT_FINAL-GR_BUDAT, "IR-Posting date
IT_HISTORY-BUDAT TO IT_FINAL-GR_MENGE. "IR-Quantity
ENDIF.
*--To insert Vendor details
CLEAR IT_VENDOR.
READ TABLE IT_VENDOR WITH KEY LIFNR = IT_POHEADER-LIFNR.
IF SY-SUBRC = 0.
MOVE : IT_VENDOR-NAME1 TO IT_FINAL-NAME1.
ENDIF.
*--To insert Business area
CLEAR IT_BUSINESS.
READ TABLE IT_BUSINESS WITH KEY EBELN = IT_POITEM-EBELN
EBELP = IT_POITEM-EBELP.
IF SY-SUBRC = 0.
MOVE : IT_BUSINESS-GSBER TO IT_FINAL-GSBER.
ENDIF.
APPEND IT_FINAL.
CLEAR IT_FINAL.
ENDIF.
ENDLOOP.
ENDFORM. " GET_FINAL_DATA
thanks
Sunil -
JTable - Check box in column header with sorting
Hello
I have 3 problems/questions.
1. When adding sorting to a table with
setAutoCreateRowSorter(true);and you click on a column header, normally a sorting arrow will appear, and indicate in what direction its sorting,
but in the column head with the checkbox, even though the sorting works, the arrow will never appear. Is there anyway to fix this?
2. Is there anyway to get the checkboxes in the table cells to be aligned left (I dont mean the columnheader checkbox, but the ones below)?
3. When you click on the columnheader to either sort or check the checkbox, you will have to wait about a second between each click, or else it won't react and won't sort. sometimes you will have to click twice for it to react. If you click a lot of times fast, then it won't react until you stop for a second, and click again, though it will react only on the first click, but not the secont, third, fourh, and so on, until you stop for a second. Is there anyway to fix this, or atleast make it have a better reaction time?
This is the code for creating the table:
public class Example extends JFrame{
private Container container;
private JTable exampleTable;
public Example(){
container = getContentPane();
ExamleTableModel examleTableModel = new ExamleTableModel();
exampleTable = new JTable(examleTableModel);
TableColumn tc = exampleTable.getColumnModel().getColumn(0);
tc.setCellEditor(exampleTable.getDefaultEditor(Boolean.class));
tc.setCellRenderer(exampleTable.getDefaultRenderer(Boolean.class));
tc.setHeaderRenderer(new CheckBoxHeader(new MyItemListener()));
container.add(new JScrollPane(exampleTable), BorderLayout.SOUTH);
exampleTable.setAutoCreateRowSorter(true);
setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
this.pack();
setSize(500,500);
setVisible(true);
}This is the code for the checkboxheader:
class MyItemListener implements ItemListener
public void itemStateChanged(ItemEvent e) {
Object source = e.getSource();
if (source instanceof AbstractButton == false) return;
boolean checked = e.getStateChange() == ItemEvent.SELECTED;
for(int a = 0, b = exampleTable.getRowCount(); a < b; a++) {
for(int c = 0, d = exampleTable.getRowCount(); c < d; c++) {
if(exampleTable.getColumnName(c).equals("")){
exampleTable.setValueAt(new Boolean(checked),a,c);
class CheckBoxHeader extends JCheckBox
implements TableCellRenderer, MouseListener {
protected CheckBoxHeader rendererComponent;
protected int column;
protected boolean mousePressed = false;
public CheckBoxHeader(ItemListener itemListener) {
rendererComponent = this;
this.setHorizontalAlignment(JLabel.LEFT);
rendererComponent.addItemListener(itemListener);
public Component getTableCellRendererComponent(
JTable table, Object value,
boolean isSelected, boolean hasFocus, int row, int column) {
if (table != null) {
JTableHeader header = table.getTableHeader();
if (header != null) {
rendererComponent.setForeground(header.getForeground());
rendererComponent.setBackground(header.getBackground());
rendererComponent.setFont(header.getFont());
header.addMouseListener(rendererComponent);
setColumn(column);
rendererComponent.setText("");
setBorder(UIManager.getBorder("TableHeader.cellBorder"));
return rendererComponent;
protected void setColumn(int column){this.column = column;}
public int getColumn(){return column;}
protected void handleClickEvent(MouseEvent e) {
if (mousePressed) {
mousePressed=false;
JTableHeader header = (JTableHeader)(e.getSource());
JTable tableView = header.getTable();
TableColumnModel columnModel = tableView.getColumnModel();
int viewColumn = columnModel.getColumnIndexAtX(e.getX());
int column = tableView.convertColumnIndexToModel(viewColumn);
if (viewColumn == this.column && e.getClickCount() == 1 && column != -1) {
doClick();
public void mouseClicked(MouseEvent e) {
boolean active=true;
JTableHeader header = (JTableHeader)(e.getSource());
switch (e.getID()) {
case MouseEvent.MOUSE_CLICKED:
case MouseEvent.MOUSE_PRESSED:
case MouseEvent.MOUSE_RELEASED:
JTable tableView = header.getTable();
TableColumnModel columnModel = tableView.getColumnModel();
int viewColumn = columnModel.getColumnIndexAtX(e.getX());
int column = tableView.convertColumnIndexToModel(viewColumn);
Rectangle bounds = tableView.getCellRect(-1, column, false);
if (e.getX() > bounds.x + 16) { // only if one the checkbox
if (e.getID() == MouseEvent.MOUSE_CLICKED) {active = false;}
}else{active=true;}
if(active){
handleClickEvent(e);
((JTableHeader)e.getSource()).repaint();
public void mousePressed(MouseEvent e){mousePressed = true;}
public void mouseReleased(MouseEvent e){}
public void mouseEntered(MouseEvent e){}
public void mouseExited(MouseEvent e){}
}If you want the code for the ExamleTableModel, I will post it if you ask (having trouble with the character limit).What are you supposed to cast it to? I might have tried to cast it to something wrong.
I tried
TableCellRenderer tcr = table.getDefaultRenderer(Boolean.class);
((DefaultTableCellRenderer)tcr).setHorizontalAlignment(SwingConstants.LEFT);and that gave me a ClassCastException. But I might have been trying to cast it to the wrong thing. -
JTable not displaying column Heads
The following JPanel was constructed using JBuilder 7 (a horrendous piece of software) and is in GridBagLayout. I'm attempting to display the contents of a table using JTable, and whilst it displays the rows it doesn't display the columnHeads! What am I doing wrong?
import java.sql.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.*;
import java.text.*;
public class BeginTask extends JPanel implements ActionListener{
private boolean dbupdated;
private MainFrame main;
private JLabel jLabel1 = new JLabel();
private JLabel jLabel2 = new JLabel();
private JTable jTable1 = new JTable();
private JButton jButton1 = new JButton();
private JButton jButton2 = new JButton();
private GridBagLayout gridBagLayout1 = new GridBagLayout();
private Connection connection;
private String url = "jdbc:odbc:bapers";
private String username = "";
private String password = "";
public BeginTask(MainFrame ma) throws SQLException{
main = ma;
logon();
drawTable();
try {
jbInit();
catch(Exception ex) {
ex.printStackTrace();
void jbInit() throws Exception {
jLabel1.setFont(new java.awt.Font("Dialog", 1, 18));
jLabel1.setText("Begin Task");
this.setLayout(gridBagLayout1);
jLabel2.setText("Select Task, and press OK.");
jButton1.setText("OK");
jButton2.setText("CANCEL");
jButton1.addActionListener(this);
jButton2.addActionListener(this);
this.add(jButton1, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(12, 117, 14, 0), 94, 8));
this.add(jButton2, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(19, 43, 7, 119), 62, 8));
this.add(jTable1, new GridBagConstraints(0, 2, 2, 1, 1.0, 1.0
,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(12, 25, 0, 22), 522, 281));
this.add(jLabel2, new GridBagConstraints(0, 1, 2, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 181, 0, 226), 13, 6));
this.add(jLabel1, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(29, 202, 0, 251), 19, 17));
public void actionPerformed(ActionEvent e) {
if (e.getSource() == jButton1) {
if (dbupdated == true)
JOptionPane.showMessageDialog(null, "The database has been updated to show that the user has begun the task selected.");
else if (dbupdated == false)
JOptionPane.showMessageDialog(null, "The database has not been updated.");
else if (e.getSource() == jButton2) {
BapProcMain bpm = new BapProcMain(main);
main.redisplay(bpm);
public void logon() {
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
connection = DriverManager.getConnection(url, username, password);
catch (ClassNotFoundException cnfex) {
System.err.println("Failed to load the JDBC/ODBC driver.");
cnfex.printStackTrace();
System.exit(1);
catch (SQLException sqlex) {
System.err.println("Unable to connect (SQL error)");
sqlex.printStackTrace();
public void logoff() {
if (connection == null) return;
try { connection.close(); }
catch (SQLException sqlex) {
System.err.println("Unable to disconnect (SQL error)");
public void drawTable() {
Statement stmt;
ResultSet rset;
try {
String query = "SELECT * FROM SpecificTask";
stmt = connection.createStatement();
rset = stmt.executeQuery(query);
displayResultSet(rset);
stmt.close();
catch (SQLException sqlex) {
sqlex.printStackTrace();
private void displayResultSet(ResultSet rs) throws SQLException {
// position to first record
boolean moreRecords = rs.next();
// if there are no records, display a message
if (! moreRecords){
JOptionPane.showMessageDialog (this, "No Specific Tasks to begin.");
return;
Vector columnHeads = new Vector();
Vector rows = new Vector();
try {
// get column heads
ResultSetMetaData rsmd = rs.getMetaData();
for (int i = 1; i <= rsmd.getColumnCount(); ++i)
columnHeads.addElement (rsmd.getColumnName(i));
//get row data
// System.out.println("Got this far. Check getNextRow(...)");
do { rows.addElement(getNextRow(rs, rsmd)); }
while (rs.next());
// display table with ResultSet contents
jTable1 = new JTable (rows, columnHeads);
JScrollPane scroller = new JScrollPane(jTable1);
// validate();
catch (SQLException sqlex) {
sqlex.printStackTrace();
private Vector getNextRow (ResultSet rs, ResultSetMetaData rsmd) throws SQLException {
Vector currentRow = new Vector();
for (int i = 1; i <= rsmd.getColumnCount(); ++ i)
switch (rsmd.getColumnType(i)) {
case Types.VARCHAR:
currentRow.addElement(rs.getString(i));
break;
case Types.INTEGER:
currentRow.addElement(new Long (rs.getLong(i) ) );
break;
default: System.out.println ("Type was: " +
rsmd.getColumnTypeName(i));
return currentRow;
}The table header is shown automatically when you add the table to a scrollpane and then display the scrollpane in a panel. You use the following code to build the table/scrollpane:
// display table with ResultSet contents
jTable1 = new JTable (rows, columnHeads);
JScrollPane scroller = new JScrollPane(jTable1);
but, you add the table to your panel NOT the scrollpane:
this.add(jTable1, new GridBagConstraints(0, 2, 2, 1, 1.0, 1.0
,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(12, 25, 0, 22), 522, 281));
You should be adding the scrollpane to you panel. -
Hi,
I'm working on a tableview but if my table is displayed without any rows... all the column headings are partially displayed, e.g. the column header text is "Employee" but it is displayed as "Em...", The column with automatically expands when there is value in the particular column. I tried to used columnWidth attribute but its not working. here is the code extract of the tableview.
<htmlb:tableView id = "list"
emptyTableText = "No result found!"
selectionMode = "MULTISELECT"
sort = "SERVER" <%--or APPLICATION --%>
onHeaderClick = "myHeaderClick"
onNavigate = "onMyNavigate"
onRowSelection = "onMyRowSelection"
<u>columnWidth = "100%"</u>
visibleRowCount = "<%= lepp %>"
visibleFirstRow = "<%= iv_list_nav_index %>"
width = "100%"
table = "//model/mt_list"
headerVisible = "<%= IV_HEADER_VISIBLE %>"
iterator = "<%= io_iterator %>" />Hi Asim,
you have something wrong with the variables you are passing. Try the following ideas.
1. Replace all the variables with hardcoded values, for example
visibleRowCount = "20"
visibleFirstRow = "1"
2. Remove the iterator attribute to see if your iterator has been incorrectly coded.
This code should work fine.
<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<%
data itab type table of sflight.
select * from sflight into table itab.
%>
<htmlb:content design="design2003" >
<htmlb:page title="Test tableView" >
<htmlb:form>
<htmlb:tableView id = "list"
emptyTableText = "No result found!"
selectionMode = "MULTISELECT"
sort = "SERVER"
onHeaderClick = "myHeaderClick"
onNavigate = "onMyNavigate"
onRowSelection = "onMyRowSelection"
columnWidth = "100%"
visibleRowCount = "20"
visibleFirstRow = "1"
width = "100%"
table = "<%= itab %>"
headerVisible = "TRUE" />
</htmlb:form>
</htmlb:page>
</htmlb:content>
Use it as a starting point for your layout page and gradually add your specific stuff.
Cheers
Graham -
JTable does not display table column header
I create a JFrame with a JScrollPane in which I place a mainPanel (=JPanel ) consisting of a leftPanel (=JPanel ) and a rightPanel (=JPanel ). I add to the rightPanel a JTable using constructor JTable(tableModel dm). I overrode method dm.getColumnName(int coulmnIndex) and verified that this method is being invoked. The JTable is being placed in the rightPanel but without column header.
// Using BorderLayout
JTable table = new JTable(tableData, tableHeaders);
add(table, BorderLayout.CENTER);
add(table.getTableHeader(), BorderLayout.NORTH); -
Hi Experts,
This is File to IDOC scenario. The source file is a csv file with header and item records.
The file comes with column headings and now problem is how to remove the column headings using my content conversion.
Any help would be appericiated
Regards,
VijayHi Prakash,
Yes you are right but now my problem is the file will not have the header all the time. Actually the source files are generated from different legacy systems so some may have column headings and some may not have.. but the structure remains the same.
Regards,
Vijay
Message was edited by: Vijay Kuruvila
Message was edited by: Vijay Kuruvila
Maybe you are looking for
-
HP-UX vs. NT performace issue
I have a J2EE application that I've recently ported from a WINNT development box to a 2-CPU HP L-class server. I am running Weblogic 6.1, SP1 on both machines. On a particularly memory-intensive piece of the application, I've notice a performance dro
-
Making a dynamically generated field as Read Only
Hi All, I am extending a standard CO and in that I wanted to make an entire table as read only. I checked by personalizing the page from front end, but as the items are dynamically generated fields , they are not visible in personalize page. So is th
-
Errors in managed server of OCSG
hi, i am getting following error in the managed server of OCSG Thread-14 "[STUCK] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'" <alive, in native, suspended, priority=1, DAEMON> { jrockit.net.SocketNativeIO.readBytesPinned(So
-
I apologise if this is the wrong section, or even if it's been answered already, but I couldn't find that info. Basically I'm hoping to pick up a new MBP sometime soon, and I'm at uni so I'm eligible for the HE Student Discount, knocking several hund
-
Since the last upgrade I have been having a lot of crashes. I moved a number of old mail to the server at about the same time. Hence I thought it was something I did. I have heard from an ISP that there is rumor or maybe more than a rumor about a pro