JTree Selection Events

Hello,
I like to initially expand a tree and select the first data item in it. It should then execute all events as it would when the user opens the tree with mouse clicks and selects a sub-item.
This is my code:
In the constuctor of the container of the tree control I do:
public OperationSplitTreeSoftDist()
initTree();
fillTree();
protected final void initTree()
// setup tree renderers etc......
// setup events
setupTreeEvents();
private void setupTreeEvents()
mTree.addTreeSelectionListener(new TreeSelectionListener()
     public void valueChanged(TreeSelectionEvent e)
System.out.println("Tree selection event received!");
....... // other things done here
private void fillTree()
..... // executing sql query and filling resultset in tree
mTree.expandRow(0);
mTree.setSelectionRow(1);
In the last two rows above I expand the root of the tree and select the first row of the expanded tree. This works fine but the EVENTS (TreeSelectionListener) are NOT fired! My implementation of the Selection Listener executes another query on a database server and fills the results in a table. This is only called AFTER mouse clicks, the programmatically selected first row does NOT fire selection events!!
Is there any way of firing selection events PROGRAMMATICALLY??
Many thanks for your help.
Thomas

You would laugh if I say it :)
My code was throwing an Exception becoz of the index in substring function.
To put in simple terms, careless programming. and my mind had gone for a walk...I wasn;t able to figure out where the problem lied :)
anyways, let me know if you have problems with yoru code. I would like to know about it, and if possible..I will try solving it as well :)
Sangeetha

