Dynamic call of a vi with a reference stored in a global variable

Hello,
I am trying to program a VI which calls DAQmx functions in some cases, in other cases DAQmx may not even be installed. To prevent a broken arrow on machines where DAQmx is not installed, I want to use a sub-VI containing the DAQmx function calls which is called dynamically by a main VI. For speed I want to prevent continuous opening and closing the VI reference, so I want to store the reference to the sub VI in a global variable. In this variable I also want to store the Analog Input Task. I want to use an initialization VI to write the VI reference of the sub VI and to configure and start the Analog Input Task and write the Task ID to that Global, too. In that way I was hoping to be able to improve the performance of the dynamic calls and the Task calls. BUT - when I write the refererence and task to the Global and read it out from another VI, the reference is not valid anymore and the Analog Input task is also not valid, even if both the initialization VI and the Global are still open (but not running). Does somebody have an idea how to solve that? It is a bit difficult to describe, so here is what I want to do in a shorter description :
- run a initialization VI which
  defines a reference to a sub VI which will be called dynamically later on
  and a AI task ID definining a DAQmx physical channel configuration to use for subsequent read cycles
  and writes both (VI reference and AI task) to a global variable
- run another VI which
  reads the VI reference of the VI to call dynamically from that global
  runs the corresponding VI dynamically
  the dynamically called VI performs an AI task corresponding to the DAQmx task ID read from that global (it reads an analog value for instance from the  
  physical channel configured by that AI task) 
Why all that? To prevent creating and destroying the VI reference for each call of the sub VI for speed. And to use the configured DAQmx channel for subsequent read tasks only if the subVI is called dynamically - if it is not, then the application will not see the DAQmx calls and therefore no broken arrow will occur if no DAQmx is installed on the machine.
Can somebody help me with this? Why can't I store and read out the reference to the sub VI to/from a global, and why is the AI task not valid when read out from the dynamically called sub VI? I am somewhat lost with all that...
Thanks in advance,
Gabs

Uh - I am almost getting crazy with that
Kevin, that solution is the right one for programming an application. In that case everything will work fine. But during testing, it is more convenient to call all VIs from their front panels one after another. That's how I'm doing it for everything that needs to be exchanged between such VIs: store them either in a global or in a functional global variable. In that way the user can "play around" with the VIs without wiring them together in a main VI. Therefore, after some thinking I liked Davids idea with that daemon VI (I solved that by adding a boolean in the initialization VI to choose if that daemon is necessary - during testing phase - or not - when using the VIs in a main application). BUT:
David: It does not work!!! I have exactly done what you proposed and this daemon VI is really running, having a True/False frame with a constant of False wired to the selector and holding both the functional global and the dynamically to call VI in the True frame. In that way, after initialization is finished, both VIs are still running but idle. Anyway, when I read back the value of the reference or the DAQmx task, it is invalid again!
That really costs just too much time. Does anybody have any idea what to do now? David, I was hoping that your suggestion would solve the problem, because it would be logical that it would - why then is LabVIEW destroying the reference and task anyway even if that daemon VI containing the functional global is still running???
Regards,
Gabs

