How to make an openfiledialog? (browse a file and put it in a parameter)

How to make an openfiledialog? (browse a file and put it in a parameter)
Best Regards

hi,
check the code  below:
FORM sub_gui_download.
* Define local variables
  DATA:
    lo_fullpath       TYPE string,
    lo_filename       TYPE string,
    lo_path           TYPE string,
    lo_user_action    TYPE i,
    lo_encoding       TYPE abap_encoding.
* Define local constants
  CONSTANTS:
    lc_encoding(1) TYPE c VALUE 'X',
    lc_directory TYPE string VALUE 'D:',
    lc_filetype TYPE char10 VALUE 'DAT',
    lc_separator TYPE char01 VALUE 'X',
    lc_blank TYPE char01 VALUE ''.
* Call method to create dynamic save_path and save_format
  CALL METHOD cl_gui_frontend_services=>file_save_dialog
    EXPORTING
      with_encoding        = lc_encoding
      initial_directory    = lc_directory
    CHANGING
      filename             = lo_filename
      path                 = lo_path
      fullpath             = lo_fullpath
      user_action          = lo_user_action
      file_encoding        = lo_encoding
    EXCEPTIONS
      cntl_error           = 1
      error_no_gui         = 2
      not_supported_by_gui = 3
      OTHERS               = 4.
  IF sy-subrc <> 0.
    EXIT.
  ENDIF.
* Check user_action
  IF lo_user_action <> cl_gui_frontend_services=>action_ok.
    EXIT.
  ELSE.
*   If user_action equals to action_ok, call function module to download datas
*   using download table i_dwn_tab
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename                = lo_fullpath
        filetype                = lc_filetype
        write_field_separator   = lc_separator
        trunc_trailing_blanks   = lc_blank
      TABLES
        data_tab                = i_dwn_tab
      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 i007.
    ENDIF.
  ENDIF.
ENDFORM.    