Similar Messages

  • Cancel JTree selection event ?

    Hello,
    I have defined a user object in the DefaultMutableTreeNode that holds a flag for disabled nodes - Now I would like to cancel events from the user when this node is being selected, also I would like to make this node appear disabled.
    How should I do this with JTree embedded inside an applet ?
    Thank you,
    Maxim.

    My rough idea is, store your previous selection, when you get selection change event, check if the node is disabled, if so, set the selection back to previous selection. Also, you can implement TreeCellRender interface, make the node's background gray to let user feel it is disabled.

  • Tree selection event in jtree

    hi
    i'm using a jtree in my gui but im facing a problem
    jTree1.addTreeSelectionListener(new TreeSelectionListener() {
                   public void valueChanged(TreeSelectionEvent e)
                        jTree1_valueChange(e);
    as you can see that whenever i click on a particular node in the tree the tree selection event occurs which calls the valuechanged method and it does as required but if i click again on the same selection as before the tree selection event does not occur and it does not call the method so say that the node i'm selecting is supposed to be dynamic and has to be refreshed if i click on it again it will not update itself through the value changed method. can somebody please tell me a way to be able to get the valuechanged method even if i click on the same selection.
    im a bot new to java swing programing so please if you could be a little more explanatory it could help
    thanks

    You problem is talked about (and a solution proposed) in the JavaDoc.
    See the code sample in the doc header from http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JTree.html

  • JTree selection problem when using custom renderer and editor

    Hello:
    I created a JTree with custom renderer and editor.
    The customization makes JCheckBox to be the component
    responsible for editing and rendering.
    The problem is that when I click on the node with the checkbox
    the JTree selection model does not get updated.
    Without customizations of the editor and renderer the MouseEvent would be fired and BasicTreeUI$MouseHandler.mousePressed() method would call
    the selectPathForEvent() method which would be responsible for updating
    the selection model. At the same time if I attach a mouse listener to the JTree (customized) I see the events when clicking on the nodes. It seems like the MouseEvent gets lost and somehow as a result of which the selection model does not get updated.
    Am I missing something?
    Thanks
    Alexander

    You probably forgot to call super.getTreeCellRendererComponent(...) at the beginning of your getTreeCellRendererComponent(...) method in your custom renderer.
    Or maybe in the getTreeCellEditorComponent(...) of the TreeCellEditor...

  • Not able to reach start of selection event in the called program

    hi,
    I have a report 1 in which i am calling report2 using below syntax,
    SUBMIT Report2  VIA JOB gv_jobname NUMBER gv_jobcount
                 WITH s_g_yr  IN s_g_yr
                 WITH s_c_rf  IN s_c_rf
    AND RETURN.
    the problem is when report 2 is called it exists after event "at selection screen output" and does not go in the event "start of selection". 
    Please advise. how can i reach the "start of selection" event where all the processing logic is specified..
    Thanks and Regards,
    Kriti

    Hi,
    In your report you have used the event AT SELECTION-SCREEN OUTPUT. So, first it will trigger this event and then it will go for START-OF-SELECTION event.
    Events will trigger in this following way.
    LOAD PROGRAM
    INITIALIZATION
    AT SELECTION-SCREEN
    AT SELECTION-SCREEN OUTPUT
    START-OF-SELECTION
    END-OF-SELECTION
    TOP-OF-PAGE
    END-OF-PAGE
    In above sequence events will trigger in report.
    Regards,
    Shankar.

  • [JS/CS4/CS5] Catching a selection event in a ScriptUI interface.

    I've got this ScriptUI interface (javascript based), and now I wonder if it would be possible to change one of its button captions depending on whether anything is selected or not, in the active document (would also have to be updated if the user selects or opens another document).
    1. Is it possible to write event listeners for this?
    2. Would it be possible to include this in the same script as the rest of the Script UI interface code (that is, I'd prefer avoiding a separate file in the startup folder).
    3. What's the best source of information regarding events, which ones there are, and how to handle them in javascript?
    Andreas

    1. Yes. The selection events work well in my experience.
    2. Yes, you don't have to add them at startup. You can do something like:
    app.addEventListener("afterSelectionChanged", selectionChangedFunction);
    before you open your window. Remove the listener in the onClose event of the window. I think you'll have to have some error trapping in the selectionChangedFunction to deal with app.selection erroring after a document close or during a revert.
    3. See this thread for an extension that lets you see events as they're happening.
    Jeff

  • Finding selected event in iCal

    I want to run a script that processes the currently selected iCal event / todo. (sync it with a Filemaker DB).
    I cant find a command that returns the selected/current/active iCal object. I can only find an object one with a given property value.
    I'm a bit new to this so any pointers would be greatly appreciated.
    OTBC

    Hi OTBC,
    I was waiting for someone to post something Apple maight have added in newer versions of iCal, but I guess they didn't add anything.
    There is no selection property in iCal, but you can create macro like statements to script applications. So, as a wrokaround in iCal, you could use keystrokes to get the name of the currently selected event.
    tell application "iCal" to activate
    tell application "System Events"
    tell process "iCal"
    keystroke return
    keystroke "c" using command down
    end tell
    end tell
    This would copy the summary of to selected event. You could tab to tab through the information for the event. This might help you pinpoint the event in the case where there are several events with the same summary. Like a macro you would have to test it out in iCal to find the right combination of keystroke and ui scripting.
    Note that it is very hard to get recurrence events.
    gl,

  • Since I upgraded to Yosemite I can no longer upload photos to eBay by selecting "events"  all my photos pop up together.  Anyone know how to fix this?

    I recently updated to Yosemite 10.10.1.  Since I updated I can no longer upload photos to eBay, Shutterfly, Craigslist by selecting "events".  It is no longer an option.
    All my photos come up as one entire library.  When I view them in iPhoto they are divided into events, however once I go to upload them the entire library appears without any defining options, such as "events", recent imports, etc.   I thought at first this might be an issue with eBay, but realized it wasn't when I tried to list on Craigslist.  This is a nuisance and time consuming process.  Does anyone know if there is a fix in the future or if I am just missing some quick fix?

    I would like to add that Comcast is my internet provider. Perhaps that is part of the issue although the Connection Doctor confirms the mail box is connecting to the internet. No other function processes when Connection Doctor program is used to find the source of the issue. I have read forum posts but am unable to find a way to get my Apple mail to be delivered to my computer. It worked fine up until I chose to transfer mail to the Cloud. My mail account is a .mac account.
    Still hoping someone out there can help me.
    thanks,
    anne

  • Error in at line-selection event...

    Hello experts,
    In my report, I am hiding the values of BUKRS, ANLN1 and ANLN2 during my loop.
    I am using field symbols as my work area for my itab which is it_output. The problem
    is, when I try to do this in my at line-selection event:
    at line-selection.
    data: cursorfield(20) type c.
        get cursor field cursorfield.
        case cursorfield.
         when '<FS_OUTPUT>-ASSET_SUBNUM'.
         SET PARAMETER ID 'BUK' FIELD <FS_OUTPUT>-bukrs.
         SET PARAMETER ID 'AN1' FIELD <FS_OUTPUT>-asset.
         SET PARAMETER ID 'AN2' FIELD <FS_OUTPUT>-anln2.
        endcase.
    It says that it can't recognize the fields. What am I doing wrong? By the way, I am using
    ABAP Objects in my report. Help would be greatly appreciated. Thanks again guys and take care!

    Hi Viraylab,
    Have you assigned the fieldsymbols ?
    ASSIGN IT_OUTPUT to <FS_OUTPUT>.
    Cheers
    VJ
    Message was edited by: Vijayendra  Rao

  • Using select event for interlayer navigation

    Hi All,
                  I have two tables. The output of first table is input for the second one. When I select a row in the first table,the SELECT event is fired and the second table is populated based on the selection.
                 Now I have a scenario where the two tables are on separate layers. My requirement is that, the secondlayer should be brought in when the SELECT event is fired. I don't want to use a button to trigger a navigation event. I try naming the navigation event as SELECT but it didn't work.
         please help

    Hi Jarrod,
              Yes your view i sright. But i had mistakingly mentioned a table. Its Bar chart actually. When a bar is clicked, second layer should appear with the detail table ouput.
          Though the table is filled with the click but the navigation is not happeneing. Do you have any idea abouit it ?
    I have used *select also but to no avail

  • Select event not triggered in table with only one row

    Hi all,
    I am building a BI VC application where query data is displayed in a table. When the user clicks on a table row another query is then triggered and output in a second table. The output from table 1 is linked to the input of query2/table2 with a select event.
    The problem that I am facing is that if there is only one row in table 1, the select event is never triggered. If, however there are two or more rows in the table the select event is triggered and query 2 is executed. I have searched the forums but all I could find on select event problems was how to avoid the initial select event.
    Has anyone else experienced this issue and what is the workaround or is this a bug in Visual Composer? We are on VC 7.0 SP19.
    Cheers,
    Astein Meland

    Thanks Chittya,
    Yes we have considered this option as well. But as we have more than one table linked together we would like to avoid having to manually click several buttons.
    In the end I found Note 1364334 describing bugfixes released in VC 7.0 SP20:
    "Normally, when a Visual Composer table is populated from a data service, the first row is selected by default. However, we have found that if only one data row is returned from the data service, this row is not selected by default and cannot be manually selected by clicking on it either."
    So I think we will just have to upgrade our Portal to the latest support packs to solve this problem.
    Thanks,
    Astein

  • What is the use of "end of selection" event in report

    Hi all
    As we can display the outputs in the "start-of-selection "using the write statement.
    Then what is the use of "end-of-selection" in reports.
    Please tell me with some real tiem examples.
    God points will be rewarded.
    Thanks

    Hi,
    The END-OF-SELECTION event is triggered in type executable programs once the logical database has finished reading all data and before the list processor is started.
    It tells the server that all the database reading is completed and no further reading is going to take place..
    For more details go through the following link:
    http://help.sap.com/saphelp_me21sp2/helpdata/en/9f/db9aca35c111d1829f0000e829fbfe/content.htm
    END-OF-SELECTION is used mostly when you are using Logical data base in your report. It is triggered when all selection get finished from the data base.
      You can use write statments in start of selection and end of selection also.
      But the one use of end of selection is... if you want to stop the processing of a certain code and directly display some message you can use this.
    start-of-selection.
      select data..
      process data
    if no data .
    stop.
    endif.
    write data
    end-of-selection.
    write : 'No data to display.
    Stop command will take the control to end of selection event.
    thanks,
    mahesh
    Message was edited by:
            I Can Solve It

  • Proper use of END-OF-SELECTION event in report programme

    Hi,
    If we will write "WRITE" statements in side START-OF-SELECTION then it will help me to display the output.Then what is the need of END-OF-SELECTION .
    Can any body please tell me the <b>proper use of END-OF-SELECTION event in report programme.</b>

    This is the last of the events called by the runtime environment to occur. It is triggered after all of the data has been read from the logical database, and before the list processor is started.
    <b>In report programs using LDB for every value selected the program issues the output, to control this you would use END-OF-SELECTION.</b> Now if you call your output in this event, the output is made only after all the values are selected as per the selection criteria.
    suppose while coding, u need a logic like below:
    if a condition is satisfied continue with the report
    and if not satisfied, then display a message and end the report.
    then u can code like below.
    start-of-slection.
    if a = <condition>.
    do the following.......
    else.
    stop.
    end-of-selection.
    write: 'THIS IS END'.
    stop command triggers end-of-slection from anywhere.
    I hope it helps.
    Best Regards,
    Vibha
    *Please mark all the helpful answers

  • "AT LINE-SELECTION" event in a Query (SQ01 or SQ02)

    Hi there
    I want to know if it's possible to put "AT LINE-SELECTION" event in an ABAP Query? I'm trying that in SQ02 - the infoset - but nothing happens when I double-click on the output lines. I cannot find any place to type codes in SQ01.
    The purpose is to call a transaction VA03 when people double-click on the output field "sales order number" and here is the code I put in "Free coding" section of SQ02.
    AT LINE-SELECTION.
      DATA: w_cucol TYPE sy-cucol.
      w_cucol = sy-cucol + sy-staco.
      w_cucol = w_cucol - 2.
      IF w_cucol BETWEEN 103 AND 119.
        SET PARAMETER ID 'AUN' FIELD vbkd-vbeln.
        CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
      ENDIF.
    yu

    Hi ,
    You must create infoset based on join VBKD with VBAK and LIPS.
    Also you must put VBAK-VBELN and LIPS-VBELN as a column output.
    There is no problem to use 2 report assignment ( there is no loss ).
    There is no necessity to use " some ABAP code at line-selection ".
    This works.
    By the way is more correct from the beginning to formulate the issue including all the data about your problem and not include them by adding a little at a time.
    Regards.

  • AT LINE SELECTION EVENT IN BLOCKED ALV

    hi friends,
    i have developed blocked alv report.
    i wanted to use at line selection event..
    pls halp me if u know..
    thanks and regards,
    shridevi.l

    hi
    there is no particulat at line selection event in REUSE_ALV_EVENTS_GET.
    at line selection we get fct 'PICK' code for double click.
    so using that fct code we do the operations using at user_command. which is other way of implemnting at line-selection
    If any quieries revert, reward if helpful
    Try this code
    *& Report  ZP_ALV8
    REPORT  zp_alv8.
    TABLES: kna1, mara, vbak, mard.
    TYPE-POOLS: slis.
    **TYPE DECLERATION
    TYPES: BEGIN OF ty_kna1,
             kunnr LIKE kna1-kunnr,
             land1 LIKE kna1-land1,
             name1 LIKE kna1-name1,
             ort01 LIKE kna1-ort01,
           END OF ty_kna1.
    TYPES: BEGIN OF ty_mara,
             matnr LIKE mara-matnr,
             ersda LIKE mara-ersda,
             ernam LIKE mara-ernam,
           END OF ty_mara.
    TYPES: BEGIN OF ty_vbak,
             vbeln LIKE vbak-vbeln,
             erdat LIKE vbak-erdat,
             ernam LIKE vbak-ernam,
           END OF ty_vbak.
    TYPES: BEGIN OF ty_mard,
             matnr LIKE mard-matnr,
             werks LIKE mard-werks,
             lgort LIKE mard-lgort,
          END OF ty_mard.
    **DATA DECLERATION
    DATA: it_kna1 TYPE STANDARD TABLE OF ty_kna1,
          wa_kna1 TYPE ty_kna1.
    DATA: it_mara TYPE STANDARD TABLE OF ty_mara,
          wa_mara TYPE ty_mara.
    DATA: it_vbak TYPE STANDARD TABLE OF ty_vbak,
          wa_vbak TYPE ty_vbak.
    DATA: it_mard TYPE STANDARD TABLE OF ty_mard,
          wa_mard TYPE ty_mard.
    DATA: it_fieldcat_kna1 TYPE slis_t_fieldcat_alv,
          wa_fieldcat_kna1 TYPE slis_fieldcat_alv,
          it_fieldcat_mara TYPE slis_t_fieldcat_alv,
          wa_fieldcat_mara TYPE slis_fieldcat_alv,
          it_fieldcat_vbak TYPE slis_t_fieldcat_alv,
          wa_fieldcat_vbak TYPE slis_fieldcat_alv,
          it_fieldcat_mard TYPE slis_t_fieldcat_alv,
          wa_fieldcat_mard TYPE slis_fieldcat_alv.
    DATA: it_event_kna1 TYPE slis_t_event,
          wa_event_kna1 TYPE slis_alv_event,
          it_event_mara TYPE slis_t_event,
          wa_event_mara TYPE slis_alv_event,
          it_event_vbak TYPE slis_t_event,
          wa_event_vbak TYPE slis_alv_event,
          it_event_mard TYPE slis_t_event,
          wa_event_mard TYPE slis_alv_event.
    DATA: wa_layout TYPE slis_layout_alv,
          it_listheader TYPE slis_t_listheader,
          wa_listheader TYPE slis_listheader.
    selection-screen begin of block b1 with frame title text-001.
    select-options: s_kunnr for kna1-kunnr default '1000' to '1050'.
    selection-screen end of block b1.
    selection-screen begin of block b2 with frame title text-002.
    select-options: s_matnr for mara-matnr default '1' to '100'.
    selection-screen end of block b2.
    **INITIALIZATION
    INITIALIZATION.
      PERFORM layout.
      PERFORM fieldcat_kna1.
      PERFORM fieldcat_mara.
      PERFORM event_kna1.
      PERFORM event_mara.
      PERFORM eventpopulate_kna1.
      PERFORM eventpopulate_mara.
    **START OF SELECTION AND FIRST LIST DISPLAY
    START-OF-SELECTION.
      SELECT kunnr land1 name1 ort01
             FROM kna1
             INTO TABLE it_kna1
             where kunnr in s_kunnr.
           UP TO 10 ROWS.
      SELECT matnr ersda ernam
             FROM mara
             INTO TABLE it_mara
             where matnr in s_matnr.
            UP TO 20 ROWS.
      PERFORM display.
    **FORM LAYOUT
    *&      Form  layout
          text
    -->  p1        text
    <--  p2        text
    FORM layout .
      wa_layout-zebra ='X'.
      wa_layout-get_selinfos      = 'X'.
      wa_layout-key_hotspot = 'X'.
    ENDFORM.                    " layout
    *FIELD CATALOUGE*******************************
    *&      Form  fieldcat_kna1
          text
    -->  p1        text
    <--  p2        text
    FORM fieldcat_kna1 .
      REFRESH it_fieldcat_kna1.
      CLEAR wa_fieldcat_kna1.
      wa_fieldcat_kna1-fieldname = 'KUNNR'.
      wa_fieldcat_kna1-seltext_l = 'CUSTOMER NUMBER'.
      wa_fieldcat_kna1-datatype = 'CHAR'.
      wa_fieldcat_kna1-outputlen = 30.
      wa_fieldcat_kna1-tabname = 'IT_KNA1'.
      wa_fieldcat_kna1-key = 'X'.
      wa_fieldcat_kna1-hotspot = 'X'.
      wa_fieldcat_kna1-col_pos = 1.
      wa_fieldcat_kna1-emphasize = 'C21'.
      APPEND wa_fieldcat_kna1 TO it_fieldcat_kna1.
      CLEAR wa_fieldcat_kna1.
      wa_fieldcat_kna1-fieldname = 'LAND1'.
      wa_fieldcat_kna1-seltext_l = 'COUNTRY CODE'.
      wa_fieldcat_kna1-datatype = 'CHAR'.
      wa_fieldcat_kna1-outputlen = 30.
      wa_fieldcat_kna1-tabname = 'IT_KNA1'.
      wa_fieldcat_kna1-hotspot = 'X'.
      wa_fieldcat_kna1-col_pos = 2.
      wa_fieldcat_kna1-emphasize = 'C31'.
      APPEND wa_fieldcat_kna1 TO it_fieldcat_kna1.
      CLEAR wa_fieldcat_kna1.
      wa_fieldcat_kna1-fieldname = 'NAME1'.
      wa_fieldcat_kna1-seltext_l = 'CUSTOMER NAME'.
      wa_fieldcat_kna1-datatype = 'CHAR'.
      wa_fieldcat_kna1-outputlen = 30.
      wa_fieldcat_kna1-tabname = 'IT_KNA1'.
      wa_fieldcat_kna1-hotspot = 'X'.
      wa_fieldcat_kna1-col_pos = 3.
      wa_fieldcat_kna1-emphasize = 'C71'.
      APPEND wa_fieldcat_kna1 TO it_fieldcat_kna1.
      CLEAR wa_fieldcat_kna1.
      wa_fieldcat_kna1-fieldname = 'ORT01'.
      wa_fieldcat_kna1-seltext_l = 'COUNTRY '.
      wa_fieldcat_kna1-datatype = 'CHAR'.
      wa_fieldcat_kna1-outputlen = 30.
      wa_fieldcat_kna1-tabname = 'IT_KNA1'.
      wa_fieldcat_kna1-hotspot = 'X'.
      wa_fieldcat_kna1-col_pos = 4.
      wa_fieldcat_kna1-emphasize = 'C51'.
      APPEND wa_fieldcat_kna1 TO it_fieldcat_kna1.
      CLEAR wa_fieldcat_kna1.
    ENDFORM.                    " fieldcat_kna1
    *&      Form  fieldcat_kna2
          text
    FORM fieldcat_mara  .
      wa_fieldcat_mara-fieldname = 'MATNR'.
      wa_fieldcat_mara-seltext_l = 'MATERIAL NUMBER'.
      wa_fieldcat_mara-datatype = 'CHAR'.
      wa_fieldcat_mara-outputlen = 30.
      wa_fieldcat_mara-tabname = 'IT_MARA'.
      wa_fieldcat_mara-key = 'X'.
      wa_fieldcat_mara-hotspot = 'X'.
      wa_fieldcat_mara-col_pos = 1.
      wa_fieldcat_mara-emphasize = 'C21'.
      APPEND wa_fieldcat_mara TO it_fieldcat_mara.
      CLEAR wa_fieldcat_mara.
      wa_fieldcat_mara-fieldname = 'ERSDA'.
      wa_fieldcat_mara-seltext_l = 'CREATED ON'.
      wa_fieldcat_mara-datatype = 'CHAR'.
      wa_fieldcat_mara-outputlen = 30.
      wa_fieldcat_mara-tabname = 'IT_MARA'.
      wa_fieldcat_mara-hotspot = 'X'.
      wa_fieldcat_mara-col_pos = 2.
      wa_fieldcat_mara-emphasize = 'C41'.
      APPEND wa_fieldcat_mara TO it_fieldcat_mara.
      CLEAR wa_fieldcat_mara.
      wa_fieldcat_mara-fieldname = 'ERNAM'.
      wa_fieldcat_mara-seltext_l = 'CREATED BY'.
      wa_fieldcat_mara-datatype = 'CHAR'.
      wa_fieldcat_mara-outputlen = 30.
      wa_fieldcat_mara-tabname = 'IT_MARA'.
      wa_fieldcat_mara-hotspot = 'X'.
      wa_fieldcat_mara-col_pos = 3.
      wa_fieldcat_mara-emphasize = 'C61'.
      APPEND wa_fieldcat_mara TO it_fieldcat_mara.
      CLEAR wa_fieldcat_mara.
    ENDFORM.                    "fieldcat_kna2
    *&      Form  FIELDCAT_VBAK
          text
    FORM fieldcat_vbak.
      wa_fieldcat_vbak-fieldname = 'VBELN'.
      wa_fieldcat_vbak-seltext_l = 'SALES ORDER'.
      wa_fieldcat_vbak-datatype = 'CHAR'.
      wa_fieldcat_vbak-outputlen = 30.
      wa_fieldcat_vbak-tabname = 'IT_VBAK'.
      wa_fieldcat_vbak-hotspot = 'X'.
      wa_fieldcat_vbak-col_pos = 3.
      wa_fieldcat_vbak-emphasize = 'C31'.
      APPEND wa_fieldcat_vbak TO it_fieldcat_vbak.
      CLEAR wa_fieldcat_vbak.
      wa_fieldcat_vbak-fieldname = 'ERDAT'.
      wa_fieldcat_vbak-seltext_l = 'CREATED ON'.
      wa_fieldcat_vbak-datatype = 'DATS'.
      wa_fieldcat_vbak-outputlen = 30.
      wa_fieldcat_vbak-tabname = 'IT_VBAK'.
      wa_fieldcat_vbak-hotspot = 'X'.
      wa_fieldcat_vbak-col_pos = 3.
      wa_fieldcat_vbak-emphasize = 'C41'.
      APPEND wa_fieldcat_vbak TO it_fieldcat_vbak.
      CLEAR wa_fieldcat_vbak.
      wa_fieldcat_vbak-fieldname = 'ERNAM'.
      wa_fieldcat_vbak-seltext_l = 'CREATED BY'.
      wa_fieldcat_vbak-datatype = 'CHAR'.
      wa_fieldcat_vbak-outputlen = 30.
      wa_fieldcat_vbak-tabname = 'IT_VBAK'.
      wa_fieldcat_vbak-hotspot = 'X'.
      wa_fieldcat_vbak-col_pos = 3.
      wa_fieldcat_vbak-emphasize = 'C51'.
      APPEND wa_fieldcat_vbak TO it_fieldcat_vbak.
      CLEAR wa_fieldcat_vbak.
    ENDFORM.                    "FIELDCAT_VBAK
    *&      Form  fieldcat_mard
          text
    FORM fieldcat_mard.
      wa_fieldcat_mard-fieldname = 'MATNR'.
      wa_fieldcat_mard-seltext_l = 'MATERIAL NUMBER'.
      wa_fieldcat_mard-datatype = 'CHAR'.
      wa_fieldcat_mard-outputlen = 30.
      wa_fieldcat_mard-tabname = 'IT_MARD'.
      wa_fieldcat_mard-hotspot = 'X'.
      wa_fieldcat_mard-col_pos = 1.
      wa_fieldcat_mard-emphasize = 'C31'.
      APPEND wa_fieldcat_mard TO it_fieldcat_mard.
      CLEAR wa_fieldcat_mard.
      wa_fieldcat_mard-fieldname = 'WERKS'.
      wa_fieldcat_mard-seltext_l = 'PLANT'.
      wa_fieldcat_mard-datatype = 'CHAR'.
      wa_fieldcat_mard-outputlen = 30.
      wa_fieldcat_mard-tabname = 'IT_MARD'.
      wa_fieldcat_mard-hotspot = 'X'.
      wa_fieldcat_mard-col_pos = 2.
      wa_fieldcat_mard-emphasize = 'C61'.
      APPEND wa_fieldcat_mard TO it_fieldcat_mard.
      CLEAR wa_fieldcat_mard.
      wa_fieldcat_mard-fieldname = 'LGORT'.
      wa_fieldcat_mard-seltext_l = 'STORAGE LOCATION'.
      wa_fieldcat_mard-datatype = 'CHAR'.
      wa_fieldcat_mard-outputlen = 30.
      wa_fieldcat_mard-tabname = 'IT_MARD'.
      wa_fieldcat_mard-hotspot = 'X'.
      wa_fieldcat_mard-col_pos = 3.
      wa_fieldcat_mard-emphasize = 'C81'.
      APPEND wa_fieldcat_mard TO it_fieldcat_mard.
      CLEAR wa_fieldcat_mard.
    ENDFORM  .                    "fieldcat_mard
    **FORM DISPLAY
    *&      Form  Display
          text
    -->  p1        text
    <--  p2        text
    FORM display .
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
        EXPORTING
          i_callback_program = sy-repid
      I_CALLBACK_PF_STATUS_SET       = ' '
       I_CALLBACK_USER_COMMAND        = 'USER_COMMAND'.
      IT_EXCLUDING                   =
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
        EXPORTING
          is_layout                        = wa_layout
          it_fieldcat                      = it_fieldcat_kna1
          i_tabname                        = 'IT_KNA1'
         it_events                         = it_event_kna1
      IT_SORT                          =
      I_TEXT                           = ' '
        TABLES
          t_outtab                         = it_kna1
       EXCEPTIONS
         program_error                    = 1
         maximum_of_appends_reached       = 2
         OTHERS                           = 3
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
        EXPORTING
          is_layout                        = wa_layout
          it_fieldcat                      = it_fieldcat_mara
          i_tabname                        = 'IT_MARA'
          it_events                        = it_event_mara
      IT_SORT                          =
      I_TEXT                           = ' '
        TABLES
          t_outtab                         = it_mara
       EXCEPTIONS
         program_error                    = 1
         maximum_of_appends_reached       = 2
         OTHERS                           = 3
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
        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
    **EVENTS FOR KNA1 AND MARA
    *&      Form  EVENT_KNA1
          text
    -->  p1        text
    <--  p2        text
    FORM event_kna1 .
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type     = 0
        IMPORTING
          et_events       = it_event_kna1
        EXCEPTIONS
          list_type_wrong = 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.                    " EVENT_KNA1
    *&      Form  EVENT_MARA
          text
    -->  p1        text
    <--  p2        text
    FORM event_mara .
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type     = 0
        IMPORTING
          et_events       = it_event_mara
        EXCEPTIONS
          list_type_wrong = 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.                    " EVENT_MARA
    **POPULATING EVENTS
    *&      Form  eventpopulate_kna1
          text
    -->  p1        text
    <--  p2        text
    FORM eventpopulate_kna1 .
      READ TABLE it_event_kna1 INTO wa_event_kna1 WITH KEY name = 'TOP_OF_PAGE'.
      IF sy-subrc = 0.
        wa_event_kna1-form = 'TOP_OF_PAGE_KNA1'.
        MODIFY it_event_kna1 FROM wa_event_kna1 TRANSPORTING form WHERE name = wa_event_kna1-name.
      ENDIF.
    READ TABLE it_event_kna1 INTO wa_event_kna1 WITH KEY name = 'USER_COMMAND'.
    IF sy-subrc = 0.
       wa_event_kna1-form = 'USER_COMMAND_KNA1'.
       MODIFY it_event_kna1 FROM wa_event_kna1 TRANSPORTING form WHERE name = wa_event_kna1-name.
    ENDIF.
    ENDFORM.                    " eventpopulate_kna1
    *&      Form  eventpopulate_mara
          text
    -->  p1        text
    <--  p2        text
    FORM eventpopulate_mara .
      READ TABLE it_event_mara INTO wa_event_mara WITH KEY name = 'TOP_OF_PAGE'.
      IF sy-subrc = 0.
        wa_event_mara-form = 'TOP_OF_PAGE_MARA'.
        MODIFY it_event_mara FROM wa_event_mara TRANSPORTING form WHERE name = wa_event_mara-name.
      ENDIF.
    READ TABLE it_event_mara INTO wa_event_mara WITH KEY name = 'USER_COMMAND'.
    IF sy-subrc = 0.
       wa_event_mara-form = 'USER_COMMAND_MARA'.
       MODIFY it_event_mara FROM wa_event_mara TRANSPORTING form WHERE name = wa_event_mara-name.
    ENDIF.
    ENDFORM.                    " eventpopulate_mara
    **TOP OF PAGE
    *&      Form  TOP_OF_PAGE_KNA1
          text
    FORM top_of_page_kna1.
    wa_listheader-typ = 'H'.
    wa_listheader-info = 'CUSTOMER DETAILS' .
    APPEND wa_listheader TO it_listheader.
    CLEAR wa_listheader.
      WRITE:/ 'CUSTOMER DETAILS'.
    ENDFORM.                    "TOP_OF_PAGE_KNA1
    *&      Form  TOP_OF_PAGE_MARA
          text
    FORM top_of_page_mara.
    wa_listheader-typ = 'H'.
    wa_listheader-info = 'MATERIAL DETAILS' .
    APPEND wa_listheader TO it_listheader.
    CLEAR wa_listheader.
      WRITE:/ 'MATERIAL DETAILS' .
    ENDFORM.                    "TOP_OF_PAGE_KNA1
    **CODE FOR SECOND LIST DISPLAY FOR VBAK
    *&      Form  USER_COMMAND
          text
         -->UCOMM      text
         -->R_SELFIELD text
    FORM user_command
         USING ucomm LIKE sy-ucomm
               r_selfield TYPE slis_selfield.
    CASE UCOMM.
      when '&IC1'.
        CASE R_SELFIELD-TABNAME.
          WHEN 'IT_KNA1'.
            DATA: CUST(10) TYPE n.
            CUST = r_selfield-value.
             SELECT vbeln erdat ernam
                    FROM vbak
                    INTO TABLE it_vbak
                    WHERE kunnr = cust.
             PERFORM fieldcat_vbak.
             PERFORM display_vbak.
          WHEN 'IT_MARA'.
            DATA: MAT(18) TYPE N.
            MAT = R_selfield-value.
              SELECT matnr werks lgort
                   FROM mard
                   INTO TABLE it_mard
                   WHERE matnr = mat.
            PERFORM fieldcat_mard.
            PERFORM display_mard.
         ENDCASE.
      ENDCASE.
    ENDFORM.                    "USER_COMMAND
    **&      Form  USER_COMMAND_MARA
          text
         -->UCOMM      text
         -->S_SELFIELD text
    *FORM user_command_mara
        USING ucomm LIKE sy-ucomm
              s_selfield TYPE slis_selfield.
    SELECT matnr werks lgort
            FROM mard
            INTO TABLE it_mard
            WHERE matnr = s_selfield-value.
    PERFORM fieldcat_mard.
    PERFORM display_mard.
    *ENDFORM.                    "USER_COMMAND_MARA
    *&      Form  DISPLAY_VBAK
          text
    -->  p1        text
    <--  p2        text
    FORM display_vbak .
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
       I_CALLBACK_PROGRAM                = sy-repid
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = ' '
      I_CALLBACK_TOP_OF_PAGE            = ' '
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
      I_GRID_TITLE                      =
      I_GRID_SETTINGS                   =
       IS_LAYOUT                         = wa_layout
       IT_FIELDCAT                       = it_fieldcat_vbak
      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        =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
      TABLES
        t_outtab                          = it_vbak
    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_VBAK
    *&      Form  display_mard
          text
    FORM display_mard .
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
      I_INTERFACE_CHECK              = ' '
      I_BYPASSING_BUFFER             =
      I_BUFFER_ACTIVE                = ' '
         i_callback_program             = sy-repid
      I_CALLBACK_PF_STATUS_SET       = ' '
        i_callback_user_command        = 'USER_COMMAND_MARD'
      I_STRUCTURE_NAME               =
         is_layout                      = wa_layout
         it_fieldcat                    = it_fieldcat_mard
      IT_EXCLUDING                   =
      IT_SPECIAL_GROUPS              =
      IT_SORT                        =
      IT_FILTER                      =
      IS_SEL_HIDE                    =
      I_DEFAULT                      = 'X'
      I_SAVE                         = ' '
      IS_VARIANT                     =
        it_events                      = it_event_mard
      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
      IR_SALV_LIST_ADAPTER           =
      IT_EXCEPT_QINFO                =
      I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER        =
      ES_EXIT_CAUSED_BY_USER         =
        TABLES
          t_outtab                       = it_mard
    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_mard
    REGARDS
    PRASANTH

Maybe you are looking for

  • Small Business Server 2011 Remote Web Access RDP doesn't work.

    I have setup Windows small business server 2011 and a separate Terminal Server on a Windows Server 2008 r2 box. Remote Web Access webpage works fine, I can check email and view network drives online. The problem I have is that I cannot connect to any

  • Function module parameters mapping

    Hi Expert, We are working on a  upgradation tool in which i have to repace the obsolete function module "HELP_VALUES_GET_WITH_CHECKTAB " by "F4IF_FIELD_VALUE_REQUEST ". I am not sure about the functionalities of these function modules as i have never

  • File size in back up is different from on laptop....

    When I back up with Time Machine I noticed that the GB amount in my photos folder is different in both. It's less in the back up by about 7GB. Does this mean that it's not backed up properly? I have 2 laptops which I back up with the same 1TB hard dr

  • Statutory Deductions

    Hi Experts, Please let me know what are the Statutory Deductions as per Indian Payroll and how there are calculated out side SAP and in SAP Thank you in Advance, Awaiting your reply, Hasini

  • JBO-29000: Unexpected exception caught: java.lang.StackOverflowError

    Hi Friends, I have built a custom OA Page using Master-Detail approach. When I launch/run the page it goes to the error page with following message. This is not consistence as some times it does work. We are not making any change, when it works.The c