Excel Get ActiveX References​.vi and closing references -- grrr

I'm new to ActiveX stuff, but eager to learn! 
The "grrr" in my Subject line is a reference to how I feel about LabVIEW's documentation from time to time.  I'm a dinosaur who came from text-based programming, and did a fair amount of C coding, so sometimes with LabVIEW I'm left with this awful feeling in the pit of my stomach like, "Good grief!  How much memory must LabVIEW be hogging up in the background when I use this vi?" or "What happens to those variables (wires) in that subVI when it completes but doesn't close?  What are their statuses when I come back in the next time?" or "What if I put a lot of elements into that array the first time and then started from element zero the second time and just put in a few?  What has happened with the memroy that was allocated when there were a lot of elements?"
Today I'm stewing about this "Excel Get ActiveX References.vi," and what happens to the "ActiveX references" it generates each time I call the subVI in which "Excel Get ActiveX References.vi" lives.  I think that at least one of the "ActiveX references" it generates when I call it is of the type Excel._Application.  Then there appears to be an Excel._Workbook, and others.  You see, I've used "Excel Easy Report.vi" to put some data into an Excel spreadsheet, and I want to tell Excel to do a "Save" on the open spreadsheet.  I think ActiveX is the (a) right way to do that, so I'm wading into the ActiveX fray...  But this "Excel Get ActiveX References.vi" says in its help file, "Do not close ActiveX references opened with the Excel Get ActiveX References VI. References must remain open until the report is closed. Otherwise the error 3001 will occur."  Well, these Excel workbooks that get created by my VI could well stay open until after my LabVIEW VI terminates!
So (finally), here are some of my quesitons:
1)  When I go through my subVI once, pointing to one workbook, I'll get one set of references "created" or "opened" or whatever you call it when ActiveX references spring into existance.  Now, when I exit the subVI, is it going to automatically try to "close" those ActiveX references?  I don't suppose so, since subVI's stay in memory until the calling VI closes.
2)  Now, I come back into my subVI a second time.  New workbook gets created, so I get new references.  Ok, fine.  Uh oh!  What happened to those old references?  I suppose that if I didn't somehow save them off, I've probably lost the ability to get them back (maybe I'm wrong, but I don't need them back), but is LabVIEW going to "close" those old references (from previous times through the subVI) because I can't get to them anymore?  Won't that cause the dreaded error 3001?  If LabVIEW is not going to "close" them, what in tarnation happens to them (the old C programmer in me creeping back out)??  Now it's some oddball, orphaned reference, floating out there, hogging memory, waiting to make something crash intermittently and be a debugging nightmare?
3)  Now, here's the real scary one.  I think I might dodge the "error 3001" bullet in questions 1) and 2), but now let's say the user closes my LabVIEW application while Excel is still open.  All those workbooks are still open.  Presumably, all those ActiveX references I was not supposed to close are still open.  I really hope that LabVIEW is decent enough to close/erase/delete/blow-away (whatever the right word is) all those ActiveX references which were opened/created by "Excel Get ActiveX References.vi" when my program terminates.  But, oh no!  Won't the error 3001 come along then?  I suppose I can just dump it in the shutdown error handling.
Well, thanks for reading my novel.  I don't know what can be done with LabVIEW documentation to make it more satisfying to folks like me, but perhaps someone can weigh in on all my ActiveX questions here.
Thank you in advance,
Steve Brady
Solved!
Go to Solution.

You need to close EVERY ActiveX reference you open.  If you don't you'll end up with some Excel processes running even after LabVIEW exits.  You can see them in Task Manager.
I, personally, don't like the LabVIEW Report Generation Tool Kit for working with Excel.  I don't think it's flexible enough.  I have a growing library of VIs that I've written that open, manipulate, and close Excel.  Some references I pass from VI to VI and some I close right after I use them.  It all depends on what I'm doing.  If I want to enter read or write data from/to a certain range I'll get the range reference, read or write the data, then close it right away because I have no use for it any more.  On the other hand, when I open Excel or a Workbook I keep the reference until I'm done, which could be later in the program.
1)  When I go through my subVI once, pointing to one workbook, I'll get one set of references "created" or "opened" or whatever you call it when ActiveX references spring into existence.  Now, when I exit the subVI, is it going to automatically try to "close" those ActiveX references?  I don't suppose so, since subVI's stay in memory until the calling VI closes.
2)  Now, I come back into my subVI a second time.  New workbook gets created, so I get new references.  Ok, fine.  Uh oh!  What happened to those old references?  I suppose that if I didn't somehow save them off, I've probably lost the ability to get them back (maybe I'm wrong, but I don't need them back), but is LabVIEW going to "close" those old references (from previous times through the subVI) because I can't get to them anymore?  Won't that cause the dreaded error 3001?  If LabVIEW is not going to "close" them, what in tarnation happens to them (the old C programmer in me creeping back out)??  Now it's some oddball, orphaned reference, floating out there, hogging memory, waiting to make something crash intermittently and be a debugging nightmare?
3)  Now, here's the real scary one.  I think I might dodge the "error 3001" bullet in questions 1) and 2), but now let's say the user closes my LabVIEW application while Excel is still open.  All those workbooks are still open.  Presumably, all those ActiveX references I was not supposed to close are still open.  I really hope that LabVIEW is decent enough to close/erase/delete/blow-away (whatever the right word is) all those ActiveX references which were opened/created by "Excel Get ActiveX References.vi" when my program terminates.  But, oh no!  Won't the error 3001 come along then?  I suppose I can just dump it in the shutdown error handling.
1)  No, LabVIEW will NOT close those references.  You need to make sure that happens.
2)  You can save the references in a functional global or use a class but if you're not going to save them close them as soon as you're done with them.
3)  Your user should not be able to close your LabVIEW application without it going through the shutdown routine you've created for your program.  The ABORT button should never be exposed to the user and you should capture and discard the panel close event so your program ALWAYS shuts down is an orderly fashion.  If you don't you will have fragments of Excel hanging around in your operating system and will have to kill those processes using Task Manager.  That should only be a problem during development, not once deployed.
I used to program in C and Assembly many moons ago.  You should have seen my first LabVIEW code.  I go back and look at it just so I can see how far I've come in the last 12 years.  I feel your pain.
Kelly Bersch
Certified LabVIEW Developer
Kudos are always welcome

