Add Button to Caption Bar of JFrame?
Hi All,
Has anyone been able to add a button to the caption bar of a JFrame? If so can you point to an example?
Thanks
Hi,
Check out this Thread.
Hope that help,
Jack
Similar Messages
-
Add new button on title bar of JFrame
how can i add new button (like minimize, maximize and close) on title bar of JFrame.
actually i want a new button for system try icon. if user click on this button JFrame will hide and system try icon will be visibleHi,
Check out this Thread.
Hope that help,
Jack -
Hello,
Just getting into the iPhone. I've looked but I must be missing something fundamental.
I have a table view which drills down to another table view. Simple enough. On the second level table view, I need the "back" button to get back to the parent but I also want an Edit button so I can delete child rows and I want an add "+" button so I can add child rows. If I specify the Edit button, on the left, I loose my "back" button and can't get back to the parent table. If I put Edit on the right, I have no place for the Add button. What am I missing?
Thanks,
TomThanks, yeah, I see that I could enable the add function with edit now. I'm not sure how to really do this however. It looks like I have to insert "phantom" rows in the table view that say "Add item" and the green + will go next to those?
Seems like I'd be playing games with the cellForRowAtIndexPath delegate to do that or is there some magic that happens to make the phantom row?
Where do I put the phantom row - top of the list, bottom of the list? Do I somehow auto-scroll to it?
I guess these are probably basic questions that some tutorial will have that I just haven't read yet. I'm just not sure what to look for.
Thanks for your help,
Tom -
How do i add buttons in the tool bar?
Hi,
I want to add buttons like "Load' in the tool bar.How do i do it? I am using LabView7.1
Please help me..
Regards
MeenatchiMeenatchi wrote:
I am creating one dialog,in that i want to add menu bar and title bar.
See the attached VI, whose Window Appearance category is set to Top-level, from the VI Properties window.
From this, you can go ahead customizing the menu bar to your wish.
- Partha
LabVIEW - Wires that catch bugs!
Attachments:
Top-level Application Window.vi 11 KB -
Add data to the table in the database with the use of add button
The name of my database is Socrates.
The name of the table in the database is Employees
I want to be able to add data to the database. i am presently working on the add button such that when i enter date into the textfield and press the add button it should automatically register in the table.
The error upon compilation is with this line of code
If (ae.getSource() == jbtnA)// it says that ";" is expected
Below is the entire code
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Mainpage extends JFrame implements ActionListener
JTextField jFirstName = new JTextField(15);
JTextField jSurname = new JTextField(12);
JTextField jCity = new JTextField(10);
JTextField jCountry = new JTextField(12);
JTextField jSSN = new JTextField(8);
JLabel jFirstLab = new JLabel("First Name");
JLabel jSurnameLab = new JLabel("Surname");
JLabel jCityLab = new JLabel("City");
JLabel jCountryLab = new JLabel("Country");
JLabel jSSNLab = new JLabel("Social Security Number (SSN)");
JButton jbtnA = new JButton ("Add");
JButton jbtnPrv = new JButton ("Previous");
JButton jbtnNt = new JButton ("Next");
JButton jbtnDl= new JButton ("Delete");
JButton jbtnSrch = new JButton ("Search");
public Mainpage (String title)
super (title);
Container cont = getContentPane();
JPanel pane1 = new JPanel();
JPanel pane2 = new JPanel();
JPanel pane3 = new JPanel();
pane1.setLayout (new GridLayout (0,1));
pane2.setLayout (new GridLayout(0,1));
pane3.setLayout (new FlowLayout());
pane1.add(jFirstLab);
pane1.add(jSurnameLab);
pane1.add(jCityLab);
pane1.add(jCountryLab);
pane1.add(jSSNLab);
pane2.add(jFirstName);
pane2.add(jSurname);
pane2.add(jCity);
pane2.add(jCountry);
pane2.add(jSSN);
pane3.add(jbtnA);
pane3.add(jbtnPrv);
pane3.add(jbtnNt);
pane3.add(jbtnDl);
pane3.add(jbtnSrch);
cont.add(pane1, BorderLayout.CENTER);
cont.add(pane2, BorderLayout.LINE_END);
cont.add(pane3, BorderLayout.SOUTH);
jFirstName.addActionListener(this);
jSurname.addActionListener(this);
jCity.addActionListener(this);
jCountry.addActionListener(this);
jSSN.addActionListener(this);
jbtnA.addActionListener(this);
jbtnPrv.addActionListener(this);
jbtnNt.addActionListener(this);
jbtnDl.addActionListener(this);
jbtnSrch.addActionListener(this);
validate();
setVisible(true);
setDefaultCloseOperation(EXIT_ON_CLOSE);
pack();
setResizable(false);
public void actionPerformed(ActionEvent ae)
If (ae.getSource() == jbtnA)
fst = jFirstName.getText();
srn = jSurname.getText();
cty = jCity.getText();
cnty = jCountry.getText();
int sn =
Interger.parseInt(jSSN.getText());
String ad = "Insert into Employees
(Firstname,Surname,City,Country,SSN)" +
"values('"fst"','"srn"','"cty"','"cnty"','"sn"')";
Statement stmt = con.createStatment();
int rowcount = stmt.executeUpdate(ad);
JOptionPane.showMessageDialog("Your
details have been registered");
Statement stmt = con.createStatment();
int rowcount = stmt.executeUpdate(ad);
public static void main (String args[])
Mainpage ObjFr = new Mainpage("Please fill this
registration form");
try
Class.forname("sun.jdbc.odbc.JdbcOdbcDriver");
String plato = "jdbc:odbc:socrates";
Connection con =
DriverManager.getConnection(plato);
catch(SQLException ce)
System.out.println(ce);
}i have restructured the code, but the following line of code is giving error:
String plato = jdbc:odbc:socrates;
the entire code is below:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
public class Mainpage extends JFrame implements ActionListener
JTextField jFirstName = new JTextField(15);
JTextField jSurname = new JTextField(12);
JTextField jCity = new JTextField(10);
JTextField jCountry = new JTextField(12);
JTextField jSSN = new JTextField(8);
JLabel jFirstLab = new JLabel("First Name");
JLabel jSurnameLab = new JLabel("Surname");
JLabel jCityLab = new JLabel("City");
JLabel jCountryLab = new JLabel("Country");
JLabel jSSNLab = new JLabel("Social Security Number (SSN)");
JButton jbtnA = new JButton ("Add");
JButton jbtnPrv = new JButton ("Previous");
JButton jbtnNt = new JButton ("Next");
JButton jbtnDl= new JButton ("Delete");
JButton jbtnSrch = new JButton ("Search");
Statement stmt;
String ad;
public Mainpage (String title)
super (title);
Container cont = getContentPane();
JPanel pane1 = new JPanel();
JPanel pane2 = new JPanel();
JPanel pane3 = new JPanel();
pane1.setLayout (new GridLayout (0,1));
pane2.setLayout (new GridLayout(0,1));
pane3.setLayout (new FlowLayout());
pane1.add(jFirstLab);
pane1.add(jSurnameLab);
pane1.add(jCityLab);
pane1.add(jCountryLab);
pane1.add(jSSNLab);
pane2.add(jFirstName);
pane2.add(jSurname);
pane2.add(jCity);
pane2.add(jCountry);
pane2.add(jSSN);
pane3.add(jbtnA);
pane3.add(jbtnPrv);
pane3.add(jbtnNt);
pane3.add(jbtnDl);
pane3.add(jbtnSrch);
cont.add(pane1, BorderLayout.CENTER);
cont.add(pane2, BorderLayout.LINE_END);
cont.add(pane3, BorderLayout.SOUTH);
jFirstName.addActionListener(this);
jSurname.addActionListener(this);
jCity.addActionListener(this);
jCountry.addActionListener(this);
jSSN.addActionListener(this);
jbtnA.addActionListener(this);
jbtnPrv.addActionListener(this);
jbtnNt.addActionListener(this);
jbtnDl.addActionListener(this);
jbtnSrch.addActionListener(this);
validate();
setVisible(true);
setDefaultCloseOperation(EXIT_ON_CLOSE);
pack();
setResizable(false);
try
Class.forname(sun.jdbc.odbc.JdbcOdbcDriver);
String plato = jdbc:odbc:socrates;
Connection con = DriverManager.getConnection(plato);
stmt = con.createStatment();
catch(SQLException ce)
System.out.println(ce);
catch(ClassNotFoundException ce)
System.out.println(ce);
public void actionPerformed(ActionEvent ae)
try
if(ae.getSource().equals(jbtnA))
fst = jFirstName.getText();
srn = jSurname.getText();
cty = jCity.getText();
cnty = jCountry.getText();
int sn = Interger.parseInt(jSSN.getText());
ad = "Insert into Employees
values('"+fst+"',"+srn+"','"+cty+"','"+cnty+"','"+sn+"')";
stmt.executeUpdate(ad);
JOptionPane.showMessageDialog(this, "Your details have been
registered");
catch(SQLException ce)
System.out.println(ce);
public static void main(String args[])
Mainpage ObjFr = new Mainpage("Please fill this registration form");
} -
Add button to the transaction SM30
HI
Whether it is possible to add a buton to application tool bar in the transaction SM30.
help reg this.Hi,
Yes, it is possible to add button for the transaction SM30.
This is possible through Menu exit.
Procedure for Menuexit:-
Go to SM30 ->System -> Status
Repository data -> Transaction -> Double click on it
Copy package name
Go to SMOD
Press F4 then a popup will open
Click on information system
Enter package name and press Enter
Then we will get Exit
Put cursor on that exit and press Enter
Go to change mode and save it.
Go to CMOD or alternatively we can use the path tools -> ABAP/4 Workbench -> Utilities -> Enhancements ->Project Management
Specify Project name in the enhancement text box
Click on Create icon on the application toolbar.
Enter description for the project and save it
Click on Enhancement Assignment button on the application toolbar
Give Exit and save it
Go to Components on the application toolbar
Double Click on MENUS001
Write function text which we want to add to menu item and save it with an request number
Double Click on Exit and write code there to display menu item in the screen
Activate the include program and finally activate the project.
Please reward points if helpful. -
Add button to unused space in JTableHeader
I have modified my JTable so that I can have multiple rows of column headers. I did this by extending BasicTableHeaderUI. In my particular instance, the first column of the table will never have more than one row in the header (unlike other implementations of multi-row headers I have seen, my column headers don't automatically fill upwards to take up all usable space in the header). So, I have "unused" space in the header above the first column.
I would like to put some buttons there that are relevant to the table, but so far every effort to do so has failed.
In the SSCCE below I have created a very stripped down version of my TableHeaderUI. It doesn't contain any of the code to create multiple row headers, it just pushes down the standard column headers to create some space. I try adding a button to the rendererPane, but it doesn't show up. There is a commented out line that paints the button which does work in terms of showing the button, but that's probably not the right way to do this (and the button doesn't work anyway).
So, why isn't the button showing up? Am I doing this the right way (i.e. adding the button within the UI)? Thanks in advance for you help.
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Enumeration;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.plaf.basic.BasicTableHeaderUI;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
public class HeaderButtonTable extends JPanel {
public HeaderButtonTable() {
String[] colNames = {"column 1", "column2", "column3"};
Object[][] data = {{"a","b","c"},{"d","e","f"}};
JTable table = new JTable(data, colNames);
table.setPreferredScrollableViewportSize(new Dimension(400,100));
table.setFillsViewportHeight(true);
table.getTableHeader().setUI(new ButtonHeaderUI());
JScrollPane scrollPane = new JScrollPane(table);
add(scrollPane);
public class ButtonHeaderUI extends BasicTableHeaderUI {
public void paint(Graphics g, JComponent c) {
Rectangle clip = g.getClipBounds();
Point left = clip.getLocation();
Point right = new Point( clip.x + clip.width - 1, clip.y );
TableColumnModel cm = header.getColumnModel();
int cMin = header.columnAtPoint(left);
int cMax = header.columnAtPoint(right);
if (cMin == -1) cMin = 0;
if (cMax == -1) cMax = cm.getColumnCount()-1;
TableColumn draggedColumn = header.getDraggedColumn();
int columnWidth;
Rectangle cellRect = header.getHeaderRect(cMin);
TableColumn aColumn;
for(int column = cMin; column <= cMax ; column++) {
aColumn = cm.getColumn(column);
columnWidth = aColumn.getWidth();
cellRect.width = columnWidth;
if (aColumn != draggedColumn) {
paintCell(g, cellRect, column);
cellRect.x += columnWidth;
JButton test = new JButton("test");
test.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
System.out.println("pressed");
test.setBounds(2, 2, 60, 15);
rendererPane.add(test); //why isn't this showing up?
//this line will display the button, but button doesn't work
// rendererPane.paintComponent(g, test, header, 2, 2, 60, 15);
private Component getHeaderRenderer(int columnIndex) {
TableColumn aColumn = header.getColumnModel().getColumn(columnIndex);
TableCellRenderer renderer = aColumn.getHeaderRenderer();
if (renderer == null) renderer = header.getDefaultRenderer();
return renderer.getTableCellRendererComponent(header.getTable(),
aColumn.getHeaderValue(), false, false, -1, columnIndex);
private void paintCell(Graphics g, Rectangle cellRect, int columnIndex) {
Component component = getHeaderRenderer(columnIndex);
rendererPane.paintComponent(g, component, header,
cellRect.x, cellRect.y + 30, cellRect.width,
cellRect.height - 30, true);
public Dimension getPreferredSize(JComponent c) {
long width = 0;
Enumeration enumeration = header.getColumnModel().getColumns();
while (enumeration.hasMoreElements()) {
TableColumn aColumn = (TableColumn)enumeration.nextElement();
width = width + aColumn.getPreferredWidth();
return new Dimension((int)width, 60);
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(new HeaderButtonTable());
frame.pack();
frame.setVisible(true);
}Yes, I've seen similar links/posts about how to activate buttons in the header of a table, but those do it by adding listeners to the renderer. My buttons would be directly in the CellRendererPane that is the container for the table header. I would have thought that by putting the button directly in the Cell RendererPane that it would have nothing to do with the rest of the table header. CellRendererPane extends Container. Is it not possible to put a JButton in a Container? JFrame extends indirectly from Container and you can add buttons to that.
Edited by: Bob.B on Oct 28, 2009 10:57 PM -
Trying to set color of frame caption bar
I've been trying to find out how to change the background color of a JFrame's caption bar. It looks to me like the following should do it:
UIManager.put( "activeCaption", new javax.swing.plaf.ColorUIResource( Color.black ) );
I call this code just after setting the look and feel to Windows, and before instantiating any JFrames.
The JFrame caption background is still the default system color. What am I missing?I've been trying to find out how to change the background color of a JFrame's caption bar. It looks to me like the following should do it:
UIManager.put( "activeCaption", new javax.swing.plaf.ColorUIResource( Color.black ) );
I call this code just after setting the look and feel to Windows, and before instantiating any JFrames.
The JFrame caption background is still the default system color. What am I missing? -
Set Rendered on a 'Add' button to False has caused HTTP 400 error
Hi,
I am trying to personalise in Manager SS a custom version of seeded 'Documents of Record' function HR_DOR_SS to make the Add Record button non-display on the Documents of Record table. I changed Rendered to False, got the 'Setting this item to false may hide this item and its children' message but went ahead and did it anyway.
Outcome is that I can see the records in the table but can no longer view, update or delete existing records. I get a http 400 bad request page. I changed the 'Add' button back to Rendered True, but problem persists. Get the error also when I try to create a new record using the now re-instated button. Imported the personalization from another environment where it's working fine, bounced apache, clear cache etc and still problem persists.
Also if no record exists for employee, Add button works fine and I can create a record but from that point on cannot do anything with it.
Any help v much appreciated.
ThxYes, I've seen similar links/posts about how to activate buttons in the header of a table, but those do it by adding listeners to the renderer. My buttons would be directly in the CellRendererPane that is the container for the table header. I would have thought that by putting the button directly in the Cell RendererPane that it would have nothing to do with the rest of the table header. CellRendererPane extends Container. Is it not possible to put a JButton in a Container? JFrame extends indirectly from Container and you can add buttons to that.
Edited by: Bob.B on Oct 28, 2009 10:57 PM -
Creating buttons on title bar using alv
hi all good morning,
can any one help me in making a button on title bar of ALV report. Till now i have used only one function of ALV i,e REUSE_ALV_GRID_DISPLAY. it is showing proper out put but i want to make some action using my own button on the final ALV result displayed like save change etc.Hi,
How to add button to ALV toolbar using REUSE_ALV_LIST_DISPLAY?
In the program which calls ALV using REUSE_ALV_LIST_DISPLAY,
I have to add a new button.
I saw the demo program BCALV_GRID_08, which is written using ABAP-Controls.
In that example, the button is added using TOOLBAR event of cl_gui_alv_grid.
Could you help me to implement the same logic using REUSE_ALV_LIST_DISPLAY parameters.
you should copy the 'STANDARD' GUI status from program SAPLKKBL using transaction SE90 >Programming SubObjects> Gui Status.
Execute this transaction to get to next screen. select status using checkbox. click on GUI Status --> Copy.
Enter your Z program name and the name you what for this status - you can keep it as 'STANDARD' to be simple.
Then you can edit the new status to add or delete buttons. This will also bring in the standard SAP ALV functionality such as sorting/subtotaling etc...
When you call 'REUSE_ALV_GRID_DISPLAY' make sure you pass it the new status name.
an example of one of mine:
call function 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = 'ZSDBOLST_REPORT'
i_callback_pf_status_set = 'STANDARD' <----
i_callback_user_command = 'USER_COMMAND'
i_structure_name = 'I_BOLACT'
i_grid_title = 'BOL Action Report'(031)
is_layout = gs_layout
it_fieldcat = gt_fieldcat[]
i_save = 'A'
is_variant = v_variant
TABLES
t_outtab = i_bolact
EXCEPTIONS
program_error = 1
others = 2.
I just tried the same procedure ,but my entire application toolbar disappeared and a lock icon appears next to the application toolbar in my copied pf-status.
Could you advice what might have gone wrong ?
As identified with the FM's help you can do the following.
1). Using SE80 (I think) you can copy a GUI status from one program to another. It mentions which one in the FM's help.
2). Create a form named like so:
Code:
Form Set_pf_status
Notes: Called by FM REUSE_ALV_GRID_DISPLAY
FORM set_pf_status USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'ZSTANDARD'.
ENDFORM. "Set_pf_status
In the above case the GUI status copied was named ZSTANDARD and adjusted accordingly, adding and removing the desired buttons. A button was added called '%DELETE'.
3). Create the following report:
Code:
Form User_command
Notes: Called by FM REUSE_ALV_GRID_DISPLAY
Detects whether the icon/button for
'Return Tag Deletion' has been pressed. If it has then
detect whether any rows have been highlighted and then
set the delete flag.
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
DATA: li_count TYPE I.
IF r_ucomm EQ '%DELETE'.
LOOP AT %g00 WHERE mark EQ 'X'.
ADD 1 TO li_count.
ENDLOOP.
IF li_count GT 0.
gc_delete_flag = 'X'.
r_ucomm = '&F03'. "Back arraow
ELSE.
MESSAGE W000 WITH 'Please highlight the rows to be deleted!'.
ENDIF.
ENDIF.
ENDFORM. "User_command
As I've added an extra button to indicate which records should be deleted I need to identify a form to be called to process when this button is chosen.
Then when you call the ALV function you to specify the following extra details:
Code:
call function 'REUSE_ALV_GRID_DISPLAY'
exporting i_callback_program = gc_repid
I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
i_grid_title = lc_grid_title
is_layout = lc_layout
it_fieldcat = gt_fieldcat
it_sort = sort
i_save = l_save
is_reprep_id = l_bbs_id
is_variant = l_variant
tables t_outtab = %g00
exceptions program_error = 1
others = 2.
The parameters in capitals are the extra ones that need to be added.
Regards,
Satish -
Recently started getting a lot of popup coupons - on the coupon it says that you can stop this by clicking on coupon button on menu bar but I do not see a coupon button on any of the menu bars. How do I delete this problem?
ThanksYour Firefox and plug-ins are outdated and introducing security risks to you which can be a reason for unwanted popups. Outdated software can allow malicious people on the internet to take control of your machine without you knowing. Download a new version of Firefox. Uninstall the old version, then install the new version.
After updating Firefox, to update your plug-ins, go to:
https://www.mozilla.org/en-US/plugincheck/
and find the ones to be updated, then update them.
Safe browsing requires vigilance, and this includes making sure you have programs installed on your computer to protect you online, and that they are regularly updated.
Steps to take:
<br /><br />
*Updating everything can be time-consuming, and if you're not sure what to do, use a program like Secunia's [https://secunia.com/vulnerability_scanning/personal/ Personal Software Inspector (PSI)] to help automate the process of updating all software on your computer.
*Make sure Windows Update is turned on and set to automatic.
*Always run antivirus software -- there are many free programs from vendors like Avast, AVG, TrendMicro, etc.
*Make sure your Windows firewall is on (if you are not using a replacement firewall, if so, keep that one up to date).
*Make sure your browsers are the latest versions.
Once you get everything up-to-date, then install a couple of helpful add-ons to your new Firefox installation:
<br /><br />
*[https://addons.mozilla.org/en-US/firefox/addon/adblock-plus/ Adblock Plus] will help block unwanted advertisements.
*[https://addons.mozilla.org/en-US/firefox/addon/noscript/ NoScript] will only turn on scripting (automated web-page actions) for websites that you trust.
After you've updated everything and have your new add-ons installed, you'll be safer on the web and should not be bombarded by adverts. -
Start Developing iOS Apps Today tutorial Edit button instead of Add button
In the Start Developing iOS Apps Today tutorial, I followed the instructions but after adding data (the final part), instead of seeing the + symbol, which should take me to the add item view, I saw the word edit, which took me to a screen where I could delete items.
The instructions say:
The actual code for viewDidLoad includes some additional lines—inserted by Xcode when it created XYZListViewController—that are commented out. Feel free to leave them in.
Referring to the following code in XYZToDoListTableViewController:
// Uncomment the following line to preserve selection between presentations.
self.clearsSelectionOnViewWillAppear = NO;
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
self.navigationItem.rightBarButtonItem = self.editButtonItem;
As it turns out, the bottom line overrides the add button with an edit button. The good news is that by changing rightBarButtonItem to leftBarButtonItem, the add symbol reappears, and the Edit button is moved to the other side.make sure u wrote the method in XYZToDoListViewController.m rather than XYZAddToDoItemViewController.m
-
Adding a button to standard bar
hi all,
iwant to add buttons to the tool bar can anybody plz help me out.
THANKS
ANUPAMA
Edited by: deep kammula on Apr 14, 2008 3:43 PMIn that case you better make use of the ALV grids, see the example below...
Example report(type - ALV(ABAP list viewer))
REPORT Z_ALV_SIMPLE_EXAMPLE_WITH_ITAB .
*Simple example to use ALV and to define the ALV data in an internal
*table
*data definition
tables:
marav. "Table MARA and table MAKT
Data to be displayed in ALV
Using the following syntax, REUSE_ALV_FIELDCATALOG_MERGE can auto-
matically determine the fieldstructure from this source program
Data:
begin of imat occurs 100,
matnr like marav-matnr, "Material number
maktx like marav-maktx, "Material short text
matkl like marav-matkl, "Material group (so you can test to make
" intermediate sums)
ntgew like marav-ntgew, "Net weight, numeric field (so you can test to
"make sums)
gewei like marav-gewei, "weight unit (just to be complete)
end of imat.
Other data needed
field to store report name
data i_repid like sy-repid.
field to check table length
data i_lines like sy-tabix.
Data for ALV display
TYPE-POOLS: SLIS.
data int_fcat type SLIS_T_FIELDCAT_ALV.
select-options:
s_matnr for marav-matnr matchcode object MAT1.
start-of-selection.
read data into table imat
select * from marav
into corresponding fields of table imat
where
matnr in s_matnr.
Check if material was found
clear i_lines.
describe table imat lines i_lines.
if i_lines lt 1.
Using hardcoded write here for easy upload
write: /
'No materials found.'.
exit.
endif.
end-of-selection.
To use ALV, we need a DDIC-structure or a thing called Fieldcatalogue.
The fieldcatalouge can be generated by FUNCTION
'REUSE_ALV_FIELDCATALOG_MERGE' from an internal table from any
report source, including this report.
Store report name
i_repid = sy-repid.
Create Fieldcatalogue from internal table
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = i_repid
I_INTERNAL_TABNAME = 'IMAT' "capital letters!
I_INCLNAME = i_repid
CHANGING
CT_FIELDCAT = int_fcat
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
*explanations:
I_PROGRAM_NAME is the program which calls this function
I_INTERNAL_TABNAME is the name of the internal table which you want
to display in ALV
I_INCLNAME is the ABAP-source where the internal table is defined
(DATA....)
CT_FIELDCAT contains the Fieldcatalouge that we need later for
ALV display
IF SY-SUBRC <> 0.
write: /
'Returncode',
sy-subrc,
'from FUNCTION REUSE_ALV_FIELDCATALOG_MERGE'.
ENDIF.
*This was the fieldcatlogue
Call for ALV list display
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = i_repid
IT_FIELDCAT = int_fcat
TABLES
T_OUTTAB = imat
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
*explanations:
I_CALLBACK_PROGRAM is the program which calls this function
IT_FIELDCAT (just made by REUSE_ALV_FIELDCATALOG_MERGE) contains
now the data definition needed for display
I_SAVE allows the user to save his own layouts
T_OUTTAB contains the data to be displayed in ALV
IF SY-SUBRC <> 0.
write: /
'Returncode',
sy-subrc,
'from FUNCTION REUSE_ALV_LIST_DISPLAY'.
ENDIF. -
How to add a standard tool bar in alv
H i
i am developing a custom report in Alv interactive report for to dispaly MRP information.
Can you sejjest me how to add a standard tool bar in alv.
i displayed one final alv grid display there i have to add standard tool bar and application tool bar.
Thanks,
Rams
Edited by: Ramsoft on Oct 27, 2010 12:09 PMHi,
Give the PF ststus name in the PF status parameter of ALV FM
I_CALLBACK_PF_STATUS_SET = ' PF_STATUS'. " this parameter of ALV FM
FORM pf_status USING pt_extab TYPE slis_t_extab.
SET PF-STATUS 'MAIN' .
ENDFORM. "pf_status
Then create a main PF status by double clicking on it , after this goto EXTRA in menu
EXTRA>ADJUST TEMPLATE> then give program - SAPLSLVC and status - STANDARD this will give u standard toolbar of ALV ,
THen add what ever button you require in application toolbar
Regards,
Madhukar Shetty -
Add button like "Actions" button in IR
Hi,
is it possible to add a button like the "Actions" button in IR Search Bar? I mean is there a built-in one or do I have to use a list with "Pull Down Menu" List template and configure it?
If I have to use a list, how can this be displayed besides the IR Search bar???
Thanks for any hints and tipps
chrissyHi,
There is no out of box solution do that and you can not place list there as I understand.
You need do it somehow e.g. with javascript. See example from here
Re: Add button to IR toolbar
Regards,
Jari
Maybe you are looking for
-
JMS issues when migration from weblogic 9.2 to 10.3.5
We are facing some issues when migration from weblogic 9.2 to 10.3.5 In weblogic 9.2 :_ BMP Entity EJBs used in our project are read-only in nature using entity cache, below is the configuration details <!DOCTYPE weblogic-ejb-jar PUBLIC "-//BEA Syst
-
Do I have to uninstall my trial apps for CC (expired) so that my daughter's subscription can begin? We both use the same computer, and nothing happens when she tries to download PS.
-
I am unable to connect to the itunes store to update apps on my ipad. I have tried both wifi and cellular connections. I have the most recent updates of the operating system and itunes. I have powered down and reset and restored. I have no problem pu
-
Hello, I have downloaded a par file related to Personal Data(com.sap.pct.hcm.eeprofilepersonaldata.par) and chnaged the name to com.mycompany.pct.hcm.eeprofilepersonaldata.par imported to Developer Studio and commented some code. I created a par file
-
Access Panel Latch Broken - How to Open Case?
The side panel latch on my MacPro no longer functions. It seems as if it is stuck, or a part of the linkage is bent or loose. Does anyone know of a workaround or trick to get the side panel open so I can see what is wrong with the linkage, and more i