About JComboBox's event

below is resource
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class ComboBoxTest extends JFrame{
    private JLabel sqlLabel = new JLabel("SQL:");
    private JComboBox sqlComboBox = new JComboBox();
    public ComboBoxTest() {
        sqlComboBox.setEditable(true);
        sqlComboBox.addItem("");
        sqlComboBox.setBackground(Color.WHITE);
        sqlComboBox.setPreferredSize(new Dimension(500,25));
        sqlComboBox.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent event) {
                if (event.getStateChange() == ItemEvent.SELECTED){
                    if(sqlComboBox.getSelectedIndex()==-1){
                        String currentSQL=(String)event.getItem();
                        System.out.println("currentSQL : "+currentSQL);
                        sqlComboBox.addItem(currentSQL);
        Container cp=getContentPane();
        cp.setLayout(new FlowLayout());
        cp.add(sqlLabel);
        cp.add(sqlComboBox);
        pack();
        setVisible(true);
        addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent evt) {
                System.exit(0);
    public static void main(String[] args){
        new ComboBoxTest();
}my intent is that let user write sql in JComboBox,this program will send sql when user click enter,and JComboBox will use addItem() to add the sql to JComboBox,
problem is below:
when I clicked enter one more time,why just can arosed only itemStateChanged event,I hope this program would arose itemStateChanged event when user clicked enter everytime
another:
when user choosed the sql that has been used addItem() to add JComboBox;
why then clicked enter would not arose any itemStateChanged event

1) I've answered several of your previous postings. Not once have you bothered to follow up the posting to confirm the suggestion worked, or didn't work. A simple Thank You goes a long way.
2) Several times I've also suggested that Swing related questions should be posted on the Swing forum. (This is where the Swing experts hang out).
3) I don't understand your question, so I can't help anyway.

Similar Messages

  • I accidentally moved all my iPhoto events onto one.  I have a recent backup.  How do I go about recovering my events?

    I accidentally moved all my iPhoto events onto one.  I have a recent backup.  How do I go about recovering my events?

    You could try Events -> Autosplit Selected Event
    And you always need a back up. Always.

  • How to fire JComboBox itemStateChanged event manually?

    hello:
    I want to know how to fire JComboBox itemStateChanged event manually.
    thank you
    -Daniel

    Call setSelectedIndex or setSelectedItem.

  • JDK1.6 JComboBox: No event sent on same selection

    Hi,
    In JDK1.5, with a combobox, when selecting from the dropdown list the item already selected, it sends an ActionEvent, but no ItemEvent.
    In JDK1.6.0_01, no event ActionEvent is sent!
    When the combobox is taken as a table cell editor, selecting the same item does not make automatically the cell quit the edition mode!, as the change is based on the ActionEvent listening!
    We have to click somewhere else to make the edition stop!
    Can someone explain this event strategy change between 1.5 and 1.6?
    And how to make the combobox disappear from the table cell?
    Just below a simple piece of code to check the combobox event sending.
    Herve.
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JComboBox;
    import javax.swing.JFrame;
    public class ComboActionEvent extends JFrame {
         private void run() {
              JComboBox cb = new JComboBox(new String[]{"a", "b", "c", "d"});
              cb.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e) {
                        System.out.println ("Action event!");
              getContentPane().add (cb);
              pack();
              setVisible(true);
         public static void main (String[] arg) {
              new ComboActionEvent().run();
    }

    Hmmm
    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6481977
    and there are various threads in the forums about this, for example:
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=5116064

  • JComboBox Action Event problems

    I have a complex UI with which I am having action event issues. Basically, the panel displays info about an object, which can be selected from within the panel through a button/popup window mechanism. A JComboBox (#1) selection determines the contents of another JComboBox (#2) on the same panel. Currently an ActionEvent fires when the user makes a selection using #1 that updates #2. This fuctions correctly with repeated testing so long as a new object is not selected.
    When a new object is selected from within this panel this ActionEvent no longer fires. JComboBox #1 will be updated correctly and #2 will reflect the initial selection in #1, but user selections in #1 will not fire the ActionEvent and thus #2 is never updated.
    Any help is appreciated. I feel like I'm missing something basic here, but I've stared at it for long enough...

    By the way, the workaround is to use the ItemListener as the ItemStateChanged Event is fired reliably.

  • JComboBox.removeAllItems event in 1.4.2

    I've just installed 1.4.2 and noticed that JComboBox.removeAllItems now fires an ActionEvent which it didn't do in 1.4.1. This was a little inconvenient for me as I was using this event to update another field when a new selection was made in the combo. The event on removeAllItems resulted in a new NullPointerException in my code. It was easily worked around but a little tricky to spot seeing as I wasn't expecting this behaviour.
    Was this a mistake in previous versions to not fire this action or a mistake to add it to the new release? I though changes like this would be left to major releases only? Am I now going to have to check all my code for bugs like this before moving to 1.4.2?
    cheers,
    Andy

    There are quite a few references to what happens with setSelectedItem (which causes an event) when removeAllItems is called in bug parade.
    I've found combo boxes to be problematic too, but they got better with each release. After all, we all have a set of regression tests to be applied when upgrading, don't we?

  • Clarification about OCI_FO_REAUTH failover event of TAF

    Hello everyone,
    Can someone explain my the real meaining of the OCI_FO_REAUTH failover event when we are using TAF?
    All I found is : "OCI_FO_REAUTH indicates that you have multiple authentication handles and failover has occurred after the original authentication. It indicates that a user handle has been re-authenticated. To find out which, the application checks the OCI_ATTR_SESSION attribute of the service context handle (which is the first parameter)."
    But it is not clear for me.
    Regards.
    Carl

    The session receiving this error did not automatically failover, or this automatic failover failed.
    This does not mean however that a new connection would not be possible
    Since you did not mention anything about the system, I can't tell you where to look for the reason.
    If it's a RAC consider looking at the CRS logs.
    This link explains more about the OCI_FO_ABORT : http://www.cs.umbc.edu/portal/help/oracle8/server.815/a67846/new_adva.htm
    Success!
    FJFranken

  • Need help about Jcombobox

    Dear all:
    i have a Jcombobox and a Jtable on my display, the user will be about to change the content of the table by selecting different things from the JCombox......
    how do i do it? i tried so hard, but the content of the table won't change
    thanks in advance

    table.setModel(...);

  • Question about the Contextual Event from task flow to portlet

    Hello, experts,
    I am studying the webcenter portlet and 11g Task flow. in fact i have tested on the Jdev TP4 about the portlet communication.
    As we know, in 11g ADF task flow, can communicate via contextual events. My issue is if I use the bridge to convert task flows to portlets, How can I still make the contextual event communication works in portlets.. If not what is the best way to keep these converted portlets communicated? (I test it on TP4 but failed.)
    Or I can not do this by task flow way, i need to rebuild my portlet in webcenter and use the portlet parameters in web center to let portlets communicate? Is there way can transfer the inter-taskflow communication to the portlets communication after they are converted to portles via bridge? Can new version 11g webcenter support this?
    Seems very hard, I appreciate your web center development experts can enlight on this.
    Thanks
    Wayne

    Up.. Any expert can answer?

  • A clarification about block# wait event parameter ....

    Hi ,
    In Oracle Database Reference of 10g (Part Number B14237-02) about the block# wait event parameter is pointed out ... :
    This is the block number of the block for which Oracle needs to wait. The block number is relative to the start of the file. To find the object to which this block belongs, enter the following SQL statements:
    select name, kind
    from ext_to_obj_view
    where file# = file#
         and lowb <= block#
         and highb >= block#;Can you give me a simple example of using the above sql statement.... as ext_to_obj_view object does not exist.....
    Many thanks ,
    Simon

    This view is created by $ORACLE_HOME/rdbms/admin/catclust.sql script (to be run by sys user).
    http://download-uk.oracle.com/docs/cd/B19306_01/rac.102/b14197/monitor.htm#RACAD718
    Nicolas.

  • Distiinguish JComboBox editing event from selection event

    In an editable JComboBox I need the event that the selection via popup has changed and not due to finish the editing of an entry.
    For test I added listener for ItemStateChanged and ActionEvent. The sequence is
    a) for selection change (from 'bbb' to 'aaa')
    itemStateChanged: java.awt.event.ItemEvent[ITEM_STATE_CHANGED,item=bbb,stateChange=DESELECTED] on coFilter
    itemStateChanged: java.awt.event.ItemEvent[ITEM_STATE_CHANGED,item=aaa,stateChange=SELECTED] on coFilter
    actionPerformed : java.awt.event.ActionEvent[ACTION_PERFORMED,cmd=comboBoxChanged,when=1129716754377,modifiers=Button1] on coFilter
    b) after editing the current entry has been finished (from 'aaa' to 'aaa123')
    itemStateChanged: java.awt.event.ItemEvent[ITEM_STATE_CHANGED,item=aaa,stateChange=DESELECTED] on coFilter
    itemStateChanged: java.awt.event.ItemEvent[ITEM_STATE_CHANGED,item=aaa123,stateChange=SELECTED] on coFilter
    actionPerformed : java.awt.event.ActionEvent[ACTION_PERFORMED,cmd=comboBoxChanged,when=1129716711382,modifiers=] on coFilter
    actionPerformed : java.awt.event.ActionEvent[ACTION_PERFORMED,cmd=comboBoxEdited,when=1129716711382,modifiers=] on coFilter
    Is there a simple way to catch the first situation only and not reacting for the second sequence?
    Thanks in advance
    Wolfgang R.

    In an editable JComboBox I need the event that the selection via popup has changed and not due to finish the editing of an entry.
    For test I added listener for ItemStateChanged and ActionEvent. The sequence is
    a) for selection change (from 'bbb' to 'aaa')
    itemStateChanged: java.awt.event.ItemEvent[ITEM_STATE_CHANGED,item=bbb,stateChange=DESELECTED] on coFilter
    itemStateChanged: java.awt.event.ItemEvent[ITEM_STATE_CHANGED,item=aaa,stateChange=SELECTED] on coFilter
    actionPerformed : java.awt.event.ActionEvent[ACTION_PERFORMED,cmd=comboBoxChanged,when=1129716754377,modifiers=Button1] on coFilter
    b) after editing the current entry has been finished (from 'aaa' to 'aaa123')
    itemStateChanged: java.awt.event.ItemEvent[ITEM_STATE_CHANGED,item=aaa,stateChange=DESELECTED] on coFilter
    itemStateChanged: java.awt.event.ItemEvent[ITEM_STATE_CHANGED,item=aaa123,stateChange=SELECTED] on coFilter
    actionPerformed : java.awt.event.ActionEvent[ACTION_PERFORMED,cmd=comboBoxChanged,when=1129716711382,modifiers=] on coFilter
    actionPerformed : java.awt.event.ActionEvent[ACTION_PERFORMED,cmd=comboBoxEdited,when=1129716711382,modifiers=] on coFilter
    Is there a simple way to catch the first situation only and not reacting for the second sequence?
    Thanks in advance
    Wolfgang R.

  • JComboBox arrow event...?

    Hello everyone:
    I use JComboBox for list data from database, but some times these data are changed form another window(Panel) so I need to refresh this comboBox and fill it with the new data.
    I did that but the problem is the event....!! I used the actionListener but this works just when I choose the item from the comboBox....!!
    I need an event called when I click on the arrow of comboBox not when I choose item from the comboBox.....?
    or if there is any event that I can add it to panel so when I switch to the panel that contain the comboBox I call the method that refresh the comboBox data on the event.....!!?
    Please help me

    A simple example...
    import java.awt.BorderLayout;
    import java.awt.CardLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.*;
    public class ComboFill {
      private static final String COMBO_PANEL = "Combo Panel";
      private static final String TEXT_AREA_PANEL = "Text Area Panel";
      private JPanel mainPanel = new JPanel();
      private ComboPanel comboPanel = new ComboPanel();
      private TextAreaPanel textAreaPanel = new TextAreaPanel();
      private CardLayout cardlayout = new CardLayout();
      private JPanel cardLayoutHolderPanel = new JPanel(cardlayout);
      public ComboFill() {
        JButton swapButton = new JButton("Swap Panels");
        swapButton.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            swapBtnActionPerformed();
        JPanel btnPanel = new JPanel();
        btnPanel.add(swapButton);
        cardLayoutHolderPanel.add(textAreaPanel.getPanel(), TEXT_AREA_PANEL);
        cardLayoutHolderPanel.add(comboPanel.getPanel(), COMBO_PANEL);
        mainPanel.setLayout(new BorderLayout());
        mainPanel.add(cardLayoutHolderPanel, BorderLayout.CENTER);
        mainPanel.add(btnPanel, BorderLayout.SOUTH);
      private void swapBtnActionPerformed() {
        String text = textAreaPanel.getText();
        String[] items = text.split("\n");
        comboPanel.updateComboModel(items);
        cardlayout.next(cardLayoutHolderPanel);   
      public JComponent getComponent() {
        return mainPanel;
      private static void createAndShowUI() {
        JFrame frame = new JFrame("Combo Fill");
        frame.getContentPane().add(new ComboFill().getComponent());
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.pack();
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
      public static void main(String[] args) {
        java.awt.EventQueue.invokeLater(new Runnable() {
          public void run() {
            createAndShowUI();
    class ComboPanel {
      private JPanel panel = new JPanel();
      private DefaultComboBoxModel model = new DefaultComboBoxModel();
      private JComboBox combo = new JComboBox(model);
      public ComboPanel() {
        panel.add(combo);
      public JPanel getPanel() {
        return panel;
      public void updateComboModel(String[] items) {
        model.removeAllElements();
        for (String item : items) {
          model.addElement(item);
    class TextAreaPanel {
      private static final String[] ITEMS = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday"};
      private JPanel panel = new JPanel(new BorderLayout());
      private JTextArea textArea = new JTextArea(20, 40);
      public TextAreaPanel() {
        for (String item : ITEMS) {
          textArea.append(item + "\n");
        panel.add(new JScrollPane(textArea), BorderLayout.CENTER);
      public JPanel getPanel() {
        return panel;
      public String getText() {
        return textArea.getText();
    }

  • About Business transaction events

    Hi,
              i need to know the about BTE please send the related documents about this please.
    regards,
    naveen

    Hi
    Business Transaction Events
        It is also called as Open FI enhancement technique which is based on the following principle:
    Application developers must define their interface in a function module. An assignment table is read in the corresponding (generated) code, and the customer modules assigned are called dynamically.
    This technique differentiates between enhancements that are only allowed to have one implementation and enhancements that can call multiple implementations in any sequence desired. Both industry-specific and country-specific enhancements may be defined.

  • Some info about simulating different events in java or jsp...

    I work as a developer and I and some collegues of mine have been thrown in to a web portal project based on Struts/Spring framework.
    Since a long gone external consult made most of the initilal work in the project and we are kind of newbis to web-development many questions have been arised so I hope my questions isn't to strange.
    We are using something called Struts Bridge which uses a RenderAction when rendering the jsp and a ProcessAction for all submits from the jsp...
    Due to the fact that the whole Portal with all menues are configured in a xml-file also means that the startpage is some kind of hardcoded and thats what we want to change. By having a Welcome page without any buttons we want to depending on type of order automatically redirekt to the right jsp-page.
    To do this we tried to, in the execute-method, directly forward to the right jsp-page in the RenderAction but this doesn't work...
    Then we tried to simulate a menuitem-click in the ProcessAction(which work if an submit is done) but since we dont know how to simulate an submit in the Welcome jsp-page the ProcessAction is never called... so we are totally stucked...
    Can anyone explain what kind of events is possible use in the jsp and java files ?
    Maby I'm totally out of scope here but please enlighten me...

    I understand that its difficult to answer this kind of question whithout any code, was more looking for a general suggestion about how others have solved this kind of problem...
    Anyway... if I put a button on the jsp page and click it manually everything works fine but we need to know how to simulate the buttonclick "by code".
    It seem like all events in this kind of web development must be trigged by actually doing a submit on a jsp-page but there must be more ways to "by code" generate an event or am I wrong?

  • About double click event in ALV report

    Hi all,
    I want to program a double-click event in ALV reprot.
    I am not suppose to use module pool approach for the same.
    If a user double clicks on the any of the row of ALV report, the transaction should get called.
    Again, I am using function 'REUSE_ALV_GRID_DISPLAY' for displaying ALV.
    Can you please help me to solve this?
    Thanks,
    -Siddhi

    Hi Sidhi,
    You can do it easily by using Reuse_ALV_GRID_DISPALY.
    The User Command subroutine which you pass to this function module in that you can check which field is selected and what is the value of that and also you can get the table index.
    I am giving you a code example where interactivity of ALV report is done .
    *& Report  ZRAIL_LOT_REPORT
    REPORT  zrail_lot_report.
    TABLES :qals,aufk.
    TYPE-POOLS:slis.
    TYPES:BEGIN OF x_lot,
          sel(1)   TYPE c,                    "SELECTION
          prueflos TYPE qals-prueflos,        "INSPECTION LOT NUMBER
          werk     TYPE qals-werk,            "PLANT
          losmenge TYPE qals-losmenge,        "LOT QUANTITY
          mengeneinh TYPE qals-mengeneinh,   "BASE UNIT OF MEASURE FOR THE INSPECTION LOT QUANTITY
          matnr   TYPE  qals-matnr,          " MATERIAL NO. ATTACHED TO ORDER
          zzequnr  TYPE qals-zzequnr,         "EQUIPMENT NO.
          zzassembly TYPE qals-zzassembly,    "ASSEMBLY
          herkunft  TYPE qals-herkunft,       "INSPECTION LOT ORIGIN
          aufnr     TYPE qals-aufnr,          "ORDER NO.
          sttxt     TYPE qals_d02-sttxt,      "LOT STATUS
          objnr     TYPE qals-objnr,          "OBJECT NUMBER
          enstehdat TYPE qals-enstehdat,      "lot creation date
          pruefer   TYPE qamr-pruefer,        "Name of the Inspector
          END OF x_lot.
    TYPES:BEGIN OF x_ordmat,
          aufnr TYPE aufk-aufnr,             "Order No.
          equnr TYPE afih-equnr,             "Equipment No. attached to Order
          zmatnr TYPE aufk-zmatnr,           "Material No. attached to Order
          bautl  TYPE afih-bautl,            "Assembly attached to Order
          END OF x_ordmat.
    TYPES:BEGIN OF x_status,
          objnr TYPE jest-objnr,
          stat  TYPE jest-stat,
          txt04 TYPE tj02t-txt04,
          END OF x_status.
    DATA:it_qals TYPE STANDARD TABLE OF x_lot,
         wa_qals TYPE x_lot.
    DATA:it_ordmat TYPE TABLE OF x_ordmat,
         wa_ordmat TYPE x_ordmat.
    DATA:it_status TYPE STANDARD TABLE OF x_status,
         wa_status TYPE x_status.
    DATA:mytabix TYPE sy-tabix.
    DATA: wa_layout   TYPE slis_layout_alv,
          wa_fieldcat TYPE slis_fieldcat_alv,
          it_fieldcat TYPE TABLE OF slis_fieldcat_alv,
          it_fcat TYPE TABLE OF slis_fieldcat_alv.
    DATA:mytabix1 TYPE sy-tabix.
    SELECTION-SCREEN BEGIN OF BLOCK  b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_werks FOR qals-werk,
                    s_zmatnr FOR aufk-zmatnr,
                    s_assbly FOR qals-zzassembly,
                    s_equnr FOR qals-zzequnr,
                    s_lotor FOR qals-herkunft,
                    s_lotdat FOR qals-enstehdat.
    SELECTION-SCREEN END OF BLOCK b1.
    INITIALIZATION.
      s_lotdat-low = sy-datum - 7.
      s_lotdat-high = sy-datum.
      APPEND s_lotdat.
    START-OF-SELECTION.
      PERFORM get_data_qals.
      PERFORM build_fieldcat.
      PERFORM display_data.
      EXIT.
    END-OF-SELECTION.
    *&      Form  get_data_qals
          text
    -->  p1        text
    <--  p2        text
    FORM get_data_qals .
      IF it_qals[] IS INITIAL.
        SELECT a~prueflos
               a~werk
               a~losmenge
               a~mengeneinh
               a~zzequnr
               a~zzassembly
               a~herkunft
               a~aufnr
               a~objnr
               a~matnr
               a~enstehdat
               b~pruefer
               FROM qals AS a INNER JOIN qamr AS b
               ON aprueflos = bprueflos
               INTO CORRESPONDING FIELDS OF TABLE it_qals
               WHERE werk IN s_werks
               AND   zzassembly IN s_assbly
               AND   zzequnr    IN s_equnr
               AND   herkunft   IN s_lotor
               AND   enstehdat  IN s_lotdat.
      ENDIF.
      IF it_ordmat[] IS INITIAL.
        SELECT a~aufnr
               a~zmatnr
               b~bautl
               b~equnr
               FROM aufk AS a INNER JOIN afih AS b
               ON aaufnr = baufnr
               INTO CORRESPONDING FIELDS OF TABLE it_ordmat FOR ALL ENTRIES IN it_qals
               WHERE a~aufnr = it_qals-aufnr
                AND zmatnr IN s_zmatnr.
      ENDIF.
      IF it_status[] IS INITIAL.
        SELECT a~objnr
               a~stat
               b~txt04
               FROM  tj02t AS b
               INNER JOIN jest AS a ON bistat = astat
               INTO CORRESPONDING FIELDS OF TABLE it_status FOR ALL ENTRIES IN it_qals
               WHERE a~objnr = it_qals-objnr
               AND   b~spras = sy-langu
               AND   a~inact = space.
      ENDIF.
      LOOP AT it_qals INTO wa_qals.
        mytabix = sy-tabix.
        READ TABLE it_ordmat INTO wa_ordmat WITH KEY aufnr = wa_qals-aufnr.
        IF sy-subrc = 0.
          IF wa_qals-herkunft = '14'.
            wa_qals-matnr = wa_ordmat-zmatnr.
            wa_qals-zzequnr =  wa_ordmat-equnr.
            wa_qals-zzassembly = wa_ordmat-bautl.
            MODIFY it_qals FROM wa_qals INDEX  mytabix TRANSPORTING matnr zzassembly zzequnr.
          ENDIF.
        ENDIF.
        LOOP AT it_status INTO wa_status WHERE objnr = wa_qals-objnr.
          CONCATENATE wa_qals-sttxt wa_status-txt04 INTO wa_qals-sttxt SEPARATED BY space.
          CLEAR :wa_status.
        ENDLOOP.
        MODIFY it_qals FROM wa_qals INDEX  mytabix TRANSPORTING sttxt.
        CLEAR :wa_qals,wa_ordmat,mytabix.
      ENDLOOP.
      IF s_zmatnr[] IS NOT INITIAL.
        DELETE it_qals WHERE matnr IS INITIAL.
      ENDIF.
    ENDFORM.                    " get_data_qals
    *&      Form  build_fieldcat
          text
    -->  p1        text
    <--  p2        text
    FORM build_fieldcat .
      wa_layout-zebra = 'X'.
      wa_layout-colwidth_optimize = 'X'.
      wa_layout-box_fieldname = 'SEL'.
      wa_layout-box_tabname = 'IT_QALS'.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
       EXPORTING
        I_PROGRAM_NAME               =
          i_internal_tabname           = 'IT_QALS'
          i_structure_name             = 'QALS_D02'
        I_CLIENT_NEVER_DISPLAY       = 'X'
        I_INCLNAME                   =
        I_BYPASSING_BUFFER           =
        I_BUFFER_ACTIVE              =
        CHANGING
          ct_fieldcat                  = it_fieldcat
      IF sy-subrc = 0.
        LOOP AT  it_fieldcat INTO wa_fieldcat.
          CASE  wa_fieldcat-fieldname .
            WHEN  'PRUEFLOS'.
              wa_fieldcat-col_pos = 1.
              wa_fieldcat-hotspot = 'X'.
              APPEND wa_fieldcat TO it_fcat.
            WHEN   'WERK'.
              wa_fieldcat-col_pos = 3.
              APPEND wa_fieldcat TO it_fcat.
            WHEN  'LOSMENGE'.
              wa_fieldcat-col_pos = 4.
              wa_fieldcat-no_out = ''.
              APPEND wa_fieldcat TO it_fcat.
            WHEN  'MENGENEINH'.
              wa_fieldcat-col_pos = 5.
              wa_fieldcat-no_out = ''.
              APPEND wa_fieldcat TO it_fcat.
            WHEN 'ZZEQUNR'.
              wa_fieldcat-col_pos = 6.
              wa_fieldcat-no_out = ''.
              wa_fieldcat-hotspot = 'X'.
              APPEND wa_fieldcat TO it_fcat.
            WHEN  'ZZASSEMBLY'.
              wa_fieldcat-col_pos = 7.
              wa_fieldcat-no_out = ''.
              wa_fieldcat-hotspot = 'X'.
              APPEND wa_fieldcat TO it_fcat.
            WHEN  'HERKUNFT'.
              wa_fieldcat-col_pos = 8.
              APPEND wa_fieldcat TO it_fcat.
            WHEN  'AUFNR'.
              wa_fieldcat-col_pos = 9.
              wa_fieldcat-hotspot = 'X'.
              APPEND wa_fieldcat TO it_fcat.
            WHEN  'ENSTEHDAT'."enstehdat
              wa_fieldcat-col_pos = 10.
              APPEND wa_fieldcat TO it_fcat.
            WHEN  'STTXT'.
              wa_fieldcat-col_pos = 12.
              wa_fieldcat-hotspot = 'X'.
              APPEND wa_fieldcat TO it_fcat.
            WHEN OTHERS.
          ENDCASE.
          CLEAR wa_fieldcat.
        ENDLOOP.
        wa_fieldcat-fieldname = 'MATNR'.
        wa_fieldcat-tabname  =  'IT_QALS'.
        wa_fieldcat-col_pos = 2.
        wa_fieldcat-ref_tabname = 'AUFK'.
        wa_fieldcat-hotspot = 'X'.
        wa_fieldcat-seltext_l = 'Material No.'.
        APPEND wa_fieldcat TO it_fcat.
        wa_fieldcat-fieldname = 'PRUEFER'.
        wa_fieldcat-tabname  =  'IT_QALS'.
        wa_fieldcat-col_pos = 11.
        wa_fieldcat-ref_tabname = 'QAMR'.
        wa_fieldcat-seltext_l = 'Name of the Inspector'.
        APPEND wa_fieldcat TO it_fcat.
      ENDIF.
    ENDFORM.                    " build_fieldcat
    *&      Form  display_data
          text
    -->  p1        text
    <--  p2        text
    FORM display_data .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
       i_callback_program                = 'ZRAIL_LOT_REPORT'
      I_CALLBACK_PF_STATUS_SET          = ' '
         i_callback_user_command           = 'USER_COMMAND'
         is_layout                         = wa_layout
          it_fieldcat                       = it_fcat
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        =
      IT_EVENTS                         =
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      I_HTML_HEIGHT_TOP                 = 0
      I_HTML_HEIGHT_END                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      IR_SALV_FULLSCREEN_ADAPTER        =
        TABLES
          t_outtab                          = it_qals
    EXCEPTIONS
      PROGRAM_ERROR                     = 1
      OTHERS                            = 2
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " display_data
    *&      Form  USER_COMMAND
          text
         -->R_UCOMM      text
         -->RS_SELFIELD  text
    FORM user_command USING r_ucomm TYPE sy-ucomm  rs_selfield TYPE slis_selfield.
      CASE rs_selfield-fieldname  .
        WHEN 'PRUEFLOS'.
          SET PARAMETER ID 'QLS' FIELD rs_selfield-value.
          CALL TRANSACTION 'QA03' AND SKIP FIRST SCREEN.
        WHEN 'ZZEQUNR'.
          SET PARAMETER ID 'EQN' FIELD  rs_selfield-value.
          CALL TRANSACTION 'IE03' AND SKIP FIRST SCREEN.
        WHEN 'ZMATNR'.
          SET PARAMETER ID 'MAT' FIELD rs_selfield-value.
          CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
        WHEN 'ZZASSEMBLY'.
          SET PARAMETER ID 'MAT' FIELD rs_selfield-value.
          CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
        WHEN 'AUFNR'.
          SET PARAMETER ID 'ANR' FIELD rs_selfield-value.
          CALL TRANSACTION 'IW33' AND SKIP FIRST SCREEN.
        WHEN 'STTXT'.
          MOVE rs_selfield-tabindex TO mytabix1.
          PERFORM show_status.
      ENDCASE.
    ENDFORM.                    "USER_COMMAND
    *&      Form  show_status
          text
    -->  p1        text
    <--  p2        text
    FORM show_status .
      DATA:it_systat TYPE TABLE OF bapi2045ss,
           wa_sysstat TYPE bapi2045ss,
           it_bapi2045us TYPE TABLE OF bapi2045us.
      DATA:it_fsys TYPE TABLE OF slis_fieldcat_alv.
      DATA:insplot TYPE bapi2045d_il0-insplot.
      DATA:language TYPE bapi2045la.
      CLEAR wa_qals.
      READ TABLE it_qals INTO wa_qals INDEX mytabix1.
      insplot = wa_qals-prueflos.
      language-langu = sy-langu.
      CALL FUNCTION 'BAPI_INSPLOT_GETSTATUS'
        EXPORTING
          number        = insplot
          language      = language
        TABLES
          system_status = it_systat
          user_status   = it_bapi2045us.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_program_name     = 'ZRAIL_LOT_REPORT'
          i_internal_tabname = 'IT_SYSTAT'
          i_structure_name   = 'BAPI2045SS'
        CHANGING
          ct_fieldcat        = it_fsys.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program = 'ZRAIL_LOT_REPORT'
          it_fieldcat        = it_fsys
        TABLES
          t_outtab           = it_systat.
    ENDFORM.                    " show_status
    IIn the subrouitne the User command the Parameter rs_selfield will give you the selected or clicked field and its value its record no .
    I hope this will help you.

Maybe you are looking for

  • Washed out iPhone 5 screen

    This happens when I try and unlock my screen.Occasionally, the screen will be very faded looking. Not bright like an autobright overadjustment, just unsaturated and hazy. Washed out and cloudy, it often dissipates slowly over about 30 seconds to a mi

  • Confused about the join output

    This one shows employee and there manager select e.last_name employee ,e.hire_date,s.last_name manager ,s.hire_date from employees e , employees s where e.manager_id=s.employee_id Dont know what it shows select e.last_name employee ,e.hire_date,s.las

  • MacBook Pro Shuts Down During Bootup

    Hey Everyone, My MacBook Pro (15", Late-2008, First-Gen Unibody) is having a pretty serious issue during startup. When I press the power button, the computer begins the startup sequence as usual, and reaches the grey screen with the Apple logo and th

  • When I first started using Collections, I followed someone's advice and always clicked 'create virtu

    When I first started using Collections, I followed someone's advice and always clicked 'create virtual copy' -- so I now have a huge number of unused/useless VCs that I would like to clear out. Is there any way to 1) filter to show all virtual copies

  • In Safari, selecting any link brings up a new tab of advertising. Virus? Solution?

    My grandson is using a a fully updated MacBook Pro. When he selects any link, a new tab full of advertising pops up. He has scanned with ClamXav and run the disk repair utility to no effect. he has downloaded Firefox and that is unaffected so far. Ma