Similar Messages

  • How to Split Single Idoc into 2 files and put some delay

    Hi,
    I have a IDoc to file Scenario. Invoice Idoc to Flat file scenario
    this is a reuse Interface
    Current Scenario we have graphical mapping(used for lookup and dynamic filename, mostly all the field mappings are 1-1) and ABAP Mapping to convert Idoc to flat file, 1 Idoc will generate 1 file.
    In addition to the above case, there is 1 more requirement
    Correction Invoice case. where in I get single Idoc with Multiple Item categories (Original data and Correction data)
    In this case always I need to send two files(2 Idoc data), first Idoc is for Original Idoc and 2nd is Corrected Invoice, these 2 idocs should be sent with some delay.
    In Correction Invoice case, I should generate 2 idocs based on Item category (PSTVY) value.
    Suppose I have 4 E1EDP01 segments out of which PSTVY has value "AA" and "BB" repeated twice as shown below
    <PSTYV>AA</PSTYV>
    <PSTYV>AA</PSTYV>
    <PSTYV>BB</PSTYV>
    <PSTYV>BB</PSTYV>
    So I need to generate 2 Idoc 1 for AA and other for BB.
    If there is no correction Invoice, 1 idoc for 1 file will be generated.
    Am planning to use BPM to delay the idocs and identigy bpm based on Document type else no bpm...
    How do I split the mapping of single Idoc to 2 files based on Item category.
    Thanks,
    Varun

    You can use the multi-mapping to split the message payloads according to business requirement (AA and BB segments values)
    /people/jin.shin/blog/2006/02/07/multi-mapping-without-bpm--yes-it146s-possible
    And then send to different receivers by adding the conditions on the Receiver Determination (for example, "field = AA" go to Receiver1, and "field = BB" to to Receiver2).
    http://help.sap.com/saphelp_nwpi71/helpdata/en/26/5ccd3bb4560f01e10000000a11402f/frameset.htm
    Or even Extended (enhanced) receiver determination, should the scenario be more complex:
    http://wiki.sdn.sap.com/wiki/display/XI/EnhancedReceiverDeterminationinSAP+XI

  • How to make Finder NOT to show files from a specific folder in "All My Files"?

    Hello!
    Can someone please advice how to make finder NOT to show files from a specific folder in "All My Files"? See the attach - I recently installed Civilization 5 from Steam and now I have a lot of unneeded files (*.log and *.ini) shown in  All My Files colder in Finder.
    I don't want to see them. Any advise?

    Using "All my Files" was very handy before all this rubbish popped up. =(

  • How to make mplayer play 3gp type files ??

    how to make mplayer play 3gp type files ??
    I downloaded a Japanese blue movie by amule, but I cannot play it!

    Army wrote:Actually, a few weeks ago, opencore-amr went into [extra] and ffmpeg and mplayer are being compiled against it, so Arch's mplayer should support 3gp files ootb including audio. Video playback was never an issue, because 3gp is just a container, the video codec is usually h263 or h264, which are no problem for mplayer.
    Very new versions of FFmpeg have native amr-nb support. I'm not sure if it happened before or after the most recent FFmpeg bump in the repos.

  • How to make photoshop cs4 open dng files?

    How to make photoshop cs4 open dng files?

    They are opened by Photoshop through the ACR plug-in you should make sure the ACR 5.7 update is installed for your CS4.
    Adobe - Photoshop : For Macintosh
    Adobe - Photoshop : For Windows

  • How to make blank copies of a PDF file and put it into the printer tray.

    Dear experts,
    Before you try printing the data from the FM, How tomake several blank copies of the PDF file  and  put it in the printer tray so that you can print just the data from the function module on it??????
    Please reply.

    Hi drredwood,
    When you open your PDF file a yellow bar will appear on the top of the screen.
    Click on 'Enable All Features'.
    Then you will be able to copy the content from your pdf and to paste in any of the file.
    Regards,
    Florence

  • How to browse a file and extract its contents

    i want to browse a file and extract its contents.My code is given below but its not working .Can anybody help me please
    JFileChooser fc = new JFileChooser();
              int returnVal = fc.showOpenDialog(jfrm);
              if (returnVal == JFileChooser.APPROVE_OPTION)
              File file = fc.getSelectedFile();
              //This is where a real application would open the file.
              fileName=file.getName();
              //This is a file function to extract data from a file.
              //It reads data from a file that can be viewed on cmd
              jlab3.setText(fileName);
              try
    // Open the file that is the first
    // command line parameter
    FileInputStream fstream = new FileInputStream(fileName);
    // Convert our input stream to a
    // DataInputStream
              DataInputStream in =new DataInputStream(fstream);
    // Continue to read lines while
    // there are still some left to read
    // while (in.available() !=0)
    // Print file line to screen
              fileName1=in.readLine();
              jlab3.setText(fileName1);
              in.close();
    catch (Exception e)
              System.err.println("File input error");
              }

    JFileChooser fc = new JFileChooser();
    int returnVal = fc.showOpenDialog(jfrm);
    if (returnVal == JFileChooser.APPROVE_OPTION)
    File file = fc.getSelectedFile();
    //This is where a real application would open the file.
    fileName=file.getName();
    //This is a file function to extract data from a file.
    //It reads data from a file that can be viewed on cmd
    jlab3.setText(fileName);
    try
    // Open the file that is the first
    // command line parameter
    FileInputStream fstream = new FileInputStream(fileName);
    // Convert our input stream to a
    // DataInputStream
    DataInputStream in =new DataInputStream(fstream);
    // Continue to read lines while
    // there are still some left to read
    // while (in.available() !=0)
    // Print file line to screenHere you are reading the first line of the file
      fileName1=in.readLine();
    //}and here you are displaying the line in a (I suppose) JLabel. A JLabel is not very suitable for displaying a file content, except is the file contain few characters !!!
    jlab3.setText(fileName1);
    in.close();
    catch (Exception e)
    System.err.println("File input error");
    }If you want to read the complete file content you must uncomment lines inside while instruction, like this
    while (in.available() > 0) {  // I prefer to test in.available like this, instead of !=
      // append text to a StringBuffer (variable named sb here) or directly in a textarea.
      sb.append(in.readLine());
    ...

  • How to run a remote windows dll files and the drivers of the system using j

    Dear Friends,
    I need some valuable info regd how to run a remote windows dll files and the drivers of the system using java
    reply regd thanking you

    Please don't make duplicate posts like this.

  • Unable to make changes to a jpg file and then save it without the program trying to change it to a psd [was: What a Pile of Crap!]

    Can't even make changes to a jpg file and then save it without the program trying to change it to a psd!!!!!  No wonder nobody like Adobe anymore.

    Do you mean that PSD comes as a default option or that JPEG is not available no matter what?
    Did you add a layer?  Did you change the bit depth?  Did you add transparency?   The JPEG format does not support layers, nor 16-bit images, nor transparency.
    Due to the current unavailability of clairvoyants and mind-readers in the forum, we respectfully request you supply sensible, complete details.
    BOILERPLATE TEXT:
    Note that this is boilerplate text.
    If you give complete and detailed information about your setup and the issue at hand,
    such as your platform (Mac or Win),
    exact versions of your OS, of Photoshop (not just "CS6", but something like CS6v.13.0.6) and of Bridge,
    your settings in Photoshop > Preference > Performance
    the type of file you were working on,
    machine specs, such as total installed RAM, scratch file HDs, total available HD space, video card specs, including total VRAM installed,
    what troubleshooting steps you have taken so far,
    what error message(s) you receive,
    if having issues opening raw files also the exact camera make and model that generated them,
    if you're having printing issues, indicate the exact make and model of your printer, paper size, image dimensions in pixels (so many pixels wide by so many pixels high). if going through a RIP, specify that too.
    A screen shot of your settings or of the image could be very helpful too,
    etc.,
    someone may be able to help you (not necessarily this poster, who is not a Windows user).
    Please read this FAQ for advice on how to ask your questions correctly for quicker and better answers:
    http://forums.adobe.com/thread/419981?tstart=0
    Thanks!

  • I had renamed my user login name and assumed that there will be no change in the settings and files. When I login with the new profile name everything is gone. How can I get back all my files and settings?

    I had renamed my user login name and assumed that there will be no change in the settings and files. When I login with the new profile name everything is gone. How can I get back all my files and settings? Please help. Thanks.

    You should have asked this before you tried: Changing username or short name- User Account and Short Name- OS X- How to change user account name or home directory name.

  • I have problem with Itunes losing where podcasts and some purchased music is located. Don't know how Itunes losing the locations of the files and I can't find the files on my hard drive. What can I do to stop Itunes losing location and restore my files?

    I have problem with Itunes losing where podcasts and some purchased music is located. Don't know how Itunes losing the locations of the files and I can't find the files on my hard drive. What can I do to stop Itunes losing location and restore my files?

    Try assigning Queen as the Album Artist on the compilations in iTunes on your computer.

  • How to read the data from Excel file and Store in XML file using java

    Hi All,
    I got a problem with Excel file.
    My problem is how to read the data from Excel file and Store in XML file using java excel api.
    For getting the data from Excel file what are all the steps i need to follow to get the correct result.
    Any body can send me the code (with java code ,Excel sheet) to this mail id : [email protected]
    Thanks & Regards,
    Sreenu,
    [email protected],
    india,

    If you want someone to do your work, please have the courtesy to provide payment.
    http://www.rentacoder.com

  • How to make a commentary track in iDVD and iMovie 6

    Could someone please explain how to make a commentary track using iMovie6 and iDVD? I think I will be able to import the commentary track onto the second sound track in iMovie 6 with no problem. I just can't figure out how to make it an optional track in the final DVD.

    Yes, you can put the commentary track on the second sound track in 06. You can also attach a mic and make the commentary as a recording. I will caution that you will need to depress any original sounds associated with the film so that it does not sound like a garbled mess with both tracks competing. I imagine you know how to grab the volume level line in the audio track and nudge it lower or higher?
    I also don't see any other option than including two versions of the film on the DVD. Pretty simple fix if it will fit... I would export the plain film first before adding the other audio (or you can simply uncheck one of the audio tracks while exporting to mute it).
    Terri

  • I am trying to make a pdf of a file and I need to get the file size to be no bigger than 10MB. What is the best way to do this

    I am trying to make a pdf of a file and I need to get the file size to be no bigger than 10MB. Even when I save it, the image quality at minimum the file size is 10.9 MB. What is the best way to do this

    @Barbara – What purpose is that PDF for? Print? Web?
    If web purpose, you could convert CMYK images to sRGB. That would reduce the file size as well.
    A final resort to bring down file size is:
    1. Print to PostScript
    2. Distill to PDF
    That would bring file size down even more. About 20%, depending on the images and other contents you are using, compared with the Acrobat Pro method. If you like you could send me a personal message, so we could exchange mail addresses. I could test for you. Just provide the highres PDF without any downsampling and transparency intact. Best provide a PDF/X-4.
    I will place the PDF in InDesign, print to PostScript, distill to PDF.
    Uwe

  • How do I download a Adobe PDF file and get it converted to a Word document?

    How do I download a Adobe PDF file and get it converted to a Word document?

    Download: you just download it as you would any other document.
    Convert to Word: either using the ExportPDF online service, or Acrobat.

Maybe you are looking for

  • PO with 2 vendor

    Dear All I want to create a PO with 2 Vendor ( One vendor for purchase Material and one Vendor for Import and Freight). Could you please tell me how to do. Thanks and Best regard. Thang

  • REPLACEMENT BATTERY FOR NOMAD ZEN JUKEBOX 4

    I know this player has been discontinued now but does anybody know where you can get a replacement battery from? The player won't charge at all and I can't get any response from it when I use the AC Adapter either.

  • Using store procedure within sql statement?

    I have the following sample tables: project id project_name ====== =============== 1          project one 2          project two 3           project three employee_id     fname          lname =========== =============     ===== 100          amy      

  • Subkey HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\fdemd not exist

    During installation of PI 7.0 gives message The subkey 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\fdemd' does not exist on the 'localhost' host.

  • JXTA HelloWorld problem

    Hi! I've been proggraming in Java quite a while now, but I need to use JXTA in a project and I'm totally new to it. I'm trying to run some examples in JBuilder7 (the classic HelloWorld among others), and I keep getting the following exception (it loo