Similar Messages

  • Dynamically call a getter method with reflection?

    I have a page that prints out some report info, but only for the group of columns requested. What I need to do, based upon a String containing a column name that is passed in as input, is call that column's getter method dynamically...
    Does anyone have any good examples of doing this?
    Thanks,
    Mike

    Not sure if dynamic replacement of the property name works, but you could try
    <jsp:getProperty name="myBean" property="<%=request.getParameter("col1")%>"/>
    Where myBean is the name of your object and col1 is the name of your property, not the function name. So, if you have a function named getType(), then your variable is named type. So you would pass type as the property, like
    <jsp:getProperty name="myBean" property="type"/>
    This dynamically calls the getType() method on your object myBean.

  • The global variable panel has a menu item under OPERATE called REINITIALI​ZE ALL TO DEFAULT. How can all global variables be reinitiali​zed at to their default values at program startup?

    Each time I restart my application, I would like all global variables to be reset to their default values without having to reset each one individually. Can I do this? If so, how?

    Sure you can do it. Enclosed is a VI which checks all VIs in memory and reinitializes any that are of type Global VI.
    Attachments:
    Reinit_Globals.vi ‏22 KB

  • Calling a DLL in TestStand by reference

    All,
    I have developed a DLL that control's a USB based power supply. The dll call works from TestStand 4.1 most of the time. What I believe is happening is that each time I call the dll in my Main sequence file AS WELL AS other sequence files, that multiple instances of the dll are loaded.
    Part of the init of the power supply is to pass back a SESSION number, which is used in subsequent calls to the dll. I store it as a Global variable in TestStand and pass it around to what ever sequence needs it.
    How can I load the DLL at the start of the sequence and PASS a reference (Handle) to all additional calls to the dll?
    thanks in advance
    Carmine
    Solved!
    Go to Solution.

    I checked and found that I had a release and debug version that were both beig called. That is now corrected. (Thanks)
    Program still has the problem.
    The "proper dll" is called from my first sequence, but called again in other sequences that are in separate files. As you suggested I looked at the load and unload options>    I am not seeing an option that keeps the dll from unloading when the sub sequence file finishes and exits.
    Program Architecture is as follows:
    "Main File.seq" calls a "Child1.seq" to init a power supply and passes back a HANDLE, Now  "Main File.seq" AND "Child2.seq" make calls to the Power Supply using the HANDLE.
    Any additional help is welcome.
    Thanks in advance

  • How to assign local variable to global variable dynamically in adobe livecycle designer 7.1

    Hi All,
    i want to assign my textfield value to global variable dynamically.so that where ever i want , i will access my global variable.so it is possible in adobe livecycle designer 7.1. kindly suggest me method.Thanks in advance.
    Thanks & Regards
    Ganesh

    Please remove all adobe livecycle designer versions from your local pc.
    restart your pc to be sure, that all temp data is deleted.
    download the newest ald version from service.sap.com and install it.
    have fun with developing adobe forms with sap transaction sfp.

  • Adding tab to typedef tabcontrol causes class conflict with global variable

    Hi,
    I am quite new to labview. I have to update an existing program and I have a problem whith a tabcontrol. In attachement, I give you a very simple solution showing my problem.
    I have defined a simple tabControl in a typedef ctl. I had it to a VI and in block diagram of this VI, I want to fill a global variable with this control and this global variable is set as "Include Data Type".
    When creating my ctl file with a simple tabcontrol, there is no problem but my tabcontrol only contains 2 tabs. When I use "Add page after" in my ctl file to create a third one, after saving, I get a class conflict error on wire to global variable in my block diagram.
    If I remove added page, all is OK again. I don't understand why adding a new page causes a class conflict. In my attachement, it is very simple but in program that I have to modify, I already have 15 tabs and I just want to add a 16th one so, I am sure there is a mean, but impossible to fond it after many hours...
    If someone can tell me how to make my example works with "Include Data Type" (if I remove it, it always works but that is not what I want) and adding an additional tab, it would hemp me a lot!
    Thanks in advance.
    Yohann
    Attachments:
    test2.zip ‏11 KB

    The problem is that the tab is an enum, and you can't wire two strictly typed references of two different enums together, because they are considered different data types. What you can do is right click the reference control in the global variable and select Show Control, which will show the data type of the reference. You can then replace the control inside the reference with the typedef, which will cause it to update correctly.
    Although that will solve the problem, if you have the reference to a tab control in a global variable, you probably have some issues with your code, but that's not something which can be commented on without more details.
    Try to take over the world!

  • Dynamically called VI becomes broken inside an executable. Error 1003 from "Open VI Reference".

    Here's the problem. Dynamically called VI becomes broken inside an executable in debug executable mode Error 1003 is occuring from "Open VI Reference" Block. The computer has all of the necessary drivers, NI-VISA and NI-DAQmx. This executable is a new release of software that currently works on the PC in question. I can using NI-VISA Remote Server control the instruments from my PC using the executable. But when I put the executable on the PC I am getting this error. The only way I have been able to get this to work properly is to build the executable from the console I believe the project was created in, note that the project file has been moved to a network drive and it still works. All of the stations I have opened the project in show the VI that is being called is runnable. I've tried building the executable from the console I am deploying to and the same thing happens.
    I am honestly at a loss for ideas why this is occuring. Is this something about the way LabView works internally that may be causing this problem?
    I have trolled this forum for idea's and none have made sense to me.
    Any input would be greatly appreciated.
    -Nate

    Two ideas:
    Mass compile the project to ensure all linkages are ironed out
    Include the dynamically launched VI's into the "Always Included" section of the build spec
    Report back on if either of these actions solves your problem.
    a.lia-user-name-link[href="/t5/user/viewprofilepage/user-id/88938"] {color: black;} a.lia-user-name-link[href="/t5/user/viewprofilepage/user-id/88938"]:after {content: '';} .jrd-sig {height: 80px; overflow: visible;} .jrd-sig-deploy {float:left; opacity:0.2;} .jrd-sig-img {float:right; opacity:0.2;} .jrd-sig-img:hover {opacity:0.8;} .jrd-sig-deploy:hover {opacity:0.8;}

  • Dynamically call DBMS_XMLINDEX to drop parameter and exit with exception

    Hi All,
    I am trying to create a procedure to dynamically call DBMS_XMLINDEX.dropparameter.
    If the parameter does not exist then gracefully exit with exception as 'Parameter does not exist'.
    But I keep on getting errors due to dynamically passing.
    Procedure is something like:
    Create PROCEDURE drop_parameter(p_parameter IN VARCHAR2)
    IS
    no_parameter EXCEPTION;
    PRAGMA EXCEPTION_INIT(no_parameter,-12004);
    BEGIN
    EXECUTE IMMEDIATE 'DBMS_XMLINDEX.dropparameter( ''||p_parameter||'') ';
    dbms_output.put_line('Parameter dropped');
    EXCEPTION
    WHEN no_parameter THEN
    dbms_output.put_line('Parameter does not exist');
    END drop_parameter;
    For implementaion we can try creating parameter as :
    BEGIN
    DBMS_XMLINDEX.REGISTERPARAMETER (
    'Param1',
    'PATH TABLE PathTB1
    PATHS (INCLUDE ( /a/b/c
    /d/e/f
    END;
    The above parameter should be dropped or if not existing, then exit gracefully.
    Please suggest.
    Thanks...

    You're testing the wrong error code...
    ORA-12004 : http://docs.oracle.com/cd/E11882_01/server.112/e17766/e9858.htm#sthref3299
    Try with ORA-44737, for example :
    SQL> set serveroutput on
    SQL>
    SQL> BEGIN
      2  DBMS_XMLINDEX.REGISTERPARAMETER (
      3  'Param1', 'PATH TABLE PathTB1 PATHS (INCLUDE ( /a/b/c /d/e/f ))');
      4  END;
      5  /
    PL/SQL procedure successfully completed
    SQL>
    SQL> CREATE PROCEDURE drop_parameter(p_parameter IN VARCHAR2)
      2  IS
      3    no_parameter EXCEPTION;
      4    PRAGMA EXCEPTION_INIT(no_parameter,-44737);
      5  BEGIN
      6    DBMS_XMLINDEX.dropparameter(p_parameter);
      7    dbms_output.put_line('Parameter dropped');
      8  EXCEPTION
      9    WHEN no_parameter THEN
    10        dbms_output.put_line('Parameter does not exist');
    11  END;
    12  /
    Procedure created
    SQL> exec drop_parameter('Param1');
    Parameter dropped
    PL/SQL procedure successfully completed
    SQL> exec drop_parameter('Param1');
    Parameter does not exist
    PL/SQL procedure successfully completed
    (and again, you do not need dynamic code)

  • Dynamically calling sequences with different prototypes

    Hi,
    Is there a way of dynamically calling from one sequence call, two sequences with different prototypes?
    Thanks,
    krs

    I know that this is not really an answer to your question, but could you write some sort of wrapper to the different sequences that has a common interface and call it?
    Bob Young - Test Engineer - Lapsed Certified LabVIEW Developer
    DISTek Integration, Inc. - NI Alliance Member
    mailto:[email protected]

  • Dynamic CSV file name in target (Multiple workflow calling same dataflow with new global variable value)

    Hi their,
    I have multiple data flows doing 90% of the process same. The difference is in source query where clause and target flat file.
    I used the global variables to dynamically change the query where clause easily, but I need help in dynamically changing the target flat file (CSV file).
    What I want to do is have multiple workflows, which will first set the global variable to new value in the script box and then call the same data flow.
    Please let me know if you have any solution or any idea which might put me in the direction to my quest for solution.
    thank you,

    Hi Raj - in your content conversion for lineitem .. read the additional attribute as well.
    Change your source strcture and additional field company_code
    As you are already sending the filename for each line item using the UDF.. it's just you need to modify your UDF to take another input i.e. Company Code.
    or
    If your PI version is > 7.1 use the graphical variable to hold the filename..
    and while sending the company code information for every item just use the concat function to append filename & company code..
    http://scn.sap.com/people/william.li/blog/2008/02/13/sap-pi-71-mapping-enhancements-series-using-graphical-variable

  • Upgrade : Issue with Specical character being used in 4.6C ( Dynamic calls)

    Hi ,
      We are working on Upgrade from 4.6C to ECC6.0 . in SPAU phase we are facing an issue :
    When we are trying to see the variants from the program, it says that the program contains Syntax Error
    "In Unicode programs, the "&" character can not appear in names as it does here in the name 'op&xv0' "
    The 'op&xv0' is a form. we tried changing the form name, but couldnt get the PERFORM stmt for the form and it might be a dynamic call. what can we do for this type of programs?
    Please also suggest how we can identify the places where that particular Subroutine is being called.
    Thanks & Regds
    Teja

    This is probably an operation defined in Tcode PE04. You can change the operation subroutine name and then modify the code accordingly in the report.
    Go to PE04 and put in operation name, suposedly &xv0.
    Instead of using standard name suggested by SAP use custom name (for example opYvx0) and then change in the report as well and it should be ok.

  • Using dynamic VI referencing in combination with Application Builder

    Hi.
    In this thread (http://forums.ni.com/t5/LabVIEW/How-to-access-a-known-control-in-a-VI-reference/td-p/1255244) I attempted to modify our under development test system, so that we didn't have to change the same main VI for every test that we are adding, since we are several persons who'll be adding tests (i.e. conflicts would arise, that we would have to iron out manually every time).  The solution in the thread above works very well, by opening a reference to the test sub VI and calling the reference.  I then can pass data to the sub VI, and can get the test results from the sub VI.  Great!
    The problem came when running the program through the Application Builder.  The test system starts up fine, but the above method fails miserably, since the sub VI files are no longer there.  It seems that the sub VI's are not a part of the exe binary file coming from the Application Builder.
    So I'm drawing a blank here.  Does anyone have a suggestion on how to to this?  I'm only seeing the two options.  Either adding the sub VI's in the same main VI file, but then we have to be very careful on not getting conflicts (or fix the conflicts manually when they arise).  Or use the dynamic VI referencing, but then the system doesn't work with the Application Builder (which means that this method is out).  Is there a third method of doing this?

    Hi Mike.
    I use LabVIEW 2009.
    Well, I actually *can* use the dynamic call solution now.  The problem was that (1) the files weren't included in the exe file (fixed by adjusting the Application Builder settings), and (2) the Check if File or Folder Exist VI doesn't work if I try to check if the sub VI is present inside the exe file.  The solution here was basically to ommit the whole Check if File or Folder Exist VI, and just do an error check on the Open VI Reference VI.  The Open VI Reference VI will fail if trying to open a reference to a file that doesn't exist, so I just wired that to a case loop around the Call By Reference VI.

  • Unexpected delay when dynamically called VI closes

    LV10.0 / WXP
    A VI is called dynamically by Run VI Method (Wait Until Done = FALSE, Auto Dispose Ref = TRUE).
    Queues are used to exchange data with the main VI.
    When this VI closes ("stop" message from the main VI), LabVIEW hangs for about 25 seconds (!) with one of the CPUs of the dual core machine at 100%.
    Has anyone else encountered this strange behaviour ? Any ideas ?
    Many thanks in advance
    Solved!
    Go to Solution.

    Norbert B a écrit :
    Can you give us a small picture of the way you are calling and releasing the subVIs?
    As mentionned in my first message : Run VI Method (Wait Until Done = FALSE, Auto Dispose Ref = TRUE) is used to call the VIs.
    Release : after reception of a "close" message (queue), the dynamic VIs terminate their execution
    If called with Auto Dispose Ref = FALSE, the freeze appears when Close Reference is executed in the calling VI (after reception of a "I'm closing" message from the dynamic called VI).
    If loading the VI takes only a short time but unloading takes long, it seems to me that those subVIs allocate many new handles/memory spaces during runtime. Is that the case?
    As mentionned in a previous message : The memory usage changes from about 687 to 676 MB when the four
    instances are closed. The number of handles decreases from about 272k to
    61k.
    This sounds like the whole application freezes for the time being. Is it a single loop architecture?
    No. It is a rather big application with several VIs running independently and exchanging data through queues.
    In addition: You call those subVIs dynamical with reentrant execution (at least some of them). So they should run in parallel.
    Yes, they run in parallel.
    Did you configure different preferred execution systems for your different subVIs?
    Yes, I have tried several combinations and also changed the Priority. I also tried to replace the While Loop of the VI which communicates with the PLC by a Timed Loop in order to specify the processor. Unfortunately all my trials ended without any succes.
    Did you check for reference leaks using the Execution Trace Toolkit?
    Yes. There are none.
    Norbert
    Thank you very much for your help

  • Dynamical Call of ALV - No data update

    Hi,
    I tried to use use the ALV dynamically. With dynamically I mean that I that I have diffrent data structures, depending what was selected by the user. The first call of the program is always correct. The data is displayed correctly. But when the data structure is changing, the ALV display is not updated.  For a better understanding I post a extract of my coding:
    <b>1. Creation of Container</b>
    CREATE OBJECT g_custom_container
        EXPORTING              
          container_name              = 'PARENT_CONT'
        EXCEPTIONS
          cntl_error                  = 1
          cntl_system_error           = 2
          create_error                = 3
          lifetime_error              = 4
          lifetime_dynpro_dynpro_link = 5.
      IF sy-subrc <> 0.
        ASSERT 1 = 2.
      ENDIF.
    <b>2.Creation of splitter container</b>
      CREATE OBJECT splitter
         EXPORTING
           parent            = g_custom_container
           rows              = 2
           columns           = 2
        EXCEPTIONS
          cntl_error        = 1
          cntl_system_error = 2
          OTHERS            = 3.
      IF sy-subrc <> 0.
        ASSERT 1 = 2.
      ENDIF.
    container_2 = splitter->get_container(
                                row       = 1
                                column    = 2 ).
    <b>3.Dynamic Creation of alv object</b>
      CREATE OBJECT go_grid
        EXPORTING
          i_parent = container_2.
    <b>4. Get Fieldcatalogue</b>
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name       = lv_structure_name
        CHANGING
          ct_fieldcat            = lt_fieldcat
        EXCEPTIONS
          inconsistent_interface = 1
          program_error          = 2
          OTHERS                 = 3.
      IF sy-subrc <> 0.
        ASSERT 1 = 2.
      ENDIF.
    <b>5. Set table for first display</b>
      CALL METHOD go_grid->set_table_for_first_display
    *    EXPORTING
    *      i_structure_name = lv_structure_name
        CHANGING
          it_fieldcatalog  = lt_fieldcat
          it_outtab        = <lt_out_data>.
      CALL METHOD ls_alv_ref-alv_ref->refresh_table_display.
      CALL METHOD cl_gui_cfw=>flush.
    Perhaps someone could help.....
    Best Regards, Edgar

    Hello Edgar
    The following sample report <b>ZUS_SDN_TWO_ALV_GRIDS_8</b> shows how to solve your problem. Please note that for the sake of simplicity I replaced the tree containing the structure names with an ALV list. However, the switch between the different structures is triggered by the <b>DOUBLE_CLICK</b> event.
    I like to add that the integration of the first displayed ALV list (DD02L) into GT_OUTTAB is not really elegant. In addition, with <b>$TMP</b> I marked a problematic part of the coding with respect to your requirement to have the right layout for each displayed ALV list:
    If you have a <b>fixed </b>assignment of <i>tabname -> 4-digit handle</i> then it is ok. I my sample report the layouts only work if you select the tabnames in the very same order.
    Before showing the entire coding I describe crucial parts of the coding:
    [code]TYPES: BEGIN OF ty_s_outtab.
    TYPES: tabname    TYPE tabname.
    TYPES: layout     TYPE lvc_s_layo.
    TYPES: variant    TYPE disvariant.
    TYPES: fcat       TYPE lvc_t_fcat.
    TYPES: data       TYPE REF TO data.
    TYPES: END OF ty_s_outtab.[/code]
    Every time a new structure is selected the corresponding ALV data are stored as new record in GT_OUTTAB which is of line type TY_S_OUTTAB.
    [code]  READ TABLE gt_outtab INTO gs_outtab INDEX 2.
      ASSIGN gs_outtab-fcat    TO <gt_fcat>.
      ASSIGN gs_outtab-data->* TO <gt_outtab>.[/code]
    Since the ALV list data and the fieldcatalog are fully dynamic I use global field-symbols for these data.
    [code]&----
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'STATUS_0100'.  " contains push button "DETAIL"
    SET TITLEBAR 'xxx'.
      CALL METHOD go_grid2->set_table_for_first_display
        EXPORTING
          i_structure_name = gs_outtab-tabname
          is_layout        = gs_outtab-layout
          is_variant       = gs_outtab-variant
          i_save           = 'A'
        CHANGING
          it_outtab        = <gt_outtab>
          it_fieldcatalog  = <gt_fcat>
        EXCEPTIONS
          OTHERS           = 4.
      IF sy-subrc <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDMODULE.                 " STATUS_0100  OUTPUT[/code]
    The second ALV list which displays the table records is always newly displayed in the PBO module.
    In the event handler method <b>HANDLE_DOUBLE_CLICK</b> we need to do two things:
    - store the current fieldcatalog back to GT_OUTTAB
    - store the name of the new selected table/structure -> trigger PAI
    In routine <b>HANDLE_DB_CLICK</b> we create a new entry for GT_OUTTAB if it does not yet exist. Next we select this entry and display it again as second ALV list.
    [code]
    *& Report  ZUS_SDN_TWO_ALV_GRIDS_8
    *& Description: Display two ALV lists in splitter container (left/right)
    *&              Left ALV list contains DB table names,
    *& right ALV list displays entries of selected DB table
    *& SDN thread: Dynamical Call of ALV - No data update
    *&       Link: https:||Dynamical Call of ALV - No data update
    *& Screen '0100' contains no elements.
    *& ok_code -> assigned to GD_OKCODE
    *& Flow logic:
    PROCESS BEFORE OUTPUT.
       MODULE STATUS_0100.
    PROCESS AFTER INPUT.
       MODULE USER_COMMAND_0100.
    REPORT  zus_sdn_two_alv_grids_8.
    TYPE-POOLS: abap.
    DATA:
      gd_repid         TYPE syst-repid,
      gd_okcode        TYPE ui_func,
      go_docking       TYPE REF TO cl_gui_docking_container,
      go_splitter      TYPE REF TO cl_gui_splitter_container,
      go_cell_left     TYPE REF TO cl_gui_container,
      go_cell_right    TYPE REF TO cl_gui_container,
      go_grid1         TYPE REF TO cl_gui_alv_grid,
      go_grid2         TYPE REF TO cl_gui_alv_grid,
      gs_layout        TYPE lvc_s_layo.
    TYPES: BEGIN OF ty_s_outtab.
    TYPES: tabname    TYPE tabname.
    TYPES: layout     TYPE lvc_s_layo.
    TYPES: variant    TYPE disvariant.
    TYPES: fcat       TYPE lvc_t_fcat.
    TYPES: data       TYPE REF TO data.
    TYPES: END OF ty_s_outtab.
    TYPES: ty_t_outtab  TYPE STANDARD TABLE OF ty_s_outtab
                        WITH DEFAULT KEY.
    DATA:
      gt_dd02l         TYPE STANDARD TABLE OF dd02l,
      gs_outtab        TYPE ty_s_outtab,
      gt_outtab        TYPE ty_t_outtab.
    FIELD-SYMBOLS:
      <gt_fcat>        TYPE lvc_t_fcat,
      <gt_outtab>      TYPE table.
          CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
      PUBLIC SECTION.
        CLASS-DATA:
          md_tabname_selected  TYPE tabname  READ-ONLY.
        CLASS-METHODS:
          handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
            IMPORTING
              e_row
              e_column
              es_row_no
              sender.
    ENDCLASS.                    "lcl_eventhandler DEFINITION
          CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
      METHOD handle_double_click.
      define local data
        DATA:
          ls_dd02l       TYPE dd02l,
          ls_outtab      TYPE ty_s_outtab.
        CHECK ( sender = go_grid1 ).
        READ TABLE gt_dd02l INTO ls_dd02l INDEX e_row-index.
        "   Store data of currently displayed ALV list (except for DD02L)
        IF ( md_tabname_selected = space ).
        ELSE.
          READ TABLE gt_outtab INTO ls_outtab
               WITH KEY tabname = md_tabname_selected.  " old
          CALL METHOD go_grid2->get_frontend_fieldcatalog
            IMPORTING
              et_fieldcatalog = ls_outtab-fcat.
          MODIFY gt_outtab FROM ls_outtab INDEX syst-tabix.
        ENDIF.
        md_tabname_selected = ls_dd02l-tabname.  " new selected DB table
      Triggers PAI of the dynpro with the specified ok-code
       cl_gui_cfw=>set_new_ok_code( 'HANDLE_DB_CLICK' ).  " not 4.6c
        CALL METHOD cl_gui_cfw=>set_new_ok_code
          EXPORTING
            new_code = 'HANDLE_DB_CLICK'
         IMPORTING
           RC       =
      ENDMETHOD.                    "handle_double_click
    ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
    START-OF-SELECTION.
      gd_repid = syst-repid.
      SELECT        * FROM  dd02l INTO TABLE gt_dd02l
             WHERE  tabname LIKE 'KN%1'   OR
                    tabname LIKE 'LF%1'   OR
                    tabname LIKE 'VB%'   OR
                    tabname LIKE 'MAR%'   OR
                    tabname LIKE 'E07%'
             AND    tabclass = 'TRANSP'.  " transparent table
      SORT gt_dd02l BY tabname.
      PERFORM init_controls.
      PERFORM add_first_table.
    Set event handler
      SET HANDLER:
        lcl_eventhandler=>handle_double_click FOR go_grid1.
      READ TABLE gt_outtab INTO gs_outtab INDEX 1.
    Display data
      CALL METHOD go_grid1->set_table_for_first_display
        EXPORTING
          i_structure_name = gs_outtab-tabname
          is_layout        = gs_outtab-layout
        CHANGING
          it_outtab        = gt_dd02l
        EXCEPTIONS
          OTHERS           = 4.
      IF sy-subrc <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      READ TABLE gt_outtab INTO gs_outtab INDEX 2.
      ASSIGN gs_outtab-fcat    TO <gt_fcat>.
      ASSIGN gs_outtab-data->* TO <gt_outtab>.
    NOTE: method called in PBO module
    CALL METHOD go_grid2->set_table_for_first_display
       EXPORTING
         i_structure_name = gs_outtab-tabname
         is_layout        = gs_outtab-layout
         is_variant       = gs_outtab-variant
         i_save           = 'A'
       CHANGING
         it_outtab        = <gt_outtab>
         it_fieldcatalog  = <gt_fcat>
       EXCEPTIONS
         OTHERS           = 4.
    IF sy-subrc <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Link the docking container to the target dynpro
      CALL METHOD go_docking->link
        EXPORTING
          repid                       = gd_repid
          dynnr                       = '0100'
         CONTAINER                   =
        EXCEPTIONS
          OTHERS                      = 4.
      IF sy-subrc <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    NOTE: dynpro does not contain any elements
      CALL SCREEN '0100'.
    Flow logic of dynpro (does not contain any dynpro elements):
    *PROCESS BEFORE OUTPUT.
    MODULE STATUS_0100.
    *PROCESS AFTER INPUT.
    MODULE USER_COMMAND_0100.
    END-OF-SELECTION.
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'STATUS_0100'.  " contains push button "DETAIL"
    SET TITLEBAR 'xxx'.
      CALL METHOD go_grid2->set_table_for_first_display
        EXPORTING
          i_structure_name = gs_outtab-tabname
          is_layout        = gs_outtab-layout
          is_variant       = gs_outtab-variant
          i_save           = 'A'
        CHANGING
          it_outtab        = <gt_outtab>
          it_fieldcatalog  = <gt_fcat>
        EXCEPTIONS
          OTHERS           = 4.
      IF sy-subrc <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE user_command_0100 INPUT.
      CASE gd_okcode.
        WHEN 'BACK' OR
             'END'  OR
             'CANC'.
          SET SCREEN 0. LEAVE SCREEN.
      User has pushed button "Display Details"
        WHEN 'HANDLE_DB_CLICK'.
          PERFORM handle_db_click.
        WHEN OTHERS.
      ENDCASE.
      CLEAR: gd_okcode.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  HANDLE_DB_CLICK
          text
    -->  p1        text
    <--  p2        text
    FORM handle_db_click.
    define local data
      DATA:
        ld_handle(4) TYPE n,
        ls_outtab    TYPE ty_s_outtab.
      READ TABLE gt_outtab INTO ls_outtab
           WITH KEY tabname = lcl_eventhandler=>md_tabname_selected.
      IF ( syst-subrc NE 0 ).
        CLEAR: ls_outtab.
        ls_outtab-tabname = lcl_eventhandler=>md_tabname_selected.
        CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
        I_BUFFER_ACTIVE              =
          i_structure_name             = ls_outtab-tabname
        I_CLIENT_NEVER_DISPLAY       = 'X'
        I_BYPASSING_BUFFER           =
        I_INTERNAL_TABNAME           =
        CHANGING
          ct_fieldcat                  = ls_outtab-fcat
        EXCEPTIONS
          inconsistent_interface       = 1
          program_error                = 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.
        CREATE DATA ls_outtab-data TYPE TABLE OF (ls_outtab-tabname).
        ASSIGN ls_outtab-data->* TO <gt_outtab>.
        SELECT * FROM (ls_outtab-tabname) UP TO 50 ROWS
          INTO TABLE <gt_outtab>.
        ls_outtab-layout-no_toolbar = abap_false.
        ls_outtab-layout-zebra      = abap_true.
        ls_outtab-layout-smalltitle = abap_true.
        CONCATENATE ls_outtab-tabname ':'
          INTO ls_outtab-layout-grid_title.
        CONCATENATE ls_outtab-layout-grid_title 'Table Records'
          INTO ls_outtab-layout-grid_title
          SEPARATED BY space.
        ls_outtab-variant-report    = gd_repid.
        DESCRIBE TABLE gt_outtab.
        ld_handle = syst-tfill + 1.
        WRITE ld_handle TO ls_outtab-variant-handle.  " $TMP: Problem!!!
        APPEND ls_outtab TO gt_outtab.
      ENDIF.
      " NOTE: read into GLOBAL variable gs_outtab !!!!
      READ TABLE gt_outtab INTO gs_outtab
            WITH KEY tabname = lcl_eventhandler=>md_tabname_selected.
      ASSIGN gs_outtab-fcat    TO <gt_fcat>.
      ASSIGN gs_outtab-data->* TO <gt_outtab>.
    ENDFORM.                    " HANDLE_DB_CLICK
    *&      Form  INIT_CONTROLS
          text
    -->  p1        text
    <--  p2        text
    FORM init_controls .
    Create docking container
      CREATE OBJECT go_docking
        EXPORTING
          parent                      = cl_gui_container=>screen0
          ratio                       = 90
        EXCEPTIONS
          OTHERS                      = 6.
      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 METHOD go_docking->set_extension
        EXPORTING
          extension  = 99999 " full-size screen
        EXCEPTIONS
          cntl_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.
    Create splitter container
      CREATE OBJECT go_splitter
        EXPORTING
          parent            = go_docking
          rows              = 1
          columns           = 2
         NO_AUTODEF_PROGID_DYNNR =
         NAME              =
        EXCEPTIONS
          cntl_error        = 1
          cntl_system_error = 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.
    Get cell container
      CALL METHOD go_splitter->get_container
        EXPORTING
          row       = 1
          column    = 1
        RECEIVING
          container = go_cell_left.
      CALL METHOD go_splitter->get_container
        EXPORTING
          row       = 1
          column    = 2
        RECEIVING
          container = go_cell_right.
      CALL METHOD go_splitter->set_column_mode
        EXPORTING
          mode              = cl_gui_splitter_container=>mode_relative
       IMPORTING
         RESULT            =
        EXCEPTIONS
          cntl_error        = 1
          cntl_system_error = 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 METHOD go_splitter->set_column_width
        EXPORTING
          id                = 1
          width             = 25
       IMPORTING
         RESULT            =
        EXCEPTIONS
          cntl_error        = 1
          cntl_system_error = 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 METHOD go_splitter->set_column_sash
        EXPORTING
          id                = 1
          type              = cl_gui_splitter_container=>type_movable
          value             = cl_gui_splitter_container=>false
       IMPORTING
         RESULT            =
        EXCEPTIONS
          cntl_error        = 1
          cntl_system_error = 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.
    Create ALV grids
      CREATE OBJECT go_grid1
        EXPORTING
          i_parent          = go_cell_left
        EXCEPTIONS
          OTHERS            = 5.
      IF sy-subrc <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CREATE OBJECT go_grid2
        EXPORTING
          i_parent          = go_cell_right
        EXCEPTIONS
          OTHERS            = 5.
      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.                    " INIT_CONTROLS
    *&      Form  ADD_FIRST_TABLE
          text
    -->  p1        text
    <--  p2        text
    FORM add_first_table .
    define local data
      DATA:
        ls_outtab    TYPE ty_s_outtab.
      ls_outtab-tabname = 'DD02L'.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
      EXPORTING
      I_BUFFER_ACTIVE              =
        i_structure_name             = ls_outtab-tabname
      I_CLIENT_NEVER_DISPLAY       = 'X'
      I_BYPASSING_BUFFER           =
      I_INTERNAL_TABNAME           =
      CHANGING
        ct_fieldcat                  = ls_outtab-fcat
      EXCEPTIONS
        inconsistent_interface       = 1
        program_error                = 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.
      GET REFERENCE OF gt_dd02l INTO ls_outtab-data.
      ls_outtab-layout-no_toolbar = abap_false.
      ls_outtab-layout-zebra      = abap_true.
      ls_outtab-layout-smalltitle = abap_true.
      CONCATENATE ls_outtab-tabname ':'
        INTO ls_outtab-layout-grid_title.
      CONCATENATE ls_outtab-layout-grid_title 'Table Records'
        INTO ls_outtab-layout-grid_title
        SEPARATED BY space.
      ls_outtab-variant-report    = gd_repid.
      ls_outtab-variant-handle    = '0002'.
      INSERT ls_outtab INTO gt_outtab INDEX 1.
      ls_outtab-layout-no_toolbar = abap_true.
    ls_outtab-layout-zebra      = abap_true.
    ls_outtab-layout-smalltitle = abap_true.
      ls_outtab-layout-grid_title = 'DB Tables'.
    ls_outtab-variant-report    = gd_repid.
      ls_outtab-variant-handle    = '0001'.
      DELETE ls_outtab-fcat WHERE ( fieldname NE 'TABNAME' ).
      INSERT ls_outtab INTO gt_outtab INDEX 1.
    ENDFORM.                    " ADD_FIRST_TABLE[/code]
    Regards,
      Uwe

  • Access violation (0xC0000005) at EIP=0x012B60E6 within a dynamically called VI

    Hi
    I have been seeing Access violation (0xC0000005) at EIP=0x012B60E6 within a dynamically called VI.
    The VI is called by reference and is strictly typed.
    The VI controls a function generator, a robot and a microcontroller device.
    All of the above are synchronised using functional globals.
    If I let the code run the FG will operate so I know the top level dynamic VI has defiantly been called and successfully entered, however within that VI as other VI’s are called (there are many) LV crashes with access violation.
    The VI's within the top level VI are using HiD communicatiuoins over USB with the peripheral instrumants.
    The LV crashes are totally random and sometimes the code will operate until the end and close down successfully.
    I can only seem to guarantee smooth operation if I set a breakpoint within the top level VI, then the entire system runs perfectly.
    In fact it seems that even if I remove the breakpoint (after the first break) and close the VI the system will continue to run until close.
    Has anyone any ideas? I have run out!

    Hi MAC1,
    I have been looking at your issue and wanted to ask if you are calling the VI's into Teststand, using the LabVIEW adapter?
    If this is the case, it may be worth looking at another forum post regarding the issue.
    LabVIEW Access Violations- Teststand
    I am currently looking into what could have caused this access violation. 
    If you could provide any further information in regards to the top level VI or if you could post it on here, that would be really useful.
    Regards,
    Dom C

Maybe you are looking for

  • DynamicParameters doesn't transfer from iView

    Dear experts. I had create iView for the Webdynpro ABAP application. I had created url to iView throwout the pcd at the end of url I had wrote ?DynamicParameter=sap-language%3DEN%26ztype%3DE. Navigation is worked perfectly but it is impssible to extr

  • ITunes freezes whilst trying to download duplicate episodes

    I use home sharing. On one PC (not the PC i used to purchase the episodes) there are 2 episodes of a TV series that have already downloaded but have duplicates in the library which have not downloaded.  iTunes is trying to download these duplicates. 

  • Indesign Problem CS2

    Hallo, ich habe ein Problem mit Adobe InDesign. Folgendes Szenario. Wir hatte auf einen File Server (Windows Server 2003) ein Share. Dort abgelegt waren Adobe InDesign Dateien. Die Kollegen hatten in Ihrem Arbeitsplatz (Windows XP) ein Share gemappt

  • Logic Express 9 Crashes after Snow Leopard Upgrade from Tiger

    I just upgraded from Tiger to Snow Leopard. I have yet to install iLife, though I have it. I have installed Logic Express. Everytime I attempt to pull it up, it crashes with some sort of kern protection failue. Can anyone advise me?

  • MSI k9n2 sli platinum - drivers for xp64???

    Ok, I bought the MSI K9N2 Platinum SLI 750a motherboard and it has been nothing but trouble since day one. First, I tried installing various linux distros on it, none of them worked, but I expected that, so it's not really a big deal. Second, I insta