Need help on OLE excel paste in selected cell range

Hi Friends,
I need to paste the clipbord contents in a selected range of cells using ole automation.
Rage is selected using the following code :
CALL METHOD OF G_EXCEL 'Cells' = G_CELL1
    EXPORTING #1 = 4
    #2 = 1.
  CALL METHOD OF G_EXCEL 'Cells' = G_CELL2
    EXPORTING #1 = P_ROW
    #2 = gv_col.
  CALL METHOD OF G_EXCEL 'Range' = G_CELLRANGE
    EXPORTING #1 = G_CELL1
    #2 = G_CELL2.
now need to past the clipbord contents in G_CELLRANGE.
Would appriciate your help,
Thanks,
John

Hi Jhon,
this is the obsolete old way even Rich would not recommend (look at the age of the blog).
There are far better and much more performat ways doing this using Desktop Office Integration.
Refer to this complete documentation of [Desktop Office Integration (BC-CI)|http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCCIOFFI/BCCIOFFI.pdf]
It took me some time to create my first application with DOI, but if you have done you will never want to miss it.
Regards,
Clemens

Similar Messages

  • Need help with Dynamic Excel File Name please.

    I am try to output an excel file with dynamic date. 
    Here what I done.
    I am using SQL 2012.
    Create Execute SQL Task Connect Type: Excel
    Create Data Flow Task set to DelayValidation: True
    Create OLE DB Sourc
    Create Data Converstion
    Excel Destination
    Excel Connection, Expression, select ExcelFilePath
    @[User::sXLFilePath] +  @[User::sFileName] + RIGHT("0" + (DT_WSTR, 2) DATEPART("DD", GETDATE()), 2)+ RIGHT("0" + (DT_WSTR, 2) DATEPART("MM", GETDATE()), 2) + RIGHT((DT_WSTR,
    4) DATEPART("YYYY", GETDATE()), 2) +".csv"
    C:\ExcelOutPut\SOX_CAM_SQL_Report_010215.xls
    What I try to accomplish is output the file with each day append to it, date must be DDMMYY.
    I google it and found many samples, tested it, and none of them is work for me. 
    Any suggestions or some examples to share is greatly appreciate. 
    I am new to SSIS.  I found one poster have similar issue and inside the posted below, there was one suggestion to create variable and connection string but how do I bind that variable to Excel Connection manger.
    Please help.
    Thank you so much in advance.
    Ex: SOX_CAM_SQL_Report _020215.csv
           SOX_CAM_SQL_Report _030215.csv
    --Similar issue:
    https://social.msdn.microsoft.com/Forums/en-US/bda433aa-c8f8-47c9-9e56-efd20b8354ac/creating-a-dynamic-excel-file?forum=sqlintegrationservices
    Suggestion in the above posted but where can bind this to Excel Connection Manger. 
    Please help provide step by step.  Thanks.
    "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\temp\\" + "ExcelTarget" + (DT_WSTR,4)DATEPART("yyyy",GETDATE())  +
    ".xls" + ";Extended Properties=\"EXCEL 8.0;HDR=YES\";"
    And yes, as you were intimating, the delay validation on the dataflow should be set.

    Hi NguyenBL,
    According to your description, you created ssis package to export data from database to excel, when the package runs, you want to create new excel and name the file with time stamp. If that is the case, we can achieve the goal by following steps:
    Create a script task used to create excel files.
    Create a data flow task to export data from database to excel.
    Add OLE DB source to data flow task.
    Add Excel Destination to data flow task.
    Create connection manager for OLE DB and Excel.
    Click Excel Connection Manager, in Properties window, click (…) button next to Expressions, then set ExcelFilePath with expression like below:
    "C:\\ETL Lab\\CreateNewExcel\\ExportData_"+REPLACE((DT_STR, 20, 1252)(DT_DBTIMESTAMP)@[System::StartTime], ":", "")+".xls"
    For detail information, please refer to the document:
    https://sqljourney.wordpress.com/2013/01/12/ssis-create-new-excel-file-dynamically-to-export-data/
    If you have any more questions, please feel free to ask.
    Thanks,
    Wendy Fu
    Wendy Fu
    TechNet Community Support

  • Need help in WAD 7.0 - anaylsis item cell value as filter to another web...

    Hi ,
    I need help in WAD 7.0
    i have 2 web items, analyis item 1 & 2
    when user clicks any cell value in column xxx of analysis item1, then i need to filter the analysis item 2 values for  column xxx  , for that user clicked value.
    how do i enable this ?

    Hi.
    You can try the nxt approach:
    1. in analysis item A (first) properties define in "behaviour" -> "row selection" = "single with command".
    2. set this command to "SET_SELECTION_STATE_BY_BINDING".
    3. define "data provider affected" = your second data provider for analysis item B.
    4. in "selection binding" set needed variables to binding type "VARIABLE"
    In this case, when you select any row in analysis item A some variables will be populatd from this row and affect on analys item B (dataprovider B).
    Regards.

  • Applescript. Select cell range and copy to clipboard

    Hi everyone,
    I have been looking at trying to select a range of cells, eg B1 to H40, once selected I would like to copy the selection to the clipboard.
    I am having difficulty selecting a range of cells...
    any help would be very much appreciated.
    Many thanks
    Phelix

    Prepend my original suggestion to Jerry's and you have what you want:
    Make the Summary table reference only that data you want in your summary:
    select the table
    <JERRY'S SUGGESTION>
    Command-C (Copy)
    Switch to Preview
    Command-N (New document from Clipboard)
    Command-S (Save)
    </JERRY'S SUGGESTION>
    another way to to place the summary table in another sheet.  Then you can just print that sheet to PDF by selecting the sheet, then select the menu item "File > Print…", then the option in the "PDF" menu at the bottom right:

  • Need help to upload Excel Chinese data into Oracle

    Hello
    I am very new at internationalization. We are writing an application that
    reads Chinese data from a Microsoft Excel file and writes it out into Oracle
    8i. This is what we have done:
    1. Use JDBC-ODBC driver to read the Excel data directly from .xls.
    2. Write data into oracle database.
    When we open Excel, we can view the Chinese characters. When we use SQL
    PLus, we see only ????. When we write another servlet to retrieve the data,
    it is displayed as ????. The few questions I have are:
    1. How can I verify that the Chinese data has been accurately inserted into
    the database?
    2. Do I need to set anything special (environment variables, config files
    etc) in BEA Weblogic 5.1 and Oracle 8i?
    The environment we have are:
    1. BEA Weblogic SP9 running on WIn NT.
    2. Oracle 8i running on Solaris.
    Thanks

    Make sure that the characters are correct in the app server after you get
    them out of Oracle and before you put them into the web page. This will help
    you determine if the problem is in the JDBC access to Oracle or the encoding
    into the web page. Make sure that you verify that the hex values of each
    character from the db test case are what you expect.
    Peace,
    Cameron Purdy
    Tangosol Inc.
    << Tangosol Server: How Weblogic applications are customized >>
    << Download now from http://www.tangosol.com/download.jsp >>
    "Bernard Ong" <[email protected]> wrote in message
    news:[email protected]...
    Hi Kev
    1. "It doesn't work" means that I still see ??? in the database. WHen I
    retrieve the data, it is still displayed as ??? in a browser.
    2. Codeset to use to display should be UTF-8.
    3. Charset in database server is UTF8. I did a "select * from
    database_parameters" to get this value.
    4. I copied the Chinese characters from Excel and pasted on Notepad. Icould
    see the Chinese characters with the Chinese emulator turned on. WHen Icopy
    ??? from SQL*Plus and paste it into notepad, I see ???.
    Presume:
    1. Yes, running SQL*PLUS on BEA machine.
    2. BEA machine running on WIndows 200 professional. We downloaded aChinese
    emulator. WIndows 2000 is the English version.
    Cheers
    "Kevin Lu" <[email protected]> wrote in message
    news:[email protected]...
    Hi Bernard,
    Please first clarify:-
    1) "It doesn't work" means... cannot display the chinese character as
    you
    desired?
    2) Which codeset that you want it to display, Chinese traditional big5?UTF-8,
    i would think it's still in Java/JDBC codeset.
    3) What's the charset in the database server? Get help from DBA if you
    not
    sure
    how to obtain this information.
    4) Try paste the result(select via SQL*Plus) onto Win Notepad, what's
    the
    outcome?
    Presume:
    1) you're running SQL*Plus on your BEA machine?
    2) BEA machine is running on Chinese O/S or hv NJStar installed andrunning?
    Let me know if i could be of further help.
    -Kev
    "Bernard Ong" <[email protected]> wrote:
    Thanks Kev.
    We had changed the registry in the BEA machine to
    AMERICAN_AMERICA.UTF8.
    THis was done for the Oracle registry in the BEA machine.
    Unfortunately,
    it
    still doesn't work.
    Cheers,
    Bernard
    "Kevin Lu" <[email protected]> wrote in message
    news:[email protected]...
    Hi Bernard,
    I take about the same approach as you while resolving codeset
    problem.
    So,
    first
    i make sure SQL*Plus could display my desired result before proceedto
    application(be
    it Swing, servlet, JSP console etc..). You may try set the NLS_LANGon
    your client
    machine(same machine as where you run SQL*Plus) to the SAME as
    database
    server
    character set, for instance America_American.US7ASCII. You should
    able
    to
    see
    the Chinese characters.
    Hope this help with your first question. I can't help for the restanyway.
    good luck!
    -Kev
    "Bernard Ong" <[email protected]> wrote:
    Hello
    I am very new at internationalization. We are writing an
    application
    that
    reads Chinese data from a Microsoft Excel file and writes it outinto
    Oracle
    8i. This is what we have done:
    1. Use JDBC-ODBC driver to read the Excel data directly from .xls.
    2. Write data into oracle database.
    When we open Excel, we can view the Chinese characters. When we useSQL
    PLus, we see only ????. When we write another servlet to retrievethe
    data,
    it is displayed as ????. The few questions I have are:
    1. How can I verify that the Chinese data has been accurately
    inserted
    into
    the database?
    2. Do I need to set anything special (environment variables, configfiles
    etc) in BEA Weblogic 5.1 and Oracle 8i?
    The environment we have are:
    1. BEA Weblogic SP9 running on WIn NT.
    2. Oracle 8i running on Solaris.
    Thanks

  • Need help with command - trying to target selected html in document

    Hi,
    I am very new to working with JS. I can do simple stuff but when it comes to manipulating the dom, I don't know very much. So, I am trying to develop this command for Dreamweaver that will find all occurances of an abbreviation. Ex. GOC (Government of Canada) and wrap the text with <abbr> tags that include the title attribute. I have been using the change case example on the web that details how to go about setting up a DW command.
    My JS file looks like this:
    function canAcceptCommand(){
        var theDOM = dw.getDocumentDOM(); // Get the DOM of the current document
        var theSel = theDOM.getSelection(); // Get start and end of selection
        var theSelNode = theDOM.getSelectedNode(); // Get the selected node
        var theChildren = theSelNode.childNodes; // Get children of selected node
        return (theSel[0] != theSel[1] && (theSelNode.nodeType == Node.ELEMENT_NODE
        || theSelNode.hasChildNodes() && (theChildren[0].nodeType ==
        Node.ELEMENT_NODE)));
    function abbr(){
      var theDOM = dw.getDocumentDOM();
              // Get the outerHTML of the HTML tag (the entire contents of the document).
              var theDocEl = theDOM.documentElement;
              var theWholeDoc = theDocEl.outerHTML;
              //while the position of a double space is not equal to -1, so there is one
              while(theWholeDoc.search("FSWEP") != "-1"){
                        //use reg exp to replace all spaces, which is useful for processing multiple lines at once
                        theWholeDoc = theWholeDoc.replace(/(FSWEP)/g, "<abbr>ASAP<\/abbr>");
              //loop back around until there are no double spaces
              theDocEl.outerHTML = theWholeDoc;
              theDOM.formatRange(0, theWholeDoc.length);
              window.close(); // close extension UI
    In it's current state, it will do a replacement of FSWEP anywhere it shows up in the document. What I need it to do is only replace those occurances that are part of the selected HTML block and are part of a text node.
    If there is anybody out there who can help me with this, I would really appreciate any assistance you might provide. At a very minimum, could you point me to some helpful resources that will help me figure out how to target chuncks of code in a DW HTML file.
    Thanks,
    Rob

    This question is more appropriate for the Acrobat JavaScript forum at http://forums.adobe.com/community/acrobat/acrobat_scripting.

  • Need help-problem importing excel files

    I am about to begin work on an annual report that will involve importing charts and tables from an Excel file. I am able to drag and drop the pie charts and bar graphs into Indesign. When I try to do the same with the tables, they don't come across. When I import the excel file using the "place" command in Indesign , the files comes through as text only. I need the chart design and formatting. Any ideas?

    If this is going to press then you absolutely should bring those charts into Illustrator. At the very least you want to make sure to convert the RGB black text to real black.
    As for the tables, when you place the Excel file, make sure that show options is selected in the place dialog box. Then choose the proper formatting for the table. If you already formatted everything in Excel, choose Formatted Table. I think you'll be fairly pleased.
    Bob

  • Need help planning wireless home network and selecting hardware

    I run a music teaching business from home and currently I just have an iMac, an HDTV, a printer and an external HD (for Time Machine backups). My computer and peripherals are in a small study and my TV is in the front room where I now teach. I want to set up a wireless network which will let me do the following:
    1) Access either my iMac's HD and/or my external drive's HD to retrieve and display documents and run applications from the front room, where my TV is located.
    2) Use my HDTV as an extension of my iMac so that what happens on my iMac displays on my TV, including accessing the printer and other input devices that may be attached.
    What hardware will I need for this besides an Aiport (Extreme?) base station, and how would I hook everything up wirelessly, specifically my TV? If I connect Apple TV to my TV via HDMi will I be able to do what I've stated above, and access my applications as well as music and photos? If not, what's the alternative? A Mac Mini connected via HDMi? Won't that make my iMac's HD redundant to the above scenario?
    Hope someone can help me sort this out.

    Hi there,
    It sounds like what you want to do is basically use your HDTV as a monitor for your computer. Devices like AppleTV will not run apps nor show the screen of other computers; for that you need some kind of VNC software (either free or something like Back to my Mac) AND a second computer hooked up to the HDTV. So you're looking at a Mac Mini and an Airport network to connect the two, then a wireless mouse and keyboard to control it. And even then, you may want to just open documents on the mini so you'll need to have a system of syncing between the two Macs if you need to access the same docs on the iMac later.
    If you don't want a second Mac then you could use a mini display port to HDMi adapter and a really long HDMI run up to your HDTV, and then hope that a Bluetooth keyboard would still be in range to control the iMac (30 ft or less I believe). That's cheaper, but you have the long cable to contend with.
    HTH, JVK

  • Need help in jsp excel integration

    hello all
    plz help me in creating a excel file using jsp and writing data on to it .
    i also want to implement multi record additions ie create 2 rows of text fields and if i save the data it should be saved each in different rows(2 rows)

    Hi Katherine,
    you should update your version to Faces 1.0 Final and download the nightly build of struts-faces. It has been updated recently to work with the Final.

  • Need help with parameter fields and report selection.

    Hi all:
    I hope some one can help me with the problem I am having with my parameter field and record selection.
    First, can anyone explain to me why my parameter field CustStart, which is dynamic and is based on the field Customer in the table CustMaster.  There are over 1800 records in the CustMaster table but the drop down list only shows maybe about half of them and there is no way to scroll down to the last customer record.  What am I doing wrong?
    Second, is there any way to base a parameter field on a formula field on my report?  On my report I have created a field Cust that is the customer name and number joined together in one field.  I would very much llike to use this formula in my record selection and in my parameter field.  Can it be done?
    All help is greatly appreciated
    Thanks,
    FatMan

    Hi,
    You can use the following for changin increasing the LOV.
    Crystal Reports XI BusinessObjects Enterprise XI
    For performance reasons, in Crystal Reports XI Release 1 and Release 2 the maximum number of values that are returned for a list of values is set to 1000. If you have a cascading List of Values (for example Country > Region > City), the lowest level (in this case City) will only display a maximum of 1000 values. This means that the higher-level prompts may display far fewer values than you expect. The list of values provides the data for the dynamic parameter list.
    How can you modify the maximum number of values available in a dynamic parameter list?
    Resolution
    To increase the maximum number of values available in a dynamic parameter list, you must add a registry key.
    CAUTION     The following resolution involves editing the registry. Using the Registry Editor incorrectly can cause serious problems that may require you to reinstall the Microsoft Windows operating system. Use the Registry Editor at your own risk. For information on how to edit the registry key, view the 'Changing Keys and Values' online Help topic in the Registry Editor (Regedit.exe).
    It is strongly recommended that you make a backup copy of the registry files (System.dat and User.dat on Win9x computers) before you edit the registry.
    Crystal Reports XI Release 1
    1.     Create a registry key HKEY_LOCAL_MACHINE\SOFTWARE\Business Objects\Suite 11.0\Crystal Reports\DatabaseOptions\LOV.
    NOTE     Alternatively, you can create the registry key HKEY_CURRENT_USER\SOFTWARE\Business Objects\Suite 11.0\Crystal Reports\DatabaseOptions\LOV and that key will override the settings of the HKEY_LOCAL_MACHINE\SOFTWARE\Business Objects\Suite 11.0\Crystal Reports\DatabaseOptions\LOV key.
    2.     Add a string value "MaxRowsetRecords" and set the value to the maximum number of values that you desire for your report. For example, a value of 2000 will return up to 2000 values in the lowest level of a cascading parameter. NOTE: The value 0 (Unlimited) will not work with BusinessObjects Enterprise XI or Crystal Reports Server XI, you must specify another value.
    NOTE     The higher the number of values is, the longer it will take the Enter Values dialog box to populate with values.
    3.      After making changes to the registry, restart the affected service or application as required.
    Crystal Reports XI Release 2
    1.     Create a registry key HKEY_LOCAL_MACHINE\SOFTWARE\Business Objects\Suite 11.5\Crystal Reports\DatabaseOptions\LOV.
    NOTE     Alternatively, you can create the registry key HKEY_CURRENT_USER\SOFTWARE\Business Objects\Suite 11.5\Crystal Reports\DatabaseOptions\LOV and that key will override the settings of the HKEY_LOCAL_MACHINE\SOFTWARE\Business Objects\Suite 11.5\Crystal Reports\DatabaseOptions\LOV key.
    2.     Add a string value "MaxRowsetRecords" and set the value to the maximum number of values that you desire for your report. For example, a value of 2000 will return up to 2000 values in the lowest level of a cascading parameter. 
    NOTE     The value 0 (Unlimited) will not work with BusinessObjects Enterprise XI or Crystal Reports Server XI, you must specify another value.
    3.     After making changes to the registry, restart the affected service or application as required.
    I hope this helps you.
    Regards,
    Prashant

  • Need Help, Elements keeps crashing when I select the "Organize" option

    Hey Everyone,
    Hopefully someone here can help me out because the customer support has not been very helpful at figuring this out.
    I am running Windows 7.
    I purchased Adobe Premiere Elements and Photoshop at my local Best Buy, and then installed them onto my computer. When I click to open up Premiere Elements I get the a window that pops open, and it has 3 different options:
    Organize
    New Project
    Edit Project (or something along those lines. I forget the exact title of this option).
    If I choose New Project or Edit project everything is fine, and the program opens up for me and I can start working on my videos.
    Whenever I select Organize, the program crashes and a crash report is generated. I am basically unable to access the program through the Organize option because it crashed and then shuts down.
    The same thing happens with Adobe Photoshop when I click on the Organize option there. So far the customer support guys on line have not been able to give me any instructions that have worked to fix it.
    I was hoping maybe one of you out there had a similar problem when you first started running this program and might be able to help me out. Any help will be appreciated.
    Thank You,
    Gerry

    There can be many reasons for Organizer crash.Try the troubleshooting steps mentioned in: http://www.johnrellis.com/psedbtool/photoshop-elements-faq.htm#_Troubleshooting_Organizer_ crashes

  • I need help converting an excel formula to javascript for a fillable form.

    Here is the scenario,
    If a person travels for 1 or 2 days we pay out a mealsrate of 75% per day. If 3 or more days we pay # days less 2 days * 25%. I hope that makes sense.
    V7 = Days, F14 = Mealsrate
    Formula in Excel
    =IF($V$7 = 1,$F$14*0.75,($V$7*$F$14)-(($F$14*0.25)*2))  and it works.
    I am VERY NEW to javascript (like yesterday) so don't laugh. I really have no idea what I am doing, but I was trying. Here is what i got. (by the way, It doesn't work)
    if(this.getField( ("Days").value=="1")){
    var f =this.getField("Mealsrate");
    event.value= f.value * .75;
    }else event.value = (Days * f.value)- (f.value *.25)*2;
    I appreciate all the help i can get.
    Tracie
    I'll be back on Monday, I hope I can find my post.

    OK, that Excel formula can be reduced a bit. The following custom Calculate scipt will do what the formula does:
    // Custom Calculate script
    (function () {
        // Get the inputs
        var days = getField("Days").value;
        var rate = getField("Mealsrate").value;
        // Set this field value
        if (days == 1) {
            event.value = 0.75 * rate;
        } else {
            event.value = (days - 0.5) * rate;
    It would make sense to add additional code to deal with negative numbers in either of the input fields.
    Edit: corrected a typo

  • Need help in query..for a select / update on multiple rows

    DROP TABLE TEST;
    CREATE TABLE TEST (ACCOUNT_NUMBER VARCHAR2(30), TIER_NUMBER NUMBER, FROM_DATE DATE, TO_DATE DATE)
    INSERT INTO TEST(ACCOUNT_NUMBER, TIER_NUMBER, FROM_DATE, TO_DATE) VALUES ('11111', 1, '28-FEB-11','28-FEB-11');
    INSERT INTO TEST(ACCOUNT_NUMBER, TIER_NUMBER, FROM_DATE, TO_DATE) VALUES ('11111', 2, '28-FEB-11','28-FEB-11');
    INSERT INTO TEST(ACCOUNT_NUMBER, TIER_NUMBER, FROM_DATE, TO_DATE) VALUES ('11111', 3, '28-FEB-11','01-MAR-11');
    INSERT INTO TEST(ACCOUNT_NUMBER, TIER_NUMBER, FROM_DATE, TO_DATE) VALUES ('11111', 1, '01-MAR-11','01-MAR-11');
    INSERT INTO TEST(ACCOUNT_NUMBER, TIER_NUMBER, FROM_DATE, TO_DATE) VALUES ('11111', 2, '01-MAR-11','01-MAR-11');
    INSERT INTO TEST(ACCOUNT_NUMBER, TIER_NUMBER, FROM_DATE, TO_DATE) VALUES ('11111', 1, '02-MAR-11',NULL);
    INSERT INTO TEST(ACCOUNT_NUMBER, TIER_NUMBER, FROM_DATE, TO_DATE) VALUES ('11111', 2, '02-MAR-11',NULL);
    INSERT INTO TEST(ACCOUNT_NUMBER, TIER_NUMBER, FROM_DATE, TO_DATE) VALUES ('11111', 3, '02-MAR-11',NULL);
    in this table, for each FROM_DATE, the TO_DATE value should be same for all tiers.
    In the above data, for FROM_DATE = 28-Feb-11, there are 3 rows with TIER_NUMBER = 1, 2, 3.
    TIER_NUMBER = 1,2 --> TO_DATE = 28-FEB-11
    But for TIER_NUMBER = 3 --> TO_DATE = 01-MAR-11 (this occurred due to some incorrect logic).
    Any help on how to identify such records with wrong data?
    And how to update the TIER_NUMBER=3 row with TO_DATE = 28-FEB-11 (whatever we have in TO_DATE for TIER_NUMBER = 1 as that is the minimum tier)?
    The table would contain millions of accounts and atleast 6 rows for each account.
    Thanks.

    Hi,
    I think this should solve your problem
    Declare
    todate date;
    differenc number;
          CURSOR myCursor IS
           select to_date, FIRST_VALUE(TO_DATE) over
    (partition by account_number, from_date order by tier_number) - to_date as differ from test
            FOR UPDATE of to_date;
       BEGIN
         FOR idx IN myCursor LOOP
           todate :=idx.to_date;
            differenc := idx.differ;
            UPDATE test
            SET to_date = todate + differenc
          WHERE CURRENT OF myCursor;
         END LOOP;
         COMMIT;
       END;
       /It both finds and updates rows that doesn't have correct to_date value

  • Need help in logic change to avoid select statement inside loop .

    Hello all ,
    Please see the below code . Here i got the shipment number in internal table  IT_VTTK . So For this shipment number i want to get the details from Vekp table in to internal table  IT_VEKP  . There is no need for me to use For all entries . I have passed the value of it_vekp into work area wa_vekp and getting the details in to IT_vekp using loop.
    But since we should not use the select statement inside the loop , Can anybody please tell me how to achieve this functionality .
    Instead of passing into work area wa_vttk if i directly use the internal table I'm getting the following error .
    "IT_VTTK" is a table without a header line and therefore has no component called "TKNUM".
    Hence i have used select statement inside a loop . Please tell me is there any other way to avoid this ?
    types:begin of ty_likp,
            vbeln type likp-vbeln,
           end of ty_likp,
           begin of ty_vttk,
            tknum type vttk-tknum,
            end of ty_vttk.
    DATA: IT_VEKP TYPE STANDARD TABLE OF TY_VEKP,
          WA_VEKP TYPE TY_VEKP.
      data:it_likp type standard table of ty_likp,
           wa_likp type ty_likp,
           it_likp1 type standard table of ty_likp,
           it_vttk type standard table of ty_vttk,
           wa_vttk type ty_vttk.
      data:w_tknum type vttk-tknum.
    if not it_likp is initial .
        select vbeln
                from
                 vbfa
          into table it_vttk
           for all entries in it_likp where vbelv = it_likp-vbeln and vbtyp_n = '8'.
      endif .
    IF IT_VTTK[] IS NOT INiTIAL.
        loop at it_vttk into wa_vttk.
        SELECT venum
               EXIDV
               EXIDV2
               BRGEW
               NTGEW
               GEWEI
               TARAG
               GEWEI
               VHART
               INHALT
             FROM VEKP INTO TABLE IT_VEKP where VPOBJKEY = wa_vttk-tknum  and vpobj = '4'.
          endloop.
          endif.

    Hello,
    Why would you not like to use FOR ALL ENTRIES in the second select? Is it becasue of the length or type mismatch error between the fields VPOBJKEY and wa_vttk-tknum ?
    Vikranth

  • Help writing a excel function to a cell using powershell

    I have been working on a function that will write worklog information to an excel template. I am able to get it to work but once i added the date column and tried to write a excel function to it I'm getting the below error.
    Exception setting "Item": "Exception from HRESULT: 0x800A03EC"At
    C:\Users\shuppz\Documents\WindowsPowerShell\Modules\Client Config CDRL\Source\Get-Assignment.ps1:1482 char:4
    + $Main.Cells.Item($i, 9) = $DateFunction
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [], SetValueInvocationException
    + FullyQualifiedErrorId : CatchFromBaseAdapterParameterizedPropertySetValueTI
    the excel string i need to add to the cell is to add a date and the string i created is in the below function called $DateFunction.
    Function Create-Worklog
    Param ($NewFile, $DBName, $Work)
    $before = @(Get-Process [e]xcel | %{ $_.Id })
    $ExcelObject = new-Object -comobject Excel.Application
    $ExcelId = Get-Process excel | %{ $_.Id } | ? { $before -notcontains $_ }
    $ExcelObject.visible = $False
    $ExcelObject.DisplayAlerts = $False
    $ActiveWorkbook = $ExcelObject.WorkBooks.Open($NewFile)
    $Main = $ActiveWorkbook.Worksheets.Item('Worklog')
    $Main.Cells.Item(2, 6) = $(Get-Date -f MM/dd/yyyy)
    $Main.Cells.Item(3, 6) = $($DBName.Replace(".accdb",""))
    $i = 6
    ForEach ($W in $Work)
    $DateFunction = "=IF (G$i = " + [char](34) +"Mitigated" + [char](34) + ", TODAY(), IF (G$i = " + [char](34) +"Escalated" + [char](34) + ", TODAY(), IF (G$i = " + [char](34) +"Offline"", TODAY(), " + [char](34) +")))"
    $Main.Cells.Item($i, 1) = $W.Workstation
    $Main.Cells.Item($i, 2) = $W.VulnCount
    $Main.Cells.Item($i, 3) = $W.OS
    $Main.Cells.Item($i, 4) = $W.AuditID
    $Main.Cells.Item($i, 5) = $W.Name
    $Main.Cells.Item($i, 6) = $W.Fix
    $Main.Cells.Item($i, 7) = "Open"
    $Main.Cells.Item($i, 9) = $DateFunction
    $TBString = "{0},{1}" -f $W.Workstation, $W.AuditID
    $Main.Cells.Item($i, 12) = $TBString
    $i++
    $ActiveWorkbook.SaveAs($NewFile)
    $ExcelObject.Quit() | Out-Null
    [System.Runtime.Interopservices.Marshal]::ReleaseComObject($ExcelObject)
    Stop-Process -Id $ExcelId -Force -ErrorAction SilentlyContinue
    If someone can help me figure out how to add this custom excel function. When I run the function everything gets filled out but the date function.

    Try this instead:
    $DateFunction = "=IF (G$i = `"Mitigated`", TODAY(), IF (G$i = `"Escalated`", TODAY(), IF (G$i = `"Offline`", TODAY(), `"`")))"
    You can just escape the " with a backtick ` you don't need + [char](34) +
    You were also missing a double-quote at the end of the formula which is probably what was causing the problem.
    I hope this post has helped!

Maybe you are looking for