Similar Messages

  • XREF1(Reference Key1) and XREF2(Reference Key2) in FBl5N report

    what is the significance of XREF1(Reference Key1) and XREF2(Reference Key2) in FBl5N report. In my report I can see profit center being populated in most of the Reference Key2 values. But in some they are missing. So I want to know the significance of them, and how they are mapped. Please help me out.

    Hi Prasana
    As per your issue 1st you have maintain the required entry in filed status group level as well as at posting key level in the General TAB and select Reference specification 1/2 as a require entry after that you have to MAP in the T code OB32 at account type level
    Eg:  D        BSEG-XREF1        Reference key 1
           D        BSEG-XREF2        Reference key 2
          S      BSEG-XREF1           Reference key 1
          S      BSEG-XREF2           Reference key 2
          S      BSEG-XREF3           Reference key 3
    Like above based your requirement you have to maintain
    - Document change rules line item (TC: OB32)
    - Posting key (TC: OB41)
    - Field status groups (SPRO -> FI -> FI Global settings -> Ledgers -> Fields -> Define field status variants)
    - Special field display (SPRO -> FI -> GL Accounting -> Master Data -> GL Accounts -> Line items -> Define Special Fields for Line item display)
    - Doccument change rules header (SPRO -> FI -> FI Global settings -> Document -> Rules for changing documents -> Document change rules, document header)
    After that while you posting  any transaction data you have to enter reference key1 and 2 filed at more data Tab  where you can see  at header level tabs
    Finally  you can able see in the FBL5N report...same case we have faced previously it was resolved
    I hope it will helps you
    Thanks and Regards
    sudharshana vamsi

  • How to avoid Invoice Split due to billing date, reference number and payment reference?

    Hi,
    In a scenario of delivery to invoice copying, we are facing issue of invoice split.
    After analysing split, came to know that split happened because of different billing date, reference number and payment reference.
    In VTFL we kept below fields blank at header level:
    Assignment Number
    Reference number
    In VTFL we kept below setting at item level:
    Copying requirements: 001 (this is a del related Pro-forma invoice)
    Data VBRK/VBRP: 001 (Inv.split (sample))
    Also in VF04, at "default" tab maintained billing date, but still system is splitting invoice.
    Split analysis showing below results
    Different billing date
    Different reference number and
    Different payment reference
    Pls let me know how to avoind this split. Do we have to copy routine and do changes into it to avoid split.
    Regards/Pravin

    Hello,
    Also in VF04, at "default" tab maintained billing date, but still system is splitting invoice.
    Split analysis showing below results
    Different billing date
    Different reference number and
    Different payment reference
    this doesn't seem to me standard behaviour (as it regards the billing date). Try the same with VF01: enter manually the billing date, the documents to invoice and press "Billing document overview";  if it keep on splitting according to the billing date, I guess that there's a user-exit during the creation of the invoice, which determines the invoicing date.
    Check the following exit:
    RV60AFZA
    RV60AFZC
    RV60AFZZ
    Best regards,
    Andrea

  • From Reference Step and To Reference Step

    When you use the fields : From Reference Step and To Reference Step in the pricing procedure how can I now in which cases the conditions will be added or multiplied so that I can avoid using subrutines ?
    For example:
    step 100---Z001   100
    step 101---Z002   2
    Z003 (VK11 maintaned with percentage 2.5% ) from = 100 to = 101
    result Z003 = (100 + 2 ) * 2.5
    Kind Regards.

    Hi David,
    Which conditions to be added comes from the business requirement. with the help of 'from-to' step i think you cant multiply the condition types.
    how can I now in which cases the conditions will be added .
    Suppose:
    100     0     PR00     Price
    200     0     JMAN     Manual Excise     100     190
    300     0     UTXJ     Tax Jurisdict.Code     100     190
    350     0     JMOD     A/R Basic Excise     200
    375     0          Base Prices     100     190
    400     0     JEX2     A/R Basic Excise     350
    450     0     JAED     A/R Add. Excise duty     100     190
    475     0          Base prices + BED     375     400
    500     0     JEXA     A/R AED     450
    520     0     JSED     A/R Special Exc.duty     100     190
    525     0          Base Price + BED + AED     475     500
    540     0     JEXS     A/R sED     520
    550     0     JCES     A/R Cess     100     190
    575     0          Base Price BEDAED+SED     525     540
    If you analyse the example, for calculating JMAN/UTXJ 100-190, all the prices/discounts would be added up.The base prices/discounts and excise duties are all added up to calculate sales taxes such as CST?VAT.
    regards
    prasad

  • IS-Retail:reference site and MC reference artricle

    Hi experts,
                    How to create reference site,merchandise category reference article,reference article?and also tell me the t-codes to create them.Thanks in advance
    Regards
    krish

    Hello Krish in SAP Retail there´s no special transaction for the creation of a refference site. A refference site can be an existing site. It´s recomended to mantain a refference site (Which is not an actual store) for each distribution chain.
    The data copied from the refference site to the new one includes:
    General site data (Org. data, company code, Purch. Org., Sales Org., etc).
    Valuation/Inventory Management.
    Listing.
    Requirements planning.
    Distribution.
    POS interface.
    Layouts.
    Regards,
    Juan Carlos

  • Issues with getting to side displays and closing apps

    Maybe someone else has had a similar problem or can help advise:
    I am on a Windows 8.1 Asus Laptop with a second monitor.  
    Up until about a week or two ago other than some resolution issues (assume may be my video card) all was ok with Windows 8 and 8.1 update and I was liking the new functionality (like anything new may take a few min, but once you know how things work all
    is good).
    My problem is the following: starting about 2 weeks ago and is only with my main monitor (My secondary monitor works exactly like it should)
    - I can now no longer close apps by clicking and dragging at the top of the screen.  Now I need to get to the X button however, I can not get to that X button without clicking on another application which I can only due going to my second screen.  I
    have tried going to the top right corner, clicking, holding, ect the top bar does not show up
    - On my Laptop's main monitor I can no longer get the side Start bars to show up (one on the left shows open apps, the one on the right has the search, Share, Start, settings, ect).  
    Did Microsoft change something in an update that could have caused this issue?
    Is anyone else having this same issue?
    Any clue why functionality would work on my secondary monitor and not my primary monitor?
    Any suggestions or even key shortcuts that I can use to get to these necessary bars without the mouse that I can use till issue is resolved?
    Thank you.

    in the case of the AMD catalyst that i have myself you can try detect displays whenever catalyst is opened and also disable itc processing to give your Microsoft certified drivers quality control.
    Nvidea has similar options but it is important to know the more you change on the windows options level and driver levels can lead to many issues with a limited understanding.

  • Reference partitioning and partition pruning

    Hi All,
    I am on v 11.2.0.3.
    I have a pair of typical parent-child tables. Child table is growing like hell, hence we want to partition it, which will be used for deleting/dropping old data later on.
    There is no partitioning key in the child table which I can use for relating the data to the time when data was created. So, I thought I can use the timestamp from parent table for partitioning the parent table and reference partition the child table.
    I am more concerned about the child table (or the queries running on the child table) in terms of performance. ITEM_LIST_ID from the child table is extensively used in queries to access data from child table.
    How will partition pruning work when the child table is queried on the foreign key? will it every time go to the parent table, find out the partition and then resolve the partition for child table?
    The setup is given in the scripts below, will it cause lot of locking (to resolve partitions)? or am I worrying for nothing?
    Here are the scripts
    CREATE TABLE ITEM_LISTS /* Parent table, tens of thousands of records */
      ITEM_LIST_ID    NUMBER(10)     NOT NULL PRIMARY KEY, /* Global index on partitioned table !!! */
      LIST_NAME       VARCHAR2(500)  NOT NULL,
      FIRST_INSERTED  TIMESTAMP(6)   NOT NULL
    PARTITION BY RANGE ( FIRST_INSERTED )
      partition p0 values less than ( to_date('20130101','YYYYMMDD') ),
      partition p201301 values less than ( to_date('20130201','YYYYMMDD') ),
      partition p201302 values less than ( to_date('20130301','YYYYMMDD') ),
      partition p201303 values less than ( to_date('20130401','YYYYMMDD') ),
      partition p201304 values less than ( to_date('20130501','YYYYMMDD') ),
      partition p201305 values less than ( to_date('20130601','YYYYMMDD') )
    CREATE INDEX ITEM_LISTS_IDX1 ON ITEM_LISTS ( LIST_NAME ) LOCAL ;
    CREATE TABLE ITEM_LIST_DETAILS /* Child table, millions of records */
      ITEM_ID        NUMBER(10)     NOT NULL,
      ITEM_LIST_ID   NUMBER(10)     NOT NULL, /* Always used in WHERE clause by lots of big queries */
      CODE           VARCHAR2(30)   NOT NULL,
      ALT_CODE       VARCHAR2(30)   NOT NULL,
      CONSTRAINT   ITEM_LIST_DETAILS_FK
      FOREIGN KEY  ( ITEM_LIST_ID ) REFERENCES ITEM_LISTS
    PARTITION BY REFERENCE ( ITEM_LIST_DETAILS_FK )
    CREATE INDEX ITEM_LIST_DETAILS_IDX1 ON ITEM_LIST_DETAILS (ITEM_ID) LOCAL;
    CREATE INDEX ITEM_LIST_DETAILS_IDX2 ON ITEM_LIST_DETAILS (ITEM_LIST_ID, CODE) LOCAL;Any thoughts / opinions / corrections ?
    Thanks in advance

    To check how partition pruning works here, I inserted some data in these tables. Inserted data in ITEM_LISTS (parent) from DBA_OBJECTS ( object_id => item_list_id, object_name => list_name, first_inserted => manually created). Also created corresponding child data in ITEM_LIST_DETAILS, so that, for every item_list_id in parent about 5000 records go in child table.
    Looking at the queries and plan below, my question is, what exactly does the operations "PARTITION REFERENCE SINGLE" and "PARTITION REFERENCE ITERATOR" imply ??
    I gave a search on "PARTITION REFERENCE ITERATOR" in Oracle 11.2 documentation, it says "No exact match found" !!
    /* Direct query on child table */
    SQL> select count(*) from item_list_details where item_list_id = 6323 ;
      COUNT(*)
          5000
    1 row selected.
    Execution Plan
    Plan hash value: 2798904155
    | Id  | Operation                   | Name                   | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |
    |   0 | SELECT STATEMENT            |                        |     1 |     5 |    22   (0)| 00:00:01 |       |       |
    |   1 |  SORT AGGREGATE             |                        |     1 |     5 |            |          |       |       |
    |   2 |   PARTITION REFERENCE SINGLE|                        |  5000 | 25000 |    22   (0)| 00:00:01 |   KEY |   KEY |
    |*  3 |    INDEX RANGE SCAN         | ITEM_LIST_DETAILS_IDX2 |  5000 | 25000 |    22   (0)| 00:00:01 |   KEY |   KEY |
    Predicate Information (identified by operation id):
       3 - access("ITEM_LIST_ID"=6323)
    SQL> select * from temp1; /* Dummy table to try out some joins */
    OBJECT_ID OBJECT_NAME
          6598 WRH$_INTERCONNECT_PINGS
    1 row selected.
    /* Query on child table, joining with some other table */
    SQL> select count(*)
      2  from temp1 d, ITEM_LIST_DETAILS i1
      3  where d.object_id = i1.item_list_id
      4  and d.object_name = 'WRH$_INTERCONNECT_PINGS';
      COUNT(*)
          5000
    1 row selected.
    Execution Plan
    Plan hash value: 2288153583
    | Id  | Operation                      | Name                   | Rows  | Bytes | Cost (%CPU)| Time  | Pstart| Pstop |
    |   0 | SELECT STATEMENT               |                        |     1 |    70 |    24   (0)| 00:00:01 |       |       |
    |   1 |  SORT AGGREGATE                |                        |     1 |    70 |            |       |  |       |
    |   2 |   NESTED LOOPS                 |                        |  5000 |   341K|    24   (0)| 00:00:01 |       |       |
    |*  3 |    TABLE ACCESS FULL           | TEMP1                  |     1 |    65 |     3   (0)| 00:00:01 |       |       |
    |   4 |    PARTITION REFERENCE ITERATOR|                        |  5000 | 25000 |    21   (0)| 00:00:01 |   KEY |   KEY |
    |*  5 |     INDEX RANGE SCAN           | ITEM_LIST_DETAILS_IDX2 |  5000 | 25000 |    21   (0)| 00:00:01 |   KEY |   KEY |
    Predicate Information (identified by operation id):
       3 - filter("D"."OBJECT_NAME"='WRH$_INTERCONNECT_PINGS')
       5 - access("D"."OBJECT_ID"="I1"."ITEM_LIST_ID")

  • MB5B Report table for Open and Closing stock on date wise

    Hi Frds,
    I am trying get values of Open and Closing stock on date wise form the Table MARD and MBEW -Material Valuation but it does not match with MB5B reports,
    Could anyone suggest correct table to fetch the values Open and Closing stock on date wise for MB5B reports.
    Thanks
    Mohan M

    Hi,
    Please check the below links...
    Query for Opening And  Closing Stock
    Inventory Opening and Closing Stock
    open stock and closing stock
    Kuber

  • Opening Stock and Closing Stock

    Hi,
      I have one requirement to get a opening stock and closing stock of all materials,  based on the plant date and mat type.
    Could u tell me the flow of tables one by one
    Its is possible to get the opening stock and closing stock of all materials.
    Please Guide Me.
    Thanks & Regards,
        Dhanush.S.T

    go through this....
    *& Report  Z_OPEN_CLOSE                                                *
    REPORT  Z_OPEN_CLOSE MESSAGE-ID YW2 LINE-SIZE 231 LINE-COUNT 45
    NO STANDARD PAGE HEADING.
    Type Declaration *
    TYPE-POOLS SLIS.
    Tables *
    TABLES: MKPF, " Material Document: Header Data
            MSEG, " Material Document: Item Data
            MARA,
            MARD,
            S031,
            EKKO,
            EKPO,
            LIKP,
            MAKT,
            J_1IWRKCUS,
            T001W,
            WB2_V_MKPF_MSEG2,
            MMIM_REP_PRINT,
            YW2_STKMOVEMENTS,
            YPLNT,
            MARDH.
    Internal Tables *
    DATA: I_WERKS LIKE J_1IWRKCUS OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF I_YPLNT OCCURS 0,
             PPLNT LIKE YPLNT-PPLNT,
             WPLNT LIKE YPLNT-WPLNT,
          END OF I_YPLNT.
    DATA: BEGIN OF I_MKPF OCCURS 0,
            MBLNR LIKE MKPF-MBLNR,
            MJAHR LIKE MKPF-MJAHR,
            BUDAT LIKE MKPF-BUDAT,
            VGART LIKE MKPF-VGART,
            BWART LIKE MSEG-BWART,
            MATNR LIKE MSEG-MATNR,
            WERKS LIKE MSEG-WERKS,
            LGORT LIKE MSEG-LGORT,
            MENGE LIKE MSEG-MENGE,
            MEINS LIKE MSEG-MEINS,
            KUNNR LIKE MSEG-KUNNR,
            ZEILE LIKE MSEG-ZEILE,
            XAUTO LIKE MSEG-XAUTO,
            SHKZG LIKE MSEG-SHKZG,
            MATNR1 LIKE MSEG-MATNR,
          END OF I_MKPF.
    DATA: BEGIN OF I_MARDH OCCURS 0,
           WERKS LIKE MARDH-WERKS,
           MEINS LIKE MARA-MEINS,
           MATNR LIKE MARDH-MATNR,
           LGORT LIKE MARDH-LGORT,
           LABST LIKE MARDH-LABST,
           LFGJA LIKE MARDH-LFGJA, "Added -MB
           LFMON LIKE MARDH-LFMON, "Added -MB
           PERIO(6),
           INSME LIKE MARDH-LABST,
           EINME LIKE MARDH-LABST,
           SPEME LIKE MARDH-LABST,
           RETME LIKE MARDH-LABST,
           O_STK LIKE MARDH-LABST, " Opening Stock
           C_STK LIKE MARDH-LABST, " Closing Stock
          END OF I_MARDH.
    DATA: BEGIN OF I_MARD OCCURS 0,
           WERKS LIKE MARD-WERKS,
           MATNR LIKE MARD-MATNR,
           LGORT LIKE MARD-LGORT,
           LABST LIKE MARD-LABST,
           INSME LIKE MARD-LABST,
           MEINS LIKE MARA-MEINS,
           EINME LIKE MARD-LABST,
           SPEME LIKE MARD-LABST,
           RETME LIKE MARD-LABST,
          END OF I_MARD.
    DATA: I_MARD1 LIKE I_MARD OCCURS 0 WITH HEADER LINE.
    DATA: I_MARDH1 LIKE I_MARDH OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF I_MKPF1 OCCURS 0,
            MBLNR LIKE MKPF-MBLNR,
            WERKS LIKE MSEG-WERKS,
            MATNR LIKE MSEG-MATNR,
            BUDAT LIKE MKPF-BUDAT,
            BWART LIKE MSEG-BWART,
            MJAHR LIKE MKPF-MJAHR,
            VGART LIKE MKPF-VGART,
            LGORT LIKE MSEG-LGORT,
            MENGE LIKE MSEG-MENGE,
            MEINS LIKE MSEG-MEINS,
            XAUTO LIKE MSEG-XAUTO,
            SHKZG LIKE MSEG-SHKZG,
          END OF I_MKPF1.
    DATA: BEGIN OF I_MKPF2 OCCURS 0,
           WERKS LIKE MSEG-WERKS,
           MATNR LIKE MSEG-MATNR,
           BUDAT LIKE MKPF-BUDAT,
           BWART LIKE MSEG-BWART,
           MJAHR LIKE MKPF-MJAHR,
           VGART LIKE MKPF-VGART,
           LGORT LIKE MSEG-LGORT,
           MENGE LIKE MSEG-MENGE,
           MEINS LIKE MSEG-MEINS,
           XAUTO LIKE MSEG-XAUTO,
         END OF I_MKPF2.
    DATA: BEGIN OF I_FINAL5 OCCURS 0,
           WERKS LIKE MSEG-WERKS, " Plant
           MATNR LIKE MSEG-MATNR, " Material
           LGORT LIKE MSEG-LGORT, " Storage Location
           BUDAT LIKE MKPF-BUDAT, " Posting Date
           MTART LIKE MARA-MTART, " Material Type
           SPMON LIKE S031-SPMON, " Month
           MAKTX LIKE MAKT-MAKTX, " Description
    meins(3), " UOM
            MEINS LIKE MSEG-MEINS,
            O_STK LIKE MARDH-LABST, " opening stock
            TRECEP LIKE MARDH-LABST, " total receipts
            PRODU LIKE MARDH-LABST, " Net Receipts - Production
            RECEP LIKE MARDH-LABST, " Net Receipts - Receipts
            SAL_RET LIKE MARDH-LABST, " Net Receipts - Sales Return
            TDISP LIKE MARDH-LABST, " total dispatches
            CUSTMR LIKE MARDH-LABST, " Net Dispatches - Customers
            OPLANT LIKE MARDH-LABST, " Net Dispatches - To Other Plant
            TLOSS LIKE MARDH-LABST, " Total Loss
            TRLOSS LIKE MARDH-LABST, " Transit Loss
            WHLOSS LIKE MARDH-LABST, " Warehouse Loss
            C_STK LIKE MARDH-LABST, " Closing Stock
            TRFSTK LIKE MARDH-LABST, "Transfer stock
            MENGE LIKE MSEG-MENGE,
            OTHADJ LIKE MARDH-LABST,
          END OF I_FINAL5.
    DATA: BEGIN OF I_FINAL OCCURS 0,
            WERKS LIKE MSEG-WERKS, " Plant
            MATNR LIKE MSEG-MATNR, " Material
            BUDAT LIKE MKPF-BUDAT, " Posting Date
            MTART LIKE MARA-MTART, " Material Type
            SPMON LIKE S031-SPMON, " Month
            MAKTX LIKE MAKT-MAKTX, " Description
    meins(3), " UOM
            MEINS LIKE MSEG-MEINS,
            O_STK LIKE MARDH-LABST, " opening stock
            TRECEP LIKE MARDH-LABST, " total receipts
            PRODU LIKE MARDH-LABST, " Net Receipts - Production
            RECEP LIKE MARDH-LABST, " Net Receipts - Receipts
            SAL_RET LIKE MARDH-LABST, " Net Receipts - Sales Return
            TDISP LIKE MARDH-LABST, " total dispatches
            CUSTMR LIKE MARDH-LABST, " Net Dispatches - Customers
            OPLANT LIKE MARDH-LABST, " Net Dispatches - To Other Plant
            TRFSTK LIKE MARDH-LABST, "Material Transfer stock
            TRLOSS LIKE MARDH-LABST, " Transit Loss
            WHLOSS LIKE MARDH-LABST, " Warehouse Loss
            TLOSS LIKE MARDH-LABST, " Total Loss
            C_STK LIKE MARDH-LABST, " Closing Stock
            OTHADJ LIKE MARDH-LABST,
           END OF I_FINAL.
    DATA: I_FINAL1 LIKE I_FINAL OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF I_FINAL_TEMP OCCURS 0,
            WERKS LIKE MSEG-WERKS, " Plant
            MATNR LIKE MSEG-MATNR, " Material
            MTART LIKE MARA-MTART, " Material Type
            MAKTX LIKE MAKT-MAKTX, " Description
            MEINS LIKE MSEG-MEINS,
            O_STK LIKE MARDH-LABST, " opening stock
            TRECEP LIKE MARDH-LABST, " total receipts
            PRODU LIKE MARDH-LABST, " Net Receipts - Production
            RECEP LIKE MARDH-LABST, " Net Receipts - Receipts
            SAL_RET LIKE MARDH-LABST, " Net Receipts - Sales Return
            TDISP LIKE MARDH-LABST, " total dispatches
            CUSTMR LIKE MARDH-LABST, " Net Dispatches - Customers
            OPLANT LIKE MARDH-LABST, " Net Dispatches - To Other Plant
            TRFSTK LIKE MARDH-LABST, "Material Transfer stock
            TRLOSS LIKE MARDH-LABST, " Transit Loss
            WHLOSS LIKE MARDH-LABST, " Warehouse Loss
            TLOSS LIKE MARDH-LABST, " Total Loss
            C_STK LIKE MARDH-LABST, " Closing Stock
            OTHADJ LIKE MARDH-LABST,
          END OF I_FINAL_TEMP.
    For Materials
    DATA: BEGIN OF I_MARA OCCURS 0,
           MATNR TYPE MARA-MATNR,
           MTART TYPE MARA-MTART,
           MEINS LIKE MARA-MEINS,
           LABST TYPE MARD-LABST,
           MAKTX LIKE MAKT-MAKTX,
          END OF I_MARA.
    DATA: BEGIN OF I_STKMVMNTS OCCURS 0,
           BWART LIKE MSEG-BWART,
           SHKZG LIKE MSEG-SHKZG,
           VZBEW LIKE YW2_STKMOVEMENTS-VZBEW,
          END OF I_STKMVMNTS.
    DATA: BEGIN OF I_FINALT OCCURS 0,
           WERKS LIKE MSEG-WERKS, " Plant
           MATNR LIKE MSEG-MATNR, " Material
           BUDAT LIKE MKPF-BUDAT, " Posting Date
           MTART LIKE MARA-MTART, " Material Type
           SPMON LIKE S031-SPMON, " Month
           MAKTX LIKE MAKT-MAKTX, " Description
    meins(3), " UOM
           MEINS LIKE MSEG-MEINS,
           O_STK LIKE MARDH-LABST, " opening stock
           TRECEP LIKE MARDH-LABST, " total receipts
           PRODU LIKE MARDH-LABST, " Net Receipts - Production
           RECEP LIKE MARDH-LABST, " Net Receipts - Receipts
           SAL_RET LIKE MARDH-LABST, " Net Receipts - Sales Return
           TDISP LIKE MARDH-LABST, " total dispatches
           CUSTMR LIKE MARDH-LABST, " Net Dispatches - Customers
           OPLANT LIKE MARDH-LABST, " Net Dispatches - To Other Plant
           TRFSTK LIKE MARDH-LABST, "Material Transfer stock
           TRLOSS LIKE MARDH-LABST, " Transit Loss
           WHLOSS LIKE MARDH-LABST, " Warehouse Loss
           TLOSS LIKE MARDH-LABST, " Total Loss
           C_STK LIKE MARDH-LABST, " Closing Stock
           OTHADJ LIKE MARDH-LABST,
           MONTH(8) ,
          END OF I_FINALT.
    DATA: IMKPFT LIKE I_MKPF OCCURS 0 WITH HEADER LINE.
    DATA: IMKPFT1 LIKE I_MKPF1 OCCURS 0 WITH HEADER LINE.
    DATA: IMARDT LIKE I_MARD OCCURS 0 WITH HEADER LINE.
    DATA: IMARDHT LIKE I_MARDH OCCURS 0 WITH HEADER LINE.
    DATA: T_FINAL LIKE I_MKPF OCCURS 0 WITH HEADER LINE.
    DATA: IMKPFT2 LIKE I_MKPF OCCURS 0 WITH HEADER LINE.
    FCAT is used for the field catalog
    DATA: FCAT TYPE TABLE OF SLIS_FIELDCAT_ALV WITH NON-UNIQUE DEFAULT KEY
                      WITH HEADER LINE INITIAL SIZE 0,
    for excluding the ICONs from the application toolbar
          FEXC TYPE TABLE OF SLIS_EXTAB WITH NON-UNIQUE DEFAULT KEY
                     WITH HEADER LINE INITIAL SIZE 0,
    FS_LAYO is used for Grid Layout
          FS_LAYO TYPE SLIS_LAYOUT_ALV,
    FEVENTS to handle the events TOP OF PAGE & USER_COMMAND
          FEVENTS TYPE TABLE OF SLIS_ALV_EVENT WITH NON-UNIQUE DEFAULT KEY
                     WITH HEADER LINE INITIAL SIZE 0,
    FHEADER is used for List header
          FHEADER TYPE TABLE OF SLIS_LISTHEADER WITH NON-UNIQUE DEFAULT KEY
                     WITH HEADER LINE INITIAL SIZE 0,
    sort is used for sorting
          FSORT TYPE TABLE OF SLIS_SORTINFO_ALV WITH NON-UNIQUE DEFAULT KEY
                     WITH HEADER LINE INITIAL SIZE 0,
          FCAT1 TYPE TABLE OF SLIS_FIELDCAT_ALV WITH NON-UNIQUE DEFAULT KEY
                    WITH HEADER LINE INITIAL SIZE 0,
          FS_LAYO1 TYPE SLIS_LAYOUT_ALV,
          GT_LIST_TOP_OF_PAGE1 TYPE SLIS_T_LISTHEADER,
          FEVENTS1 TYPE TABLE OF SLIS_ALV_EVENT WITH NON-UNIQUE DEFAULT KEY
                 WITH HEADER LINE INITIAL SIZE 0,
           FHEADER1 TYPE TABLE OF SLIS_LISTHEADER WITH NON-UNIQUE DEFAULT  
                  KEY WITH HEADER LINE INITIAL SIZE 0,
           G_STATU_071 TYPE SLIS_FORMNAME VALUE 'Z_PFSTATUS',
           ALV_VARIANT1 LIKE DISVARIANT.
    Variable Declaration *
    TYPES: TRFF_TYPE_DEC_6_5(6) TYPE P DECIMALS 5.
    DATA: FYEAR(4),
          MON(2),
          FYEAR1(4),
          MON1(2),
          OBAL LIKE MARD-LABST,
          CBAL LIKE MARD-LABST,
          INDEX TYPE I,
          COUNT,
          COUNT1 TYPE I,
          O_STK TYPE P DECIMALS 3,
          C_STK TYPE P DECIMALS 3,
          V_MJAHR LIKE MKPF-MJAHR,
          MONTHS TYPE TRFF_TYPE_DEC_6_5,
          MONTH TYPE I.
    Global variables for handling ALV functionality
    DATA: ALV_KEYINFO TYPE SLIS_KEYINFO_ALV,
          ALV_VARIANT LIKE DISVARIANT,
          ALV_LAYOUT TYPE SLIS_LAYOUT_ALV,
          ALV_REPID LIKE SY-REPID,
          ALV_PRINT TYPE SLIS_PRINT_ALV,
          ALV_DETAIL_FUNC(30),
          ALV_DEFAULT_VARIANT LIKE DISVARIANT-VARIANT,
          ALV_COLOURIZE_FIELDS LIKE MMIM_REP_PRINT-COLOR.
    RANGES: R_BUDAT FOR MKPF-BUDAT.
    *Added by Prabhu for year on 26.4.05.
    DATA: IDATE LIKE R_BUDAT OCCURS 0 WITH HEADER LINE.
    Selection Screen Elements *
    SELECTION-SCREEN BEGIN OF BLOCK BLK WITH FRAME TITLE TEXT-001.
      SELECT-OPTIONS: S_WERKS FOR MARD-WERKS OBLIGATORY NO INTERVALS.
      PARAMETER: P_SPMON LIKE S031-SPMON NO-DISPLAY .
      SELECT-OPTIONS: S_MATNR FOR MARA-MATNR OBLIGATORY,
                      S_LGORT FOR MSEG-LGORT NO-EXTENSION NO INTERVALS,
                      S_MBLNR FOR MKPF-MBLNR,
                      S_BUDAT FOR MKPF-BUDAT OBLIGATORY .
    SELECTION-SCREEN END OF BLOCK BLK.
    SELECTION-SCREEN BEGIN OF BLOCK BLK3 WITH FRAME TITLE TEXT-004.
          PARAMETER : MTART LIKE MARA-MTART DEFAULT 'FERT' NO-DISPLAY.
    SELECTION-SCREEN END OF BLOCK BLK3.
    SELECTION-SCREEN BEGIN OF BLOCK BLK2 WITH FRAME TITLE TEXT-003.
    SELECTION-SCREEN END OF BLOCK BLK2.
    ADDED BY PRABHU FOR DAY-WISE REPORT.
    SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-007.
      PARAMETERS: D1 RADIOBUTTON GROUP P1 DEFAULT 'X',
                  M1 RADIOBUTTON GROUP P1,
                  Y1 RADIOBUTTON GROUP P1.
    SELECTION-SCREEN END OF BLOCK B3.
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-006.
    PARAMETERS: ALV_DEF LIKE DISVARIANT-VARIANT.
    SELECTION-SCREEN END OF BLOCK B2.
    DATA: S_BUDAT1 LIKE S_BUDAT OCCURS 0 WITH HEADER LINE."prabhu
    Initialization *
    INITIALIZATION.
      PERFORM ALV_INIT.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR ALV_DEF.
      PERFORM ALV_F4.
    At Selection Screen
    *AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_spmon.
    PERFORM monat_f4.
    At Selection Screen *
    AT SELECTION-SCREEN.
    checking for the layout
      PERFORM ALV_CHECK.
    authorisation check for the Plant
    PERFORM auth_check.
    Validation for the Plant
      PERFORM VALIDITY_CHECK.
      IF MTART NE 'FERT'.
        MESSAGE E041 WITH 'Material Type must be FERT Only...'.
      ENDIF.
      IF D1 = 'X'." On 26.4.05.
        P_SPMON0(4) = S_BUDAT-LOW0(4).
        P_SPMON4(2) = S_BUDAT-LOW4(2).
      ELSE.
        P_SPMON0(4) = S_BUDAT-LOW0(4).
        P_SPMON4(2) = S_BUDAT-LOW4(2).
      ENDIF.
      LOOP AT S_BUDAT.
        IF S_BUDAT-HIGH IS INITIAL.
          S_BUDAT-HIGH = S_BUDAT-LOW.
          MODIFY S_BUDAT.
        ENDIF.
      ENDLOOP.
      IDATE-LOW = S_BUDAT-LOW.
      IDATE-HIGH = S_BUDAT-HIGH.
      CALL FUNCTION 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
        EXPORTING
           I_DATE_FROM = IDATE-LOW
           I_DATE_TO = IDATE-HIGH
       IMPORTING
    E_DAYS =
          E_MONTHS = MONTH
    E_YEARS =
      DATA: I(3) TYPE C.
      I = S_BUDAT-LOW+4(2).
      CLEAR: R_BUDAT.
      REFRESH: R_BUDAT.
    *added by Prabhu for Only for Oneday.on 18.5.5
      IF MONTH EQ '0'.
        MONTH = MONTH + 1.
      ENDIF.
    *added by Prabhu for Only for Oneday.on 18.5.5
      DO MONTH TIMES.
        R_BUDAT-LOW = S_BUDAT-LOW.
        APPEND R_BUDAT.
      ENDDO.
      I = 0.
      LOOP AT R_BUDAT.
        R_BUDAT-LOW4(2) = S_BUDAT-LOW4(2) + I.
        I = I + 1.
        R_BUDAT-LOW+6(2) = '01'.
        MODIFY R_BUDAT.
      ENDLOOP.
      LOOP AT R_BUDAT.
        CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
           EXPORTING
             DAY_IN = R_BUDAT-LOW
           IMPORTING
             LAST_DAY_OF_MONTH = R_BUDAT-HIGH
          EXCEPTIONS
            DAY_IN_NO_DATE = 1
            OTHERS = 2
        MODIFY R_BUDAT.
      ENDLOOP.
      LOOP AT R_BUDAT.
        IF R_BUDAT-LOW4(2) = S_BUDAT-LOW4(2).
          R_BUDAT-LOW = S_BUDAT-LOW.
          MODIFY R_BUDAT.
        ENDIF.
        IF R_BUDAT-HIGH4(2) = S_BUDAT-HIGH4(2).
          R_BUDAT-HIGH = S_BUDAT-HIGH.
          MODIFY R_BUDAT.
        ENDIF.
    For Summary on 26.4.05.
        IF Y1 = 'X'.
          CLEAR R_BUDAT.
          REFRESH R_BUDAT.
          R_BUDAT-LOW = S_BUDAT-LOW.
          R_BUDAT-HIGH = S_BUDAT-HIGH.
          APPEND R_BUDAT.
          CLEAR R_BUDAT.
        ENDIF.
      ENDLOOP.
    At Selection Screen *
    AT SELECTION-SCREEN OUTPUT.
    Start of Selection *
    START-OF-SELECTION.
      V_MJAHR = P_SPMON+0(4).
    Get plant distinction warehouse/production
      PERFORM GET_PLANT_DISTINCTION.
    Collect the data from various tables
      PERFORM GETDATA_FG_STOCK.
    here the number of rows in the output table is found
      PERFORM OUTPUT_TABLE_CHECK.
    here the top of the page code is written, that is to be displayed
    in the output
      PERFORM Z_TOP_OF_PAGE.
    here ALV layout properties are set
      PERFORM Z_LAYOUT_SETTINGS.
    ALV EVENTS for TOP OF PAGE and for USER COMMAND
      PERFORM Z_ALV_EVENTS.
    The field catalog is defined for the Primary List is defined in
    the subroutine CREATE_FIELD_CATALOG include program ZPRRDOCR_FCAT
      PERFORM Z_CREATE_FIELD_CATALOG.
    This is for displaying the output
      PERFORM Z_REUSE_ALV_GRID_DISPLAY.
    *& Form getdata_fg_stock
    Getting data from standard tables
    FORM GETDATA_FG_STOCK.
    For getting the Start date & end date of the month
    PERFORM get_month_dates.
    Getting the Opening Stock from MARDH table
      IF MON EQ '01'.
        MON1 = MON.
        FYEAR1 = FYEAR.
        MON = '12'.
        FYEAR = FYEAR - 1.
      ELSE.
        MON1 = MON.
        FYEAR1 = FYEAR.
        MON = MON - 1.
        FYEAR = FYEAR.
      ENDIF.
      PERFORM GET_RECORDS_FROM_DB.
    *added for Month Summary on 26.4.05.
      LOOP AT R_BUDAT.
        S_BUDAT-LOW = R_BUDAT-LOW.
        S_BUDAT-HIGH = R_BUDAT-HIGH.
    *for Month
        P_SPMON0(4) = S_BUDAT-LOW0(4).
        P_SPMON4(2) = S_BUDAT-LOW4(2).
    *for summary.
        IF Y1 = 'X'.
          LOOP AT S_BUDAT.
            S_BUDAT1-SIGN = 'I'.
            S_BUDAT1-OPTION = 'NB'.
            S_BUDAT1-LOW = S_BUDAT-LOW.
            S_BUDAT1-HIGH = S_BUDAT-HIGH.
            APPEND S_BUDAT1.
            CLEAR S_BUDAT1.
          ENDLOOP.
        ENDIF.
        IMKPFT[] = I_MKPF[].
        IMKPFT2[] = I_MKPF[].
        IMARDT[] = I_MARD[].
        IMARDHT[] = I_MARDH[].
        PERFORM MONTH_WISE.
        PERFORM PROCESS_MOVEMENTS.
        PERFORM CALCULATE_OPENING_STOCK.
        PERFORM UPDATE_NON_TRANSACTION_ITMS.
        PERFORM DELETE_EMPTY_RECORDS.
        CLEAR: IMARDHT,IMARDT,IMKPFT1,IMKPFT,I_FINAL,I_FINAL5.
        REFRESH: IMARDHT,IMARDT,IMKPFT1,I_FINAL,I_FINAL5,IMKPFT.
      ENDLOOP.
      CLEAR: R_BUDAT.
      REFRESH: R_BUDAT.
    *end of changes for month.
    ENDFORM. " getdata_fg_stock
    FORM MONAT_F4 *
    F4-Hilfe für Monat *
    FORM MONAT_F4.
      DATA: BEGIN OF MF_DYNPFIELDS OCCURS 1.
              INCLUDE STRUCTURE DYNPREAD.
      DATA: END OF MF_DYNPFIELDS.
      DATA: MF_RETURNCODE LIKE SY-SUBRC,
             MF_MONAT LIKE ISELLIST-MONTH,
             MF_HLP_REPID LIKE SY-REPID.
      FIELD-SYMBOLS: .
    Wert von Dynpro lesen
      GET CURSOR FIELD MF_DYNPFIELDS-FIELDNAME.
      APPEND MF_DYNPFIELDS.
      MF_HLP_REPID = SY-REPID.
      DO 2 TIMES.
        CALL FUNCTION 'DYNP_VALUES_READ'
          EXPORTING
            DYNAME               = MF_HLP_REPID
            DYNUMB               = SY-DYNNR
          TABLES
            DYNPFIELDS           = MF_DYNPFIELDS
          EXCEPTIONS
            INVALID_ABAPWORKAREA = 01
            INVALID_DYNPROFIELD  = 02
            INVALID_DYNPRONAME   = 03
            INVALID_DYNPRONUMMER = 04
            INVALID_REQUEST      = 05
            NO_FIELDDESCRIPTION  = 06
            UNDEFIND_ERROR       = 07.
        IF SY-SUBRC = 3.
    Aktuelles Dynpro ist Wertemengenbild
          MF_HLP_REPID = 'SAPLALDB'.
        ELSE.
          READ TABLE MF_DYNPFIELDS INDEX 1.
    Unterstriche durch Blanks ersetzen
          TRANSLATE MF_DYNPFIELDS-FIELDVALUE USING '_ '.
          EXIT.
        ENDIF.
      ENDDO.
      IF SY-SUBRC = 0.
    Konvertierung ins interne Format
        CALL FUNCTION 'CONVERSION_EXIT_PERI_INPUT'
          EXPORTING
            INPUT         = MF_DYNPFIELDS-FIELDVALUE
          IMPORTING
            OUTPUT        = MF_MONAT
          EXCEPTIONS
            ERROR_MESSAGE = 1.
        IF MF_MONAT IS INITIAL.
    Monat ist initial => Vorschlagswert aus akt. Datum ableiten
          MF_MONAT = SY-DATLO(6).
        ENDIF.
        CALL FUNCTION 'POPUP_TO_SELECT_MONTH'
          EXPORTING
            ACTUAL_MONTH               = MF_MONAT
          IMPORTING
            SELECTED_MONTH             = MF_MONAT
            RETURN_CODE                = MF_RETURNCODE
          EXCEPTIONS
            FACTORY_CALENDAR_NOT_FOUND = 01
            HOLIDAY_CALENDAR_NOT_FOUND = 02
            MONTH_NOT_FOUND            = 03.
        IF SY-SUBRC = 0 AND MF_RETURNCODE = 0.
    ASSIGN (MF_DYNPFIELDS-FIELDNAME) TO <MF_FELD>. " ==>> note 148804
    <MF_FELD> = MF_MONAT.
          CALL FUNCTION 'CONVERSION_EXIT_PERI_OUTPUT'
            EXPORTING
              INPUT  = MF_MONAT
            IMPORTING
              OUTPUT = MF_DYNPFIELDS-FIELDVALUE.
          COLLECT MF_DYNPFIELDS.
          CALL FUNCTION 'DYNP_VALUES_UPDATE'
            EXPORTING
              DYNAME               = MF_HLP_REPID
              DYNUMB               = SY-DYNNR
            TABLES
              DYNPFIELDS           = MF_DYNPFIELDS
            EXCEPTIONS
              INVALID_ABAPWORKAREA = 01
              INVALID_DYNPROFIELD  = 02
              INVALID_DYNPRONAME   = 03
              INVALID_DYNPRONUMMER = 04
              INVALID_REQUEST      = 05
              NO_FIELDDESCRIPTION  = 06
              UNDEFIND_ERROR       = 07. "<<== note 148804
        ENDIF.
      ENDIF.
    ENDFORM.                                                    "MONAT_F4
    *& Form get_month_dates
    Calculating the Month Start & End Date
    FORM GET_MONTH_DATES.
      IF M1 = 'X'.
        FYEAR = P_SPMON+0(4).
        MON = P_SPMON+4(2).
        CONCATENATE FYEAR MON '01' INTO R_BUDAT-LOW.
        R_BUDAT-SIGN = 'I'.
        R_BUDAT-OPTION = 'BT'.
        CALL FUNCTION 'BKK_GET_MONTH_LASTDAY'
          EXPORTING
            I_DATE = R_BUDAT-LOW
          IMPORTING
            E_DATE = R_BUDAT-HIGH.
        APPEND R_BUDAT.
        CLEAR S_BUDAT.
        REFRESH S_BUDAT.
        S_BUDAT-SIGN = 'I'.
        S_BUDAT-OPTION = 'BT'.
        S_BUDAT-LOW = R_BUDAT-LOW.
        S_BUDAT-HIGH = R_BUDAT-HIGH.
        APPEND S_BUDAT.
      ELSE.
        FYEAR = P_SPMON+0(4).
        MON = P_SPMON+4(2).
        CONCATENATE FYEAR MON '01' INTO R_BUDAT-LOW.
        R_BUDAT-SIGN = 'I'.
        R_BUDAT-OPTION = 'BT'.
        CALL FUNCTION 'BKK_GET_MONTH_LASTDAY'
          EXPORTING
            I_DATE = R_BUDAT-LOW
          IMPORTING
            E_DATE = R_BUDAT-HIGH.
        APPEND R_BUDAT.
      ENDIF.
    ENDFORM. " get_month_dates
    *& Form output_table_Check
    checking for records for output
    FORM OUTPUT_TABLE_CHECK .
      DESCRIBE TABLE I_FINALT LINES INDEX.
      IF INDEX EQ 0.
        MESSAGE I041 WITH TEXT-005.
        LEAVE LIST-PROCESSING.
      ENDIF.
    ENDFORM. "OUTPUT_TABLE_CHECK
    *& Form Z_TOP_OF_PAGE
    for setting the details in the top of page *
    has no formal paramters *
    FORM Z_TOP_OF_PAGE.
      DATA: V_MON(2),
      V_YR(40),
      V_FIN(18),
      V_FIN1(48),
      LOW(10),
      HIGH(10).
      V_MON = P_SPMON+4(2).
      V_YR = P_SPMON+0(4).
      FHEADER-TYP = 'H'.
      FHEADER-INFO = 'Stock Register Report (FG Stock)'.
      APPEND FHEADER.
      CLEAR FHEADER.
    *if m1 = 'X'.
    CONCATENATE 'Month = ' v_mon '.' v_yr INTO v_fin.
    fheader-typ = 'H'.
    fheader-info = v_fin.
    APPEND fheader.
    CLEAR fheader.
    *endif."prabhu on 18.5.5
      IF D1 = 'X'.
        CLEAR S_BUDAT.
        LOOP AT S_BUDAT.
          CONCATENATE S_BUDAT-LOW6(2) '/' S_BUDAT-LOW4(2) '/'
          S_BUDAT-LOW+0(4) INTO LOW.
          CONCATENATE S_BUDAT-HIGH6(2) '/' S_BUDAT-HIGH4(2) '/'
          S_BUDAT-HIGH+0(4) INTO HIGH.
          CONCATENATE 'Date = ' LOW ' - ' HIGH INTO V_FIN1.
          FHEADER-TYP = 'H'.
          FHEADER-INFO = V_FIN1.
          APPEND FHEADER.
          CLEAR FHEADER.
        ENDLOOP.
      ENDIF.
    ENDFORM. " Z_TOP_OF_PAGE
    *& Form Z_LAYOUT_SETTINGS
    this is done for setting the properties for the layout of the *
    grid *
    has no formal paramters *
    FORM Z_LAYOUT_SETTINGS.
      FS_LAYO-ZEBRA = 'X'. " Output in Zebra pattern
      FS_LAYO-DETAIL_POPUP = 'X'. " A popup window appears to give
      FS_LAYO-DETAIL_TITLEBAR = TEXT-022.
      FS_LAYO-COLWIDTH_OPTIMIZE = 'X'.
    ENDFORM. " Z_LAYOUT_SETTINGS
    *& Form Z_ALV_EVENTS
    This is used for handling the events TOP OF PAGE and the USER *
    COMMAND event *
    has no formal paramters *
    FORM Z_ALV_EVENTS.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          I_LIST_TYPE = 0
        IMPORTING
          ET_EVENTS   = FEVENTS[].
      READ TABLE FEVENTS WITH KEY NAME = 'TOP_OF_PAGE'.
      IF SY-SUBRC = 0.
        FEVENTS-FORM = 'Z_TOPOFPAGE'.
        MODIFY FEVENTS INDEX SY-TABIX.
        CLEAR FEVENTS.
      ENDIF.
      READ TABLE FEVENTS WITH KEY NAME = 'USER_COMMAND'.
      IF SY-SUBRC = 0.
        FEVENTS-FORM = 'Z_USER_COMMAND'.
        MODIFY FEVENTS INDEX SY-TABIX.
        CLEAR FEVENTS.
      ENDIF.
    ENDFORM. "Z_ALV_EVENTS
    *& Form Z_CREATE_FIELD_CATALOG
    here the field catalog is created for the primary list *
    no formal parameters *
    FORM Z_CREATE_FIELD_CATALOG.
    for the Plant
      FCAT-FIELDNAME = 'WERKS'.
      FCAT-KEY = 'X'.
      FCAT-OUTPUTLEN = '000005'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'Plant'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'C'.
      FCAT-DATATYPE = 'CHAR'.
      APPEND FCAT.
      CLEAR FCAT.
    for the Material Type
      FCAT-FIELDNAME = 'MTART'.
      FCAT-KEY = 'X'.
      FCAT-OUTPUTLEN = '000006'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'MatTyp'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'C'.
      FCAT-DATATYPE = 'CHAR'.
      APPEND FCAT.
      CLEAR FCAT.
    for the Material No.
      FCAT-FIELDNAME = 'MATNR'.
      FCAT-KEY = 'X'.
    fcat-hotspot = 'X'.
      FCAT-OUTPUTLEN = '000018'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'Material'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'C'.
      FCAT-DATATYPE = 'CHAR'.
      APPEND FCAT.
      CLEAR FCAT.
    for the Material Description
      FCAT-FIELDNAME = 'MAKTX'.
      FCAT-KEY = ''.
      FCAT-OUTPUTLEN = '000040'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'Description'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'C'.
      FCAT-DATATYPE = 'CHAR'.
      APPEND FCAT.
      CLEAR FCAT.
    for the Unit of Measure
      FCAT-FIELDNAME = 'MEINS'.
      FCAT-KEY = ''.
      FCAT-OUTPUTLEN = '03'.
      FCAT-JUST = 'C'.
      FCAT-SELTEXT_M = 'UOM'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'C'.
      FCAT-DATATYPE = 'UNIT'.
      APPEND FCAT.
      CLEAR FCAT.
    for the Plant
      FCAT-FIELDNAME = 'MONTH'.
      FCAT-KEY = 'X'.
      FCAT-OUTPUTLEN = '08'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'MONTH'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'C'.
      FCAT-DATATYPE = 'CHAR'.
      APPEND FCAT.
      CLEAR FCAT.
    for the Opening Stock
      FCAT-FIELDNAME = 'C_STK'.
      FCAT-HOTSPOT = ' '.
      FCAT-OUTPUTLEN = '000016'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'Opening Stock'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'Q'.
      FCAT-DATATYPE = 'QUAN'.
    fcat-do_sum = 'X'.
      FCAT-JUST = 'R'.
      FCAT-NO_ZERO = 'X'.
      APPEND FCAT.
      CLEAR FCAT.
    for the Total Receipts
      FCAT-FIELDNAME = 'TRECEP'.
      FCAT-HOTSPOT = ' '.
      FCAT-OUTPUTLEN = '000016'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'Total Receipts'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'Q'.
      FCAT-DATATYPE = 'QUAN'.
      FCAT-DO_SUM = 'X'.
      FCAT-JUST = 'R'.
      FCAT-NO_ZERO = 'X'.
      APPEND FCAT.
      CLEAR FCAT.
    for the Production
      FCAT-FIELDNAME = 'PRODU'.
      FCAT-HOTSPOT = ' '.
      FCAT-OUTPUTLEN = '000016'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'Production'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'Q'.
      FCAT-DATATYPE = 'QUAN'.
      FCAT-DO_SUM = 'X'.
      FCAT-JUST = 'R'.
      FCAT-NO_ZERO = 'X'.
      APPEND FCAT.
      CLEAR FCAT.
    for the Other Plant Receipts
      FCAT-FIELDNAME = 'RECEP'.
      FCAT-HOTSPOT = ' '.
      FCAT-OUTPUTLEN = '000016'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'Othr Plnt Recpts'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'Q'.
      FCAT-DATATYPE = 'QUAN'.
      FCAT-DO_SUM = 'X'.
      FCAT-JUST = 'R'.
      FCAT-NO_ZERO = 'X'.
      APPEND FCAT.
      CLEAR FCAT.
    Sales Return
      FCAT-FIELDNAME = 'SAL_RET'.
      FCAT-HOTSPOT = ' '.
      FCAT-OUTPUTLEN = '000016'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'Sales Return'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'Q'.
      FCAT-DATATYPE = 'QUAN'.
      FCAT-DO_SUM = 'X'.
      FCAT-JUST = 'R'.
      FCAT-NO_ZERO = 'X'.
      APPEND FCAT.
      CLEAR FCAT.
    Total Dispatches
      FCAT-FIELDNAME = 'TDISP'.
      FCAT-HOTSPOT = ' '.
      FCAT-OUTPUTLEN = '000016'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'Total Dispatches'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'Q'.
      FCAT-DATATYPE = 'QUAN'.
      FCAT-DO_SUM = 'X'.
      FCAT-JUST = 'R'.
      FCAT-NO_ZERO = 'X'.
      APPEND FCAT.
      CLEAR FCAT.

  • Sales and Closing Stock By Item Group

    Dear all,
    Can anybody give me modified query for the following code. I need Item Group wise sales & Stock.
    As of this query data values are not getting perfect,opening stock and  Closing stock values are not getting prefect.
    Some items are not getting,which item code is starting form 5%.
    *Start of the Query *
    select * from ( SELECT T0.Itemcode, min(T0.Dscription) as 'Item Description', W1.Whscode,
    (isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode and O1.docdate&lt;@FromDate and O1.transtype in (59,20,18,16,14,67,-2)),0) - isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode and O1.docdate&lt;@FromDate and O1.transtype in (21,19,60,15,67,-2,13)),0)) as [Opening Stock],
    (isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode and O1.docdate&gt;=@FromDate and O1.docdate&lt;=@ToDate and O1.inqty&gt;0 and o1.Price &gt;0 and O1.transtype in (20,18)),0))-(isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode and O1.docdate&gt;=@FromDate and O1.docdate&lt;=@ToDate and O1.outqty&gt;0 and o1.Price &gt;0 and O1.transtype in (19)),0)) as [Purchase Quantity],
    (isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode and O1.docdate&gt;=@FromDate and O1.docdate&lt;=@ToDate and O1.inqty&gt;0 and o1.Price = 0 and O1.transtype in (20,18)),0))-(isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode and O1.docdate&gt;=@FromDate and O1.docdate&lt;=@ToDate and O1.outqty&gt;0 and o1.Price = 0 and O1.transtype in (19)),0)) as [Purchase FOC Qty],
    ( isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode and O1.docdate&gt;=@FromDate and O1.docdate&lt;=@ToDate and O1.outqty&gt;0 and O1.Price&gt;0 and O1.transtype in (13,15)),0)) as [Sale Qty],
    (isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode and O1.docdate&gt;=@FromDate and O1.docdate&lt;=@ToDate and O1.inqty&gt;0 and O1.Price&gt;0 and O1.transtype in (14,16)),0))as [Return Qty],
    ( isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode and O1.docdate&gt;=@FromDate and O1.docdate&lt;=@ToDate and O1.outqty&gt;0 and O1.Price&gt;0 and O1.transtype in (13,15)),0))- (isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode and O1.docdate&gt;=@FromDate and O1.docdate&lt;=@ToDate and O1.inqty&gt;0 and O1.Price&gt;0 and O1.transtype in (14,16)),0))as [NetSale Qty],
    (isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode and O1.docdate&gt;=@FromDate and O1.docdate&lt;=@ToDate and O1.outqty&gt;0 and O1.Price=0 and O1.transtype in (13,15)),0))-(isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode and O1.docdate&gt;=@FromDate and O1.docdate&lt;=@ToDate and O1.inqty&gt;0 and O1.Price=0 and O1.transtype in (14,16)),0))as [FOC Quantity],
    (isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode and O1.docdate&gt;=@FromDate and O1.docdate&lt;=@ToDate and O1.inqty&gt;0 and O1.transtype in (59)),0)) as [StockIN Quantity],
    (isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode and O1.docdate&gt;=@FromDate and O1.docdate&lt;=@ToDate and O1.outqty&gt;0 and O1.transtype in (60)),0)) as [StockOUT Quantity],
    (isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode and O1.docdate&lt;=@ToDate and O1.transtype in (59,20,18,16,14,67,-2)),0) - isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode and O1.docdate&lt;=@ToDate and O1.transtype in (21,19,60,15,67,-2,13)),0)) as [Closing Stock]
    FROM OINM T0 INNER JOIN OITM T1 ON T0.ItemCode = T1.ItemCode INNER JOIN OITW T2 ON T1.ItemCode = T2.ItemCode INNER JOIN OITB B1 ON T1.ItmsGrpCod=B1.ItmsGrpCod INNER JOIN OWHS W1 ON T2.WhsCode = W1.WhsCode INNER JOIN OLCT C1 ON W1.Location=C1.Code and T0.ItemCode Like '5%' and W1.WhsCode not in ( 'WH-DEMO', 'WH-AHM-R','WH-MUM-R','WH-NDL-R')
    Group by T2.MinStock ,T1.itemcode, T0.Itemcode, W1.WhsCode, C1.Location) a
    End of the Query*

    Hi,
    Starting Query ****
    select * from ( SELECT T0.Itemcode, min(T0.Dscription) as 'Item Description', W1.Whscode,
    (isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode and O1.docdate&lt;@FromDate and O1.transtype in (59,20,18,16,14,67,-2)),0) - isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode and O1.docdate&lt;@FromDate and O1.transtype in (21,19,60,15,67,-2,13)),0)) as [Opening Stock],
    (isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode and O1.docdate&gt;=@FromDate and O1.docdate&lt;=@ToDate and O1.inqty&gt;0 and o1.Price &gt;0 and O1.transtype in (20,18)),0))-(isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode and O1.docdate&gt;=@FromDate and O1.docdate&lt;=@ToDate and O1.outqty&gt;0 and o1.Price &gt;0 and O1.transtype in (19)),0)) as [Purchase Quantity],
    (isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode and O1.docdate&gt;=@FromDate and O1.docdate&lt;=@ToDate and O1.inqty&gt;0 and o1.Price = 0 and O1.transtype in (20,18)),0))-(isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode and O1.docdate&gt;=@FromDate and O1.docdate&lt;=@ToDate and O1.outqty&gt;0 and o1.Price = 0 and O1.transtype in (19)),0)) as [Purchase FOC Qty],
    ( isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode and O1.docdate&gt;=@FromDate and O1.docdate&lt;=@ToDate and O1.outqty&gt;0 and O1.Price&gt;0 and O1.transtype in (13,15)),0)) as [Sale Qty],
    (isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode and O1.docdate&gt;=@FromDate and O1.docdate&lt;=@ToDate and O1.inqty&gt;0 and O1.Price&gt;0 and O1.transtype in (14,16)),0))as [Return Qty],
    ( isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode and O1.docdate&gt;=@FromDate and O1.docdate&lt;=@ToDate and O1.outqty&gt;0 and O1.Price&gt;0 and O1.transtype in (13,15)),0))- (isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode and O1.docdate&gt;=@FromDate and O1.docdate&lt;=@ToDate and O1.inqty&gt;0 and O1.Price&gt;0 and O1.transtype in (14,16)),0))as [NetSale Qty],
    (isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode and O1.docdate&gt;=@FromDate and O1.docdate&lt;=@ToDate and O1.outqty&gt;0 and O1.Price=0 and O1.transtype in (13,15)),0))-(isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode and O1.docdate&gt;=@FromDate and O1.docdate&lt;=@ToDate and O1.inqty&gt;0 and O1.Price=0 and O1.transtype in (14,16)),0))as [FOC Quantity],
    (isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode and O1.docdate&gt;=@FromDate and O1.docdate&lt;=@ToDate and O1.inqty&gt;0 and O1.transtype in (59)),0)) as [StockIN Quantity],
    (isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode and O1.docdate&gt;=@FromDate and O1.docdate&lt;=@ToDate and O1.outqty&gt;0 and O1.transtype in (60)),0)) as [StockOUT Quantity],
    (isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode and O1.docdate&lt;=@ToDate and O1.transtype in (59,20,18,16,14,67,-2)),0) - isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode and O1.docdate&lt;=@ToDate and O1.transtype in (21,19,60,15,67,-2,13)),0)) as [Closing Stock]
    FROM OINM T0 INNER JOIN OITM T1 ON T0.ItemCode = T1.ItemCode INNER JOIN OITW T2 ON T1.ItemCode = T2.ItemCode INNER JOIN OITB B1 ON T1.ItmsGrpCod=B1.ItmsGrpCod INNER JOIN OWHS W1 ON T2.WhsCode = W1.WhsCode INNER JOIN OLCT C1 ON W1.Location=C1.Code and T0.ItemCode Like '5%' and W1.WhsCode not in ( 'WH-DEMO', 'WH-AHM-R','WH-MUM-R','WH-NDL-R')
    Group by T2.MinStock ,T1.itemcode, T0.Itemcode, W1.WhsCode, C1.Location) a
    End Query ************
    This is correct and complete query i using for reporting
    Thanks & Regards,
    Rajeev

  • Report generation toolkit and signal express user step : problem of closing reference in "Stop" event

    Hi all,
    I'm trying to make a package of Vis to easily make Excel reports with Signal Express. I'm working on LabVIEW 8.2.1.
    I'm using the report generation toolkit, so I build a .llb from my project which contains all the hierarchy of my steps, but also the hierarchy of dynamic VIs called.
    I have made some steps, like "Open Workbook", "Write Data", etc.
    My steps run well, excepts one step : "Close Workbook".
    If my "Close Workbook" step is firing on "Run" Signal Express event, I have no error, so my reference is properly closed.
    But if my "Close Workbook" step is firing on "Stop" Signal Express event, I have an error "1", from "Generate Report Objectrepository.vi".
    I feel that I'm trying to use a reference which has been killed in the "Stop" step...
    I would like to know what exactly do Signal Express on "Stop" event and why my close function does'nt run well.
    Thanks,
    Callahan

    Hi Callahan,
    SignalExpress (SE for short) does the following on the Stop event:
    1. Takes the list of parameters that SE found on your VI's connector pane, and sets the values that the user set from the "Run LabVIEW VI" configuration page, if any.
    2. Then tells the VI that SE is running the Stop event by setting the Enum found on your VI's front panel. This in turn should produce some boolean values telling your VI to execute the Stop case.
    3. The VI is then run, with those values and states.
    4. SE checks to see if any errors where returned.
    5. Since this is the Stop event, SE releases the reference to the VI which it possesses.
    Questions for you would be, is the reference to your Workbook linked to a control on your connector pane, or held in a uninitialized Shift Register. If it's held in a Shift Register, SE would not be aware of it, and would not be able to affect that reference.
    Hope that helps. Feel free to post your LLB if it doesn't.
    Phil

  • Why does opening and closing FPGA references increase Windows XP handles by 3?

    Hello.
    We run a test system here that uses TestStand to communicate
    to a number of Labview VI modules which in turn communicates to a
    PXI-7833R FPGA. Everything has been working fine except after a long time running Labview would get an out of memory error. I discovered
    after a particular VI was run 100,000 times, the number of handles in Windows XP Task
    Manager grew to about 370,000. The number of threads and processes remains stable and normal. Closing Labview removes all the excessive handles.
    I tried an experiment to create a standalone VI (ie: no TestStand) which simply opens the FPGA VI reference then closes the reference. This is repeated 4 times in the same VI. The number of handles in Windows XP Task
    Manager increased by 12 each time the VI was run. No errors. This indicates closing the FPGA reference might not be working.
    Why does this happen? Is there a way to avoid it? The version of Labview is 8.5.1.
    Appreciate any help here. Thanks.
    -Dave

    could be related to this known issue--
    FPGA FIFO reset behavior—When you use an FPGA target
    emulator, FPGA FIFOs reset when the VI is stopped and then started
    again. When you use an FPGA target with Interactive Front Panel
    Communication, FPGA FIFOs do not reset when the FPGA VI is stopped and
    then started again. To reset the FIFO, right-click the FPGA target in
    the Project Explorer window and select Download
    from the shortcut menu. When you control an FPGA VI using Programmatic
    FPGA Interface Communication, use the Close FPGA VI Reference function
    with the Close and Reset shortcut menu option selected or the Invoke Method with the Reset method selected to reset FPGA FIFOs
    see Knowledgebase
    Also remeber to load the FPGA Read/Write VI's dynamically from testStand and dump them after.  Thechange to the data type causes the vi to need to recompile so it can't stay in memory if you need different types of data.
    Message Edited by Jeff Bohrer on 10-27-2009 02:21 PM
    Jeff

  • I am trying to update to i-tunes 11.3 but when I download I get a message that itunes didn't install properly, and a reference to error 127. Any ideas?

    I am trying to update to i-tunes 11.3 but when I download I get a message that itunes didn't install properly, and a reference to error 127. Any ideas?

    For general advice see Troubleshooting issues with iTunes for Windows updates.
    The steps in the second box are a guide to removing everything related to iTunes and then rebuilding it which is often a good starting point unless the symptoms indicate a more specific approach. Review the other boxes and the list of support documents further down page in case one of them applies.
    Your library should be unaffected by these steps but there is backup and recovery advice elsewhere in the user tip.
    tt2

  • How to get vendor name and invoice reference details in asset register

    Hi Experts,
    My client requirement is he want to see Vendor name and invoice reference filed in asset register.
    Is there any standard reports relating this requirement.
    Kindly Provide valuable information relating to this issue.
    Regards
    Madhan

    Hi Madhan,
    Let me know the t.code which you are getting asset data.
    Thanks

  • How to get selection screen elements and its table reference of a report ?

    halo experts
    How can I get selection screen elements and its table reference of a report ? . I tried rs_refresh_from_select_options. But I am unable to get the table and field it is referring to
    For eg if my selection screen 1000 is
    parameters: p_carrid type spfli-carrid,
    select-options :s-_connid type sflight-connid.
    is there any Fm or method which gives me what are the screen elements( p_carrid and s_connid ) and what table( splfi and sflight ) and field ( carrid and conid )it is referring to ?

    The following code is an example of how you might dynamically determine all your PARAMETERS and SELECT-OPTIONS variables at run time.  The PARAMETERS and SELECT-OPTIONS only point to a dictionary element--not a specific table.  Even though you may say "spfli-carrid" or "sflight-connid", the data type really references the dictionary type and not a specific table/structure.
    REPORT  ZTEST_PROG.
    TABLES sflight.
    DATA:
           screen_tab TYPE STANDARD TABLE OF screen,
           wa_screen TYPE screen,
           scrn_nm TYPE string,
           scrn_leftover TYPE string,
           l_type TYPE REF TO cl_abap_typedescr,
           typ_nm TYPE string,
           typ_pre TYPE string.
    FIELD-SYMBOLS <fs_data> TYPE ANY.
    PARAMETERS p_carrid TYPE spfli-carrid.
    SELECT-OPTIONS s_connid FOR sflight-connid.
    INITIALIZATION.
      LOOP AT SCREEN.
        IF screen-group3 = 'PAR'
          OR screen-group3 = 'LOW'.
            APPEND screen TO screen_tab.
        ENDIF.
      ENDLOOP.
    START-OF-SELECTION.
      LOOP AT screen_tab INTO wa_screen.
        ASSIGN (wa_screen-name) TO <fs_data>.
        l_type = cl_abap_typedescr=>describe_by_data( <fs_data> ).
        IF wa_screen-group3 = 'LOW'.
          SPLIT wa_screen-name AT '-' INTO scrn_nm scrn_leftover.
          TRANSLATE scrn_nm TO UPPER CASE.
        ELSE.
          scrn_nm = wa_screen-name.
        ENDIF.
        SPLIT l_type->absolute_name AT '=' INTO typ_pre typ_nm.
        WRITE:
                 / 'Screen Name:  ', scrn_nm,
                 / 'DDIC Type:    ', typ_nm.
      ENDLOOP.
    When you get into defining internal tables you can determine those at run time with cl_abap_structdescr.  The following is an example of how you might do that.  You can loop through the "components_table" and evaluate each field of the structure in this way.
    DATA: structure_reference TYPE REF TO cl_abap_structdescr,
          components_table TYPE abap_compdescr_tab,
          components_structure LIKE LINE OF components_table.
    structure_reference ?= cl_abap_structdescr=>describe_by_data( any_structure ).
    components_table = structure_reference->components.
    I don't know if this answers any of your questions but I hope that some of it is useful.

Maybe you are looking for

  • The underlying connection was closed. An unexpected error occurred on send

    Hi, I am unable to log into the BPC Admin console. I get this error "The underlying connection was closed. An unexpected error occurred on a send". I saw a SAP message indicating that turning the Norton firewall off resolves this. I don't have this o

  • Autocommit in Stored procedures

    Hi all! Can we set the autocommit variable in a stored procedure? if yes, how? regards, Rajat Aggarwal

  • Photos loose their quality when I make a movie

    I'm new to iMovies and I'm creating a movie from photos of a recent event. The photos my wife took are great looking and the size of each photo is 1.7mb. When I drag a photo into the time line viewer, it drags a small size version of the photo (117 k

  • Error when closing Workbench

    We're getting an error when closing workbench -- below is information from the log: !MESSAGE Bundle update@plugins/org.eclipse.emf.compare.diff_0.8.0.v200806180301.jar was not resolved. !MESSAGE Missing required bundle org.eclipse.emf.compare.match_0

  • I cannot get on my email exchange using firefox, and it has been working until today.

    My company uses a owa.postoffice.net exchange, and we are supposed to use internet explorer, or firefox. I have a Mac, so I use firefox, and it has been working fine for the past 90 days, and today, I go to the exchange, type in my password and user