Need a small change in this code, GUI_DOWNLOAD. FILE NAME ??

Hi All,
I want to write a program to download data from VBAK. I have tried this and working fine but I have made my file name constant. Instead I want user to make a choice of file name and its location to save.
Also please review this code and let me know, how can I improve my programming skills...
*& Report  ZSAI1
REPORT  ZSAI1.
tables : vbak.
data : begin of it_vbak occurs 0,
       vbeln like vbak-vbeln,
       auart like vbak-auart,
       audat like vbak-audat,
      end of it_vbak.
data : i_filename type string value 'C:\Documents and Settings\venki\Desktop\text.xls'.
selection-screen begin of block sc1 with frame.
select-options : s_vbeln for vbak-vbeln.
selection-screen  Skip 3.
parameters : i_excel radiobutton group Rb1,
             i_text radiobutton group Rb1.
selection-screen end of block sc1.
perform select_dt.
if i_excel = 'X'.
  perform download_excel.
endif.
*&      Form  download_excel
FORM download_excel .
CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
  BIN_FILESIZE                    =
    FILENAME                        = i_filename
   FILETYPE                        = 'ASC'
  APPEND                          = ' '
  WRITE_FIELD_SEPARATOR           = ' '
  HEADER                          = '00'
  TRUNC_TRAILING_BLANKS           = ' '
  WRITE_LF                        = 'X'
  COL_SELECT                      = ' '
  COL_SELECT_MASK                 = ' '
  DAT_MODE                        = ' '
  CONFIRM_OVERWRITE               = ' '
  NO_AUTH_CHECK                   = ' '
  CODEPAGE                        = ' '
  IGNORE_CERR                     = ABAP_TRUE
  REPLACEMENT                     = '#'
  WRITE_BOM                       = ' '
  TRUNC_TRAILING_BLANKS_EOL       = 'X'
  WK1_N_FORMAT                    = ' '
  WK1_N_SIZE                      = ' '
  WK1_T_FORMAT                    = ' '
  WK1_T_SIZE                      = ' '
IMPORTING
  FILELENGTH                      =
  TABLES
    DATA_TAB                        = it_vbak
  FIELDNAMES                      =
EXCEPTIONS
   FILE_WRITE_ERROR                = 1
   NO_BATCH                        = 2
   GUI_REFUSE_FILETRANSFER         = 3
   INVALID_TYPE                    = 4
   NO_AUTHORITY                    = 5
   UNKNOWN_ERROR                   = 6
   HEADER_NOT_ALLOWED              = 7
   SEPARATOR_NOT_ALLOWED           = 8
   FILESIZE_NOT_ALLOWED            = 9
   HEADER_TOO_LONG                 = 10
   DP_ERROR_CREATE                 = 11
   DP_ERROR_SEND                   = 12
   DP_ERROR_WRITE                  = 13
   UNKNOWN_DP_ERROR                = 14
   ACCESS_DENIED                   = 15
   DP_OUT_OF_MEMORY                = 16
   DISK_FULL                       = 17
   DP_TIMEOUT                      = 18
   FILE_NOT_FOUND                  = 19
   DATAPROVIDER_EXCEPTION          = 20
   CONTROL_FLUSH_ERROR             = 21
   OTHERS                          = 22
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM.                    " download_excel
*&      Form  download_text
FORM download_text .
ENDFORM.                    " download_text
*&      Form  select_dt
FORM select_dt .
select vbeln auart audat from vbak
       into table it_vbak where
       vbeln in s_vbeln.
ENDFORM.                    " select_dt
Thank You once gain.
Regards
Venkat
Message was edited by:
        venkat Kumbham

Check the below code :
REPORT ZSAI1.
tables : vbak.
data : begin of it_vbak occurs 0,
vbeln like vbak-vbeln,
auart like vbak-auart,
audat like vbak-audat,
end of it_vbak.
data v_file type string.
*data : i_filename type string value
*'C:\Documents and Settings\venki\Desktop\text.xls'.
selection-screen begin of block sc1 with frame.
select-options : s_vbeln for vbak-vbeln.
selection-screen Skip 3.
parameters p_file like rlgrap-filename.
parameters : i_excel radiobutton group Rb1,
i_text radiobutton group Rb1.
selection-screen end of block sc1.
at selection-screen on value-request for p_file.
F4 value for file
  perform file_get.
start-of-selection.
perform select_dt.
if i_excel = 'X'.
perform download_excel.
endif.
*& Form download_excel
FORM download_excel .
v_file = p_file.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = v_file
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = it_vbak
FIELDNAMES =
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " download_excel
*& Form download_text
FORM download_text .
ENDFORM. " download_text
*& Form select_dt
FORM select_dt .
select vbeln auart audat from vbak
into table it_vbak where
vbeln in s_vbeln.
ENDFORM. " select_dt
*&      Form  file_get
      text
-->  p1        text
<--  p2        text
FORM file_get.
  CALL FUNCTION 'WS_FILENAME_GET'
       EXPORTING
            DEF_PATH         = 'C:\Temp\'
            MASK             = ',.,..'
            MODE             = 'O'
            TITLE            = 'Select File'(007)
       IMPORTING
            FILENAME         = P_file
       EXCEPTIONS
            INV_WINSYS       = 1
            NO_BATCH         = 2
            SELECTION_CANCEL = 3
            SELECTION_ERROR  = 4
            OTHERS           = 5.
ENDFORM.                    " file_get
Thanks
Seshu

Similar Messages

  • Action hard codes custom file name

    I recorded an action to crop and save for web. I have done this 1000's of times over the years, but in CS6 it is hardcoding a Custom File Name, and in the wrong format too boot.
    I am saving as JPG only and accepting the default name, which should leave me with an action that has no custom name, yet it does, and the custom name is of an HTML file name.
    So, when I run my action, it names every single file the same name, and never creates a jpg.
    This is a new bug in CS6. It wasn't here before.
    I can't figure out how to get around it????
    Kirk

    Figured out a way to work around this, but it is irritating. Instead of my action doing this:
    Flatten
    Crop (user interaction)
    Save For Web
    Close (without saving)
    I have to do this:
    Flatten
    Save as JPG (in same directory where I want the Web file to go)
    Crop (user interaction)
    Save For Web (Over top last saved file)
    Close (without saving)
    For some reason, when I use the save as JPG, it doesn't custom code the file name and when I save for web in the same place it also doesn't custom code the file name.
    I never had to do this before in all the years of using this type of action, and I use it ALOT!
    I have found that it sometimes does not hardcode the file name, but there seems to be no rhyme or reason.
    Kirk
    Photoshop CS6 on Windows7-64, haven't tested this on my MBP

  • How does the Object Reference change in this code ?

    Hi Folks,
    This is my code :
    package assignments;
    class Value
         public int i = 15;
    } //Value
    public class Assignment15
         public static void main(String argv[])
              Assignment15 t = new Assignment15();
              t.first();
         public void first()
              int i = 5;
              Value v = new Value();
              v.i = 25;
              second(v, i);
              System.out.println(v.i);
         public void second(Value v, int i)
              i = 0;
              v.i = 20;
              Value val = new Value();
              v = val;
              System.out.println(v.i + " " + i);
    } // Test
    O/P :
    15 0
    20The output I expected was 15 0 15.
    If the value object created in the second() assigns the value 15 to variable v,why does v.i in the last sysout print 20 ?
    Thank you for your consideration.

         public void second(Value v, int i)
              i = 0;
              v.i = 20;
              Value val = new Value();
              v = val;
              System.out.println(v.i + " " + i);
         }There are two sources of confusion in this code:
    1) for clarity, you shouldn't name second()'s argument "v"; as pbrockway points out, this variable v is a completely different variable from first()'s "v" variable, it just happens to contain a reference to the same object as first()'s "v". Rename the argument to "v2" and it should clarify things (note: this is not a general recommendation, this naming is perfectly valid and makes sense, just not to you yet).
    2) You are assigning a new value (the reference denoted by "val") to the argument variable v. That is bad practice (even for seasoned Java developers).Although the Java compiler accepts it gladly, it brings confusion: it does change the value of the "local variable" v2, but doesn't change the value of the variable "v" in method first(), from which v2 was copied when invoking second().
    Indeed I've seen coding conventions that recommend to add a "final" specifier in front of method arguments, this way:
           public void second(final Value v, int i)
              i = 0;
              v.i = 20;
              Value val = new Value();
              v = val; // does not compile
              System.out.println(v.i + " " + i);
         }This way the compiler rejects the v=val assignment: if you want to do something similar to your previouscode, you have to introduce a new local variable, that is, local to second()'s body, and clearly unknown to first().
    Consider the new code after implementing my suggestions: does it clear the doubts?
    package assignments;
    class Value
         public int i = 15;
    } //Value
    public class Assignment15
         public static void main(String argv[])
              Assignment15 t = new Assignment15();
              t.first();
         public void first()
              int i = 5;
              Value v = new Value();
              v.i = 25;
              second(v, i);
              System.out.println(v.i);
         public void second(final Value v2, int i)
              i = 0;
              v2.i = 20;
              Value val = new Value();
              Value anotherValueVariableWhichDoesNotEscapeThisMethod = val;
              System.out.println(v2.i + " " + i);
              System.out.println(anotherValueVariableWhichDoesNotEscapeThisMethod.i + " " + i);
    } // Test

  • Need a way of calling this code from a button

    Hi all
    I am sorry to have to ask this but I can not find any info on this.
    I found this code somewhere on the net. I should be able to delete a folder with file inside of it.
    I need to call this when a button is clicked.
    CAN ANYONE HELP ME or show me away of deleting a folder with files inside from a button?
      public  static boolean deleteDir(File dir) {
       dir = new File ("Epod Configuration/Config Files/Temp Image Files/");
        if (dir.isDirectory()) {
          String[] children = dir.list();
          for (int i = 0; i < children.length; i++) {
            boolean success = deleteDir(new File(dir, children));
    // The directory is now empty
    return dir.delete();

    First have your class implement the Actionlistener interface then do this:
    //create a button object
    Button b = new Button("Delete");
    //listen for action on the button.
    b.addActionListener(this);
    //add the button to the container.
    add(b);
    //call the method to delete the directory when button is clicked.
    public void actionPerformed(ActionEvent e) {
    if ("Delete".equals(e.getActionCommand())) {
    deleteDir(File dir);

  • Dealing with small changes to MS Word source file when creating a form

    I have an MS Word 2007 file that I converted to PDF in Acrobat Professional 9.0 and converted the PDF to a fillable form.  I spent several hours yesterday working with the field types and adding submit buttons/radio buttons, etc.  This morning, my supervisor made a few (slight) changes to the source document.  Must I start all over again with adding the fields, changing the field types and the submit buttons, or is there an easy way to place the form field data over the new file? Copy and paste the fields into the new file?
    The small changes related to some placement of text, and not changes that could be made with the touch-up text or typewriter tools.

    The steps:
    1. Create the new PDF of the WORD document.
    2. Open a COPY of the old form.
    3. Use DOCUMENT>Replace pages to replace the page of the old PDF with the new PDF document.
    4. Save the form.
    If you created the form in Designer, this may not work and you may have to look for a solution in Designer (LiveCycle forum). I suspect this may be an issue if you are new to Acrobat and likely ended up making the form in Designer. For a form created with the form tools under TOOLS in Acrobat, the above steps will do the job. Keep in mind that form fields are not a part of the PDF document, but are markup. That is why the replace pages works.

  • Need action to save a copy with original file name with suffix

    Hi All,
    I am using photoshop 7 (yeah its old, but working fine for me for general purposes). The problem is I have got this new task where I have to provide 3 copies of the same image but with different portions of it. I have several images (.jpeg) which I need to crop two parts of the image and save as two new image files. The requirement is that I need the copy images to bear the same name as the original and with a suffix to identify which cropped portion of the image is it. example, original file name is AB1001.jpg (1600x1200), 1st cropped image name to be AB1001_P.jpg (200x250) and the 2nd cropped image name to be AB1001_Q.jpg(100x180). I have around a 180 files, so need to do it in a batch, pls suggest how can it be done.
    Any help in this regard is much appreciated.
    Regards
    Chhuppa Rustam

    While a script would probably be best, photoshop 7 requires
    you download a scripting plugin which may or may not install
    in photoshop 7 depending on your version.
    You can probably do what you want with actions. The file naming part
    is not hard, but i have a couple of questions about the cropping.
    Are all the images the same size and are the crops in the same position for each?
    In other words on the P crop (200x250), is the crop in the same position on each
    image or different for each?
    MTSTUNER

  • Need help with EXS24 "read velocity range from file name"

    I am trying to import 127 drum samples to a single key using the option shown here. The option says "Map to key dropped on and read velocity range from file name". I can find no documentation in the manuals on how to do this. What is the syntax required in the file name to make this work? I need to do several of these imports. The capability is cleary there, but I need help on how the file name should be formatted. My thanks to anyone who can help.

    Hi
    Not a direct answer to your question, but if you are doing a lot of sample mapping etc, you may want to check out Redmatica's KeyMap Pro or the simpler Keymap 1:
    http://www.redmatica.com
    CCT

  • Aperture: How can I batch change one part of a file name

    I have a file name format for my motor sport pictures
    EventNameYear_CarNumber_ImageNumber
    I have just named 600+ images but after publishing the images, I spotted I put the event year as 2014 instead of 2015.
    How can I batch change the year but leave everything else the same? I've been through the batch change options but cannot work it out
    I am on Aperture 3.6, MacBook Pro on Yosemite 10.10.2
    Thanks

    So you renamed the versions in Aperture, the rename was not just done on the export?
    The names could be changed either in Aperture or on the exported files but as was noted it would require a script to do it. Doing the rename on the exported files would be the easiest, Applescript or possibly even Automator or any number of 3rd party apps could handle this rather easily. Name Mangler comes to mind as possibly being able to handle this.

  • Need a little help with this code

    Hi,
    right now I'm going through the xmlmenu tutorial, which I've
    found at kirupa.com. It's pretty much clear to me. Then I decided
    to try to import a blur filter. And as soon as I wright the import
    flash.filter line, I get a syntax error. Where is the problem? How
    do I get button's blurx/y = 0 onRollover? I was thinking to apply
    the filter to menuitem mc (see the code)
    Here's the code

    yes, you are right - flash.filters. Another "syntax error"
    ;-). I did manage to get it work (the import line part). My next
    question is to which MC must I apply the blur filter to get next
    result:
    by default the buttons are blured. OnRollOver the button gets
    cleared of blur. Here's my blur code:
    var myBlur = new flash.filters.BlurFilter(20,20,2);
    var myTempFilters:Array = _root.mainmenu_mc.filters;
    ->which MC must be here to get the wanted result??????
    myTempFilters.push(myBlur);
    _root.mainmenu_mc.filters = myTempFilters;
    curr_item.onRollOut = function() {
    myBlur.blurX = 20;
    myBlur.blurY = 20;
    this.filters = new Array(myBlur);
    curr_item.onRollOver = function() {
    myBlur.blurX = 0;
    myBlur.blurY = 0;
    this.filters = new Array(myBlur);
    THX for your help

  • Need to make changes in the code for ME21

    Hi everyone,
    My requirement is as below.
    Whenever I create any any PO using ME21 by copying any existing PO, the value for Pay Tems (EKKO-ZTERM) comes from the PO from which I am copying. But requirement is that the value for Payment Term should populate from the Vendor Master(LFB1-ZTERM). I tried to use implicit enhancement and make changes in the include MM06EF0E_EKKO_ZTERM but I am getting the error message as *u2018Object cannot be enhanced - Software Component unknown and cannot be enhancedu2019*. Please help me how to come out of this issue or is there any other method to meet my requirement other than using implicit enhancement.

    Hi,
    You can use BADI ME_PROCESS_PO_CUST -> PROCESS_ITEM -> SET_HEADER   to change the header fields.
    Thanks,
    Pawan Gore

  • How can I fix this code ?

    hello,
    I have a small problem with this code:
    #include  <fstream>
    #include  <iostream>
    #include  <algorithm>
    #include  <iterator>
    #include  <string>
    #include  <vector>
    using namespace std;
    int main()
         string from, to;
         cin >> from >> to;
         ifstream is(from.c_str());
         istream_iterator<string> ii(is);
         istream_iterator<string> eos;
         //  line 24: Error:
         vector<string> b(ii, eos);  //  line 24: Error:
         sort(b.begin(), b.end());
         ofstream os(to.c_str());
         ostream_iterator<string> oo(os, "\n");     
             unique_copy(b.begin(), b.end(), oo);     
             return !is.eof() && !os;          
             return 0;
    }When I compile this happens
    bash-2.05$ CC -V
    CC: Sun C++ 5.6 2004/06/02
    bash-2.05$ CC -o std_vector.out std_vector.cpp
    "std_vector.cpp", line 24: Error:
    Could not find a match for
    std::vector<std::string>::vector(std::istream_iterator<std::string, char, std::char_traits<char>, int>, std::istream_iterator<std::string, char, std::char_traits<char>, int>)needed in main().
    1 Error(s) detected.
    What can I do ?
    best regards
    Morten Gulbrandsen

    You have run into a documented limitation of the default libCstd implementation of the C++ standard library. The default library is not a complete implementation, and in particular lacks required template member functions that allow implicit type conversions. We still use this library for binary compatibility with earlier releases.
    The optional STLport version of the library is a full implementation of hte C++ Standard Library. If you don't need binary compatibility, meaning you don't need to link to code that uses libCstd, you can add the option -library=stlport4 to every CC command line, compiling and linking. Your sample code compiles with STLport.
    If you need to use libCstd, you might get this code to work by inserting explicit type conversions. I have not tried to see whether that actually can be done.

  • Mileage Reimbursement rate for car needs to be changed -Pls help!!

    Hello Gurus,
    Currently I am working for european end markets for T&E module.
    Iam facing a problem that:
    I need to change the mileage reimbursement rate has changed for Belgium.
    The mileage rate for Belgium needs to be changed for comp codes (BL01 and BL02) the new rate needs to be 0.2940eur/KM for own car mileage claims.
    Since, i am new to payroll area, can some one pls help me.. where we track such changes? Is it done under payroll?
    Pls advice for same...
    Points assured
    Thanks & regds,
    N.babu

    Hello Karthi,
    I want to change the mileage rate for own cars for Belgium. It is for personnel area BL01 & BL02.
    <b>The new rate has been changed to be 0.2940eur/KM for own car mileage claims.</b>
    This will ensure that employees are being reimbursed the correct amount for their mileage cost when using their own car and travelling for business purposes
    Hence I want to know, is there any settings we need to maintain in payroll?
    Regds,
    N babu

  • This code cannot possibly fail. Why is it failing?

    LV 2010 (yes, 2010), Win Vista.
    I have a DISPLAY UPDATE event, occurring at 2 Hz.
    The event carries an array of values, one for each channel.
    Four CHANNEL SELECTORS drive an ARRAY INDEX operation.
    The four selected channels are shown separately on numeric indicators, then combined on to a waveform chart.
    The little subVIs are there to produce a NaN for charting if the channel selector is -1 (none).
    Currently they are changed to output a "123.0" value, for debugging purposes.
    The HELP says that the ARRAY INDEX will produce a default 0 if the input index is outside the bounds of the array.
    Yet, under certain circumstances (see JING at http://screencast.com/t/0kO0GDhlo0E), the "CHART VALUE" indicators fail to update.
    In that video, I set the indicators to values of 1, 2, 3, 4 before starting the program.
    I DO NOT set the DEFAULT, just enter those numbers into the panel indicators.
    The two which have selected channels are updated seemingly normally.  The other two, which are left at NONE (-1) do not update.
    I would expect them to show a zero, or SOMETHING, but the "3" and "4" never change.
    This code is called, as evidenced by the chart advancing, but the values do not change.
    If I change the channel to a live channel, then back to NONE, it will return to 0.  That's expected.
    But why doesn't it update at first?
    If I swap the channel selectors around, the problem swaps with it. Any selector set on NONE has the corresponding indicator unchanged from the starting value.
    ABOUT THE CODE:
    This is a REENTRANT VI,  inserted into a SUBPANEL.
    Here's the insertion code:
    The idea is that each control on the page is a subpanel, each will receive an instance of this one VI.
    For each subpanel, I open a new re-entrant ref to this VI (it's set to be reentrant), and insert that ref into the subpanel.
    I set a couple of control values, and start it running.
    KEY FACTS:
    1... If I change OPTIONS = 8 to OPTIONS = 0 in the above, the problem goes away. Everything works as expected.
    2... The N=1 in the above, is simply to limit the number of instances, for debugging purposes.
    3... I get no errors at any time.
    4... I've tried with and without a wire to the TYPE SPECIFIER VI REFNUM input of OPEN VI REFERENCE.  No change.
    A search on this topic brings up some 2008 issues with LV 8.0, and a suggestion there to use a VIT as the item inserted had no effect here.
    So, why does the indicator NOT update if the index is -1, at first?  It's as if the code is not there.
    And why does making it non-reentrant fix it?
    (I have to have it reentrant so I can have multiple instances).
    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com
    Blog for (mostly LabVIEW) programmers: Tips And Tricks
    Solved!
    Go to Solution.

    I don't know how to probe that in the real situation.
    If I put a probe there, it doesn't tell me anything, because it's a re-entrant copy that's actually running: the probe is on the original VI which isn't.
    If I make it non-reentrant, the problem goes away.
    KEY FACTS:
    8... Moving the indicators OFF the tab page does nothing different.
    9... another page of the inner tab has more text indicators (20) instead of a chart. (see pic below).  That page shows the same behavior.  Any selector inditialized to -1 fails to update until it is first set to an active channel.
    10... It doesn't matter if the selector values are converted to I32 or not (not that I would expect it to).
    11.. The selectors are given a STRINGS & VALUES property of ["< None >", -1] by the init code, or ["Speed", 2} or ["Torque", 3] or something if the channel is found in the settings file.  When you click on it, I populated the menu with all channels and all indexes.  Wonder if there's something wonky with that.
    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com
    Blog for (mostly LabVIEW) programmers: Tips And Tricks

  • Please explain this code to me (in English)!  Thanks.

    Hello everyone,
    I am working with some AS3 code that someone else has written.  The code creates datatables and populates them by pulling from a .NET webservice using SOAP and DataTables.
    I have copied and pasted the code below.  Most of it makes sense and I understand it, however, there are some things I've never seen before and have not been able to find on the internet.  Most of the things I have a problem with, I've created comments in ALL CAPS with my questions.
    If someone could take a look at it and tell me what is going on I would appreciate it.
    Thanks.
                  //Load result data into XMLList structure
                  var xmlData:XML = XML(myService.GetViewResults.lastResult);
                  //gets the DataTables data, length of tableXML is the number of Tables you got
                  var tableXML:XMLList = xmlData.GetViewResultsResult.DataTables.children();
                  //gets the number of tables returned in the result
                  var numTables:int = tableXML.children().length();
                  //seperates out the data for each table
                  var tempXMLArray:Array = new Array();
                  var tempXML:XML;
                  for (var i:int=0; i<numTables; i++)
                      tempXML = tableXML[i];
                      tempXMLArray.push(tempXML);
                  //create a datagrid for each table
                  var datagrid1:DataGrid, datagrid2:DataGrid, datagrid3:DataGrid;
                  //create array collections to feed datagrids
                  var ac1:ArrayCollection, ac2:ArrayCollection, ac3:ArrayCollection;
                  var currentTableXML:XML;
                  var columns:Array = new Array();
                  var dgc:DataGridColumn;
                  var obj:Object;  // WHY IS THIS OBJECT NEEDED?
                  //CREATING TABLE 1
                  currentTableXML = tempXMLArray[0];
                  datagrid1 = new DataGrid();
                  datagrid1.width = 1000;
                  datagrid1.height = 200;
                  datagrid1.y = 0;
                  columns = new Array();
                  for (i=0; i<currentTableXML.Columns.children().length(); i++)
                      dgc = new DataGridColumn(currentTableXML.Columns.NHRCViewResultColumn.ColumnName[i].toString());
                      dgc.dataField = currentTableXML.Columns.NHRCViewResultColumn.ColumnName[i];
                      columns.push(dgc);
                  datagrid1.columns = columns;
                  ac1 = new ArrayCollection;
                   // looping through each piece of data in the row
                   for (i=0; i<currentTableXML.Rows.children().length(); i++)
                      trace("table 1:creating row " + i);
                   // I HAVE NO IDEA WHATS GOING ON HERE... WHAT IS THIS OBJECT DOING EXACTLY?
                      obj = {
                             // I DON'T UNDERSTAND THIS SYNTAX - WHAT ARE THE COLONS FOR???  AND WHY STORE IN AN OBJECT???
                          ((datagrid1.columns[0] as DataGridColumn).dataField.toString()):(currentTableXML.Rows.NHRCViewResultRow.Values[i].string[0]),
                          ((datagrid1.columns[1] as DataGridColumn).dataField.toString()):(currentTableXML.Rows.NHRCViewResultRow.Values[i].string[1]),
                          ((datagrid1.columns[2] as DataGridColumn).dataField.toString()):(currentTableXML.Rows.NHRCViewResultRow.Values[i].string[2]),
                          ((datagrid1.columns[3] as DataGridColumn).dataField.toString()):(currentTableXML.Rows.NHRCViewResultRow.Values[i].string[3]),
                          ((datagrid1.columns[4] as DataGridColumn).dataField.toString()):(currentTableXML.Rows.NHRCViewResultRow.Values[i].string[4]),
                          ((datagrid1.columns[5] as DataGridColumn).dataField.toString()):(currentTableXML.Rows.NHRCViewResultRow.Values[i].string[5])
                      ac1.addItem(obj);
                  datagrid1.dataProvider = ac1;
                  this.addChild(datagrid1);  //Adding populated datagrid to the screeen

    The following code creates a variable obj of type Object. You need to declare the variable, and you don't want to do that inside the loop where the object is constructed, because then it will be scoped within the loop block, so it is first declared outside the loop.
    var obj:Object;  // WHY IS THIS OBJECT NEEDED?
    Now you are constructing the object. Here is the logic of what is going on.
    Objects of this type in Flex are constructed as follows:
    objName = {
      fieldName1: fieldVal1,
      fieldName2: fieldVal2,
      fieldName3: fieldVal3
    In this code, the field names are:
    (datagrid1.columns[0] as DataGridColumn).dataField.toString()
    and you need to cast as DataGridColumn first.
    The field values are:
    (currentTableXML.Rows.NHRCViewResultRow.Values[i].string[0])
    So here it seems you are taking the first item in the string element of the ith element of Values, which is obtained by parsing into the currentTableXML, Rows element, NHRCViewResultRow element.
    // I HAVE NO IDEA WHATS GOING ON HERE... WHAT IS THIS OBJECT DOING EXACTLY?
                      obj = {
                             // I DON'T UNDERSTAND THIS SYNTAX - WHAT ARE THE COLONS FOR???  AND WHY STORE IN AN OBJECT???
                          ((datagrid1.columns[0] as DataGridColumn).dataField.toString()):(currentTableXML.Rows.NHRCViewResultRow.V alues[i].string[0]),
                          ((datagrid1.columns[1] as DataGridColumn).dataField.toString()):(currentTableXML.Rows.NHRCViewResultRow.V alues[i].string[1]),
                          ((datagrid1.columns[2] as DataGridColumn).dataField.toString()):(currentTableXML.Rows.NHRCViewResultRow.V alues[i].string[2]),
                          ((datagrid1.columns[3] as DataGridColumn).dataField.toString()):(currentTableXML.Rows.NHRCViewResultRow.V alues[i].string[3]),
                          ((datagrid1.columns[4] as DataGridColumn).dataField.toString()):(currentTableXML.Rows.NHRCViewResultRow.V alues[i].string[4]),
                          ((datagrid1.columns[5] as DataGridColumn).dataField.toString()):(currentTableXML.Rows.NHRCViewResultRow.V alues[i].string[5])

  • How do I rid the User Account Control - "Do you want the following program to make changes to this computer?" - FireFox Helper pop-up that shows after every log in?

    The following pop-up is displayed after every log-in, even after it is clicked yes after previous log-ins. Several students log-in the computers daily. How do I rid THIS?:
    User Account Control
    "Do you want the following program to make changes to this computer?
    Program Name: FireFox Helper
    Verified Publisher: Mozilla Corporation
    File Origin: Hard Drive on this Computer

    In Windows 7, Microsoft updated UAC in several ways. By default, UAC does not prompt when certain programs included with Windows make changes requiring elevated permissions. Other programs still trigger a UAC prompt. The strictness of UAC can be changed to either always prompt, or to never do so.
    [http://windows.microsoft.com/eN-US/windows-vista/What-is-User-Account-Control What is User Account Control?]
    [http://windows.microsoft.com/en-US/windows-vista/Turn-User-Account-Control-on-or-off Turn User Account Control on or off]
    It is the same on win7.
    [http://en.wikipedia.org/wiki/User_Account_Control User Account Control]
    thank you
    Please mark "Solved" the answer that really solve the problem, to help others with a similar problem.

Maybe you are looking for