Need to extend header length in Excel file being downloaded by GUI_DOWNLOAD

hello Experts,
I have written a program where the data from DSO is downloaded into Excel File which is being saved on my desktop.
Now, i am facing one problem with the length of header and the values.
For eg:
I have 15 cloumns and i have given description for each column ie header name. This header is being displayed only upto 255 characters. If the total length of all the columns header desc exceeds 255 char, then blank header is displayed further.
Same is the case with the values of the columns.
I am pasting the relevant code.
The code for displaying header and fields is:
Concatenate
'Sales Org'
'Sales Org Desc'
'Sales Dist'
'Sales Dist Desc'
'Sales Rep'
'Sales Rep Desc'
'Customer Number'
'Customer Desc'
'Billing Document'
'AGI Code No'
'AgiCode Desc'
'UCAGI Code No'
'UCAGI Code Desc'
'Design Code'
'CalMonth'
'CalYear'
'Billing Qty'
'ZDIF'
'ZE01'
'ZE13'
Into ls_contents-line SEPARATED BY lc_tab.
APPEND ls_contents TO lt_contents.
CLEAR ls_contents.
Loop at i_t_Table into wa_i_t_t_Table.
concatenate
      wa_i_t_t_Table-/BIC/G00000574
      wa_i_t_t_Table-salesorg_name
      wa_i_t_t_Table-/BIC/G00000514
      wa_i_t_t_Table-salesdist_name
      wa_i_t_t_Table-/BIC/G00009361
      wa_i_t_t_Table-SalesRep_name
      wa_i_t_t_Table-/BIC/G00000466
      wa_i_t_t_Table-Customer_name
      wa_i_t_t_Table-/BIC/G00000464
      wa_i_t_t_Table-/BIC/G00000001
      wa_i_t_t_Table-agicode_name
      wa_i_t_t_Table-/BIC/G00000002
      wa_i_t_t_Table-UCagicode_name
      wa_i_t_t_Table-/BIC/G00000005
      wa_i_t_t_Table-CALMONTH2
      wa_i_t_t_Table-CALYEAR
      wa_i_t_t_Table-/BIC/G00001108
      wa_i_t_t_Table-/BIC/G00021022
      wa_i_t_t_Table-/BIC/G00021023
      wa_i_t_t_Table-/BIC/G00021024
INTO ls_contents-line SEPARATED BY lc_tab.
*CONCATENATE ls_contents lv_hex1 INTO ls_contents.
          APPEND ls_contents TO lt_contents.
          CLEAR ls_contents.
ENDLOOP.
CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
  BIN_FILESIZE                    =
   FILENAME                        = c_filename
FILETYPE                        = 'DAT'
  APPEND                          = ' '
   WRITE_FIELD_SEPARATOR           = ' '
HEADER                          = '01'
  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                    = '0'
  WK1_N_SIZE                      = '20'
  WK1_T_FORMAT                    = '0'
  WK1_T_SIZE                      = '20'
  WRITE_LF_AFTER_LAST_LINE        = ABAP_TRUE
  SHOW_TRANSFER_STATUS            = ABAP_TRUE
IMPORTING
  FILELENGTH                      =
  TABLES
    DATA_TAB                        = lt_contents
  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.
Note:  Gone through SDN where many things are suggested like to use parameter of GUI_DOWNLAOD ie "FIELDNAMES " which is disabled in my SAP version.
Please suggest how to make all the headers and the values of the fields properly.
Would appreciate immediate help.
Thanks in advance.
Regards
Lavanya

solved.

Similar Messages

  • Facing problem with posting Excel file for download - Content in browser

    I am trying to post an Excel file to download from a servlet to a JSP. The content is written properly but to the IE browser and not in an Excel. I even tried giving the ContentType as Word/CSV etc. But nothing works, the content gets displayed only in the browser.
    PLEASE HELP.
    Code snippet in calling JSP:
    DownloadServlet downServlet = new DownloadServlet();
    downServlet.download(response);
    Code in Servlet:
    public class DownloadServlet extends HttpServlet{
    public void download(HttpServletResponse response) throws IOException {
              /*PrintWriter out = response.getWriter( );
              response.setContentType("text/html");
              out.println("<H1>Hello from a Servlet</h2>"); */
         /*HSSFWorkbook wb = new HSSFWorkbook();
    HSSFSheet sheet = wb.createSheet("Sheet1");*/
    String strData = "This is a Test for Download";
    byte[] b = strData.getBytes();
    //response.reset();
    response.setHeader("Content-disposition", "attachment; filename=" + "Download.xls");
    response.setContentType( "application/msword" );
    //response.addHeader( "Content-Description", "Download Excel file" );
    ServletOutputStream out = response.getOutputStream();
    out.write(b);
    //out.flush();
    out.close();          
    }

    Hi Naresh,
    My thoughts on a possible solution, convert the last character value to a HEX value and check if it falls within the ASCII/Unicode CP range, Obviously this becomes easier if you are just looking at a single language character set.
    The below FM and code helps you check if the character falls within the ASCII char set.
    DATA: l_in_char TYPE string,
          l_out     TYPE xstring.
    CALL FUNCTION 'NLS_STRING_CONVERT_FROM_SYS'
      EXPORTING
        lang_used                   = sy-langu
        SOURCE                      = l_in_char
      TO_FE                       = 'MS '
    IMPORTING
       RESULT                      = l_out
      SUBSTED                     =
    EXCEPTIONS
       illegal_syst_codepage       = 1
       no_fe_codepage_found        = 2
       could_not_convert           = 3
       OTHERS                      = 4.
    IF l_out LT '0' OR l_out GT '7F'.
      WRITE: 'error'.
    ENDIF.
    Links: http://www.asciitable.com/
              http://www.utf8-chartable.de/unicode-utf8-table.pl
    Regards,
    Chen
    Edited by: Chen K V on Apr 21, 2011 11:25 AM

  • Need Function module to upload an excel file to SAP

    Need Function module to upload more than 100 characters of excel file data into SAP internal table.
    Currently i have two function module
    1. ALSM_EXCEL_TO_INTERNAL_TABLE --32 characters max
    2. KCD_EXCEL_OLE_TO_INT_CONVERT --50 characters max
    Please let me know some pointers.
    Thanks in Advance,
    A.Karthikeyan.

    hi,
    use the FM GUI_UPLOAD
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = W_FILENAME
       FILETYPE                      = W_FILETYPE
       HAS_FIELD_SEPARATOR           = 'X'
      HEADER_LENGTH                 = 0
      READ_BY_LINE                  = 'X'
       DAT_MODE                      = 'X'
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      CHECK_BOM                     = ' '
      VIRUS_SCAN_PROFILE            =
      NO_AUTH_CHECK                 = ' '
    IMPORTING
      FILELENGTH                    =
      HEADER                        =
      TABLES
        DATA_TAB                      = wp_it_upload
    EXCEPTIONS
       FILE_OPEN_ERROR               = 1
       FILE_READ_ERROR               = 2
       NO_BATCH                      = 3
       GUI_REFUSE_FILETRANSFER       = 4
       INVALID_TYPE                  = 5
       NO_AUTHORITY                  = 6
       UNKNOWN_ERROR                 = 7
       BAD_DATA_FORMAT               = 8
       HEADER_NOT_ALLOWED            = 9
       SEPARATOR_NOT_ALLOWED         = 10
       HEADER_TOO_LONG               = 11
       UNKNOWN_DP_ERROR              = 12
       ACCESS_DENIED                 = 13
       DP_OUT_OF_MEMORY              = 14
       DISK_FULL                     = 15
       DP_TIMEOUT                    = 16
       OTHERS                        = 17.

  • How to get Formatted Excel file when downloading spool request of a r paint

    I have scheduled a Report painter program  in background  & spool is generated .
    When I download the output in the Excel file its not in the proper format . We need to format the file file by adding  deleting blank Line in the report .
    Can it be possible when we Download the Report painter. Its come The generated Excel file should come in formatted way.
    Thanks

    kiro123 wrote:
    I have scheduled a Report painter program  in background  & spool is generated .
    >
    > When I download the output in the Excel file its not in the proper format . We need to format the file file by adding  deleting blank Line in the report .
    >
    > Can it be possible when we Download the Report painter. Its come The generated Excel file should come in formatted way.
    >
    >
    > Thanks
    Yes the report painter report especially in the hierarchial format will not make much sense when you download to excel. Until now I also have not seen any solution to this.

  • Shared Excel Files Being Deleted by DFSR

    Hi
    I've got a problem with our DFS setup. For several years we've been replicating from a live 2003 server to a 2008 R2 server for backup purposes. Users can only access the live server. The 2008 folders were not shared and never edited.
    We needed to replace the 2003 server so I made the 2008 live and shared the folders and pointed DFS to that as the live target. After deleting the old replication group, removing the 2003 server completely and deleting the old DFSR folder from the Sysvol
    of the 2008 server, I then built a 2012 R2 server to become the new live server. I setup replication to the new 2012 server using data collection from the 2008 to get a copy of the data across ready to switch.
    Again, users can only access the 2008 server the 2012 is not shared. Yet after initial replication completed I started to get 4412 events stating files had been changed on multiple servers. I don't understand how this is possible when server is not accessible.
    Then files began to disappear.
    All the files logged as in conflict are Excel files that are being accessed by multiple users on the 2008 server. Sometimes it's OK. Sometimes the conflict removes the file from both servers and places it in the Conflict and Deleted. I am replicating the
    lock files even though only one copy of the data is available to users.
    Can anyone shed any light on why this is happening?
    Cheers
    Mart

    Apologies didn't explain it very clearly. The 2003 server is removed. So the DFS is pointed to a single folder target, the 2008 server.
    I set up the 2012 in a replication group to collect data from the 2008 server. Eventually I intend to point the folder target to the 2012 and only the 2012 but after initial replication I started to get the problem.
    Currently, even though the DFS has only one folder target on the 2008 server, I'm getting 4412 in event viewer on both servers telling me files have changed on more than one server. I don't understand how that's happening as the copy on the 2008
    server is the only one that is shared and targeted for users to access. Also there are only these two servers in the replication group.
    Hope that is clearer.

  • To set a dropdown list for one column in the excel file before downloading

    Hi all,
    I am downloading an excel file which has the format of an internal table with a number of fields. I want to set a dropdown list for one column in the excel file. How can i do this?
    Thanks

    HI ,
    U can use function module " QINT_GET_EXCEL_DATA " ....
    and modify the excel sheet based on ur requirement ......
    Try this ...
    Hope it works
    Thanks
    Shambhu

  • How to prevent swf files being downloaded

    People,
    I'm a teacher and I have some animations made in flash language (swf). I would like to publish these animations on my web site so my students could see, but I wonder if there is any way to prevent these animations being downloaded.
    Example: when I see an animation published on my web site, this animation is stored in Internet Temporary Files and I can save this animation anywhere. How can I prevent an animation is stored in the temporary folder? In other words, this animation can only be seen if the user is logged on the site.
    Urgent!!!
    Thanks.
    Alyson

    I think that's what I want. I found a site that has exactly what I need. It
    is done this way too?
    Plese take a look at http://www.edumedia-sciences.com/en/a559-scintigraphy
    <http://www.edumedia-sciences.com/>
    Thanks
    2009/11/16 moccamaximum <[email protected]>
    You could implement a kind of time-barrier, like in the trial versions you
    download from softwarecompanys.
    For the most users, that are not understanding actionscript and know how to
    read the code, even if they decompile it, that would prevent the swf being
    played after a certain date that you would have to implement in your code.
    In AS2 the code would be like this:
    >
    var now:Date = new Date(); //reads the user system date
    var release:Date = new Date(2009, 11, 16); //here goes the date, when you
    want to have the program deactivated
    >
    if(now <= release){
       playSwf(); // here goes your normal code
    >
    else{
       doNothing();
    >
    Like the most TimeBarriers this could be easily circumvented if the user
    sets back his system date, so do not give a message like "You trial period
    has expired"
    >

  • Adjusting column header length in excel

    Hi,
    i'm using MS_EXCEL_OLE_STANDARD_DAT to download internal table contents to a spread sheet. im passing another internal table to write headers. however, i realized that this funtion module doesnt allow the length of the column header to be more than column length .
    My question may look weird but if there is any other way or FM to overcome this, please let me  know.
    Thanks,
    ravi.

    Hi,
    Use this FM . This looks good and also will solve your purpose. I've given it in a FORM ENDFORM. Just copy and paste it in ur code and make changes in the itab names and field names as needed.
    DATA: IT_COLS LIKE GXXLT_V OCCURS 0 WITH HEADER LINE.
    DATA: IT_ONLINE LIKE GXXLT_O OCCURS 0 WITH HEADER LINE.
    DATA: IT_PRINT LIKE GXXLT_P OCCURS 0 WITH HEADER LINE.
    1)Load the actual data into the itab it_qual_com.
    2)PERFORM EXCEL_GENERATION.
    Bingo this will work. Please award points for the same if this was useful.
    <b>Cheers,
    Sam.</b>
    FORM EXCEL_GENERATION.
      IND = 0.
      IT_COLS-COL_NAME = 'Emp No'.
      IND = IND + 1.
      IT_COLS-COL_NO = IND.
      Append it_cols.
      IT_COLS-COL_NAME = 'Name'.
      IND = IND + 1.
      IT_COLS-COL_NO = IND.
      Append it_cols.
      IT_COLS-COL_NAME = 'Date of Joining'.
      IND = IND + 1.
      IT_COLS-COL_NO = IND.
      Append it_cols.
      IT_COLS-COL_NAME = 'Confirmed'.
      IND = IND + 1.
      IT_COLS-COL_NO = IND.
      Append it_cols.
      IT_COLS-COL_NAME  = 'Role Code'.
      IND = IND + 1.
      IT_COLS-COL_NO = IND.
      Append it_cols.
      IT_COLS-COL_NAME = 'Role Description'.
      IND = IND + 1.
      IT_COLS-COL_NO = IND.
      Append it_cols.
      IT_COLS-COL_NAME = 'Job Band'.
      IND = IND + 1.
      IT_COLS-COL_NO = IND.
      Append it_cols.
      IT_COLS-COL_NAME = 'Skill'.
      IND = IND + 1.
      IT_COLS-COL_NO = IND.
      Append it_cols.
      IT_COLS-COL_NAME = 'Additional Weightage'.
      IND = IND + 1.
      IT_COLS-COL_NO = IND.
      Append it_cols.
      IT_COLS-COL_NAME  = 'Progeon Experience(months)'.
      IND = IND + 1.
      IT_COLS-COL_NO = IND.
      Append it_cols.
      IT_COLS-COL_NAME  = 'Prev. Relevant Experience(months)'.
      IND = IND + 1.
      IT_COLS-COL_NO = IND.
      Append it_cols.
      IT_COLS-COL_NAME  = 'Total Experience(months)'.
      IND = IND + 1.
      IT_COLS-COL_NO = IND.
      Append it_cols.
      IT_COLS-COL_NAME  = 'PU/Dept'.
      IND = IND + 1.
      IT_COLS-COL_NO = IND.
      Append it_cols.
      IT_COLS-COL_NAME  = 'DU'.
      IND = IND + 1.
      IT_COLS-COL_NO = IND.
      Append it_cols.
      IT_COLS-COL_NAME  = 'Location'.
      IND = IND + 1.
      IT_COLS-COL_NO = IND.
      Append it_cols.
      IT_COLS-COL_NAME  = 'Age'.
      IND = IND + 1.
      IT_COLS-COL_NO = IND.
      Append it_cols.
      IT_COLS-COL_NAME  = 'Date of Birth'.
      IND = IND + 1.
      IT_COLS-COL_NO = IND.
      Append it_cols.
      IT_COLS-COL_NAME  = 'Gender'.
      IND = IND + 1.
      IT_COLS-COL_NO = IND.
      Append it_cols.
      IT_COLS-COL_NAME  = 'Birth Place'.
      IND = IND + 1.
      IT_COLS-COL_NO = IND.
      Append it_cols.
      IT_COLS-COL_NAME  = 'State'.
      IND = IND + 1.
      IT_COLS-COL_NO = IND.
      Append it_cols.
      IT_COLS-COL_NAME  = 'Nationality'.
      IND = IND + 1.
      IT_COLS-COL_NO = IND.
      Append it_cols.
      IT_COLS-COL_NAME  = 'PB'.
      IND = IND + 1.
      IT_COLS-COL_NO = IND.
      Append it_cols.
      IT_COLS-COL_NAME  = 'PSB'.
      IND = IND + 1.
      IT_COLS-COL_NO = IND.
      Append it_cols.
      IT_COLS-COL_NAME  = 'Stream Code'.
      IND = IND + 1.
      IT_COLS-COL_NO = IND.
      Append it_cols.
    <b>  CALL FUNCTION 'XXL_SIMPLE_API'</b>
       EXPORTING
         N_KEY_COLS              = 1
        TABLES
          COL_TEXT                = IT_COLS
      <b>    DATA                    = IT_QUAL_COM</b> "data itab
          ONLINE_TEXT             = IT_ONLINE
          PRINT_TEXT              = IT_PRINT
       EXCEPTIONS
         DIM_MISMATCH_DATA       = 1
         FILE_OPEN_ERROR         = 2
         FILE_WRITE_ERROR        = 3
         INV_WINSYS              = 4
         INV_XXL                 = 5
         OTHERS                  = 6
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    "EXCEL_GENERATION

  • In Dreamweaver, I need to add the directory to the File being inserted in the following Insert Code:    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 202, 1, 255, Request.Form("DocLocation")) ' adVarWChar

    I have the following code:
    <%
    If (CStr(Request("MM_insert")) = "form1") Then
      If (Not MM_abortEdit) Then
        ' execute the insert
        Dim MM_editCmd
        Set MM_editCmd = Server.CreateObject ("ADODB.Command")
        MM_editCmd.ActiveConnection = MM_NewFLSSARDB_STRING
        MM_editCmd.CommandText = "INSERT INTO DocumentTable (Title, DocLink, UpdatedBy, UpdateDate, Type, Comments) VALUES (?, ?, ?, ?, ?, ?)"
        MM_editCmd.Prepared = true
        MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 255, Request.Form("DocumentName")) ' adVarWChar
        MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 202, 1, 255, Request.Form("DocLocation")) ' adVarWChar
        MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 202, 1, 255, Request.Form("UpdatedBy")) ' adVarWChar
        MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 135, 1, -1, MM_IIF(Request.Form("UpdatedDate"), Request.Form("UpdatedDate"), null)) ' adDBTimeStamp
        MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param5", 202, 1, 255, Request.Form("Type")) ' adVarWChar
        MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param6", 203, 1, 1073741823, Request.Form("Comments")) ' adLongVarWChar
        MM_editCmd.Execute
        MM_editCmd.ActiveConnection.Close
        ' append the query string to the redirect URL
        Dim MM_editRedirectUrl
        MM_editRedirectUrl = "testFLSSARSuperAdminIndex.asp"
        If (Request.QueryString <> "") Then
          If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
            MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
          Else
            MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
          End If
        End If
        Response.Redirect(MM_editRedirectUrl)
      End If
    End If
    %>
    For param2 above I need to add the directory "Docs/" to the command so that the file can be found by the User.  How do I do that?

    If all documents are going to the "/Docs" folder, then I wouldn't include it in the inserted data as you can just add it dynamically where needed. If you do want to include it and it's not part of the posted form data, then just concatenate it (&) prior to inserting into the table.

  • Need to extend the background  due to people being off the background

    I recently saw a video where a Photoshop guru, using CS5 extended, Due to the lack of a larger background, the photographer found himself having to photograph this 20 people group  with 16 of them inside of the background and 4 of them with half of their bodies inside of the background and the other half outside.
    This guru showed that with photoshop CS5 extended he could extend the background and add the 4 subjects with ease and with only 2 stroked.
    I lost the link and would like to learn how he accomplished that.
    What is the easiest way to add the other half of the person on the background?

    The background window is always grey. That item describes a bug which (in some release) made it a different grey.

  • How can I unblock a file being downloaded?

    When I try to download files such as skype from the internet when I click save file as instructed, it blocks the download, if it does download it I can't click it in my documents to open and run the file. How do I unblock these downloads and allow them.
    == This happened ==
    Just once or twice
    == I tried downloading skype.

    It is possible that your anti-virus software is corrupting the downloaded files or otherwise interfering with downloading files by Firefox.
    You can try to disable the real-time (live) scanning of files in your anti-virus software temporarily to see if that makes downloading work.
    Do not forget to re-enable the scanning in your anti-virus software after you are finished with downloading and installing.
    See http://kb.mozillazine.org/Unable_to_save_or_download_files (Disable virus scanning in Firefox preferences - Windows)

  • HT4796 i keep getting an error message on my pc that prevents files being downloaded

    I am trying to syn my pc and new macbook pro.  I downloaed the migrate to mac to my pc 3 different times and still get an error message when I open it up on my pc.

    I don't know. Including what the error message and/or number was would be of some assistance.

  • Excel file header

    hi all,
    I need to convert internal table to excel file. I am using GUI-upload for that.
    i used FILEDNAMES import parameter (undertables) to give file header but thats displays only single lineof header.
    And i need to have a file header of 3 rows. please help me how can i get that.

    hi,
    1.
    Try using the FM " SAP_CONVERT_TO_XLS_FORMAT "
    This FM directly downloads the Internal Table data into the Excel File.
    Sample Report
    REPORT Z_R_TEST_FILE.
    tables: vbak.
    parameters: p_vkorg like vbak-vkorg,
    p_file like rlgrap-filename default 'My Documents\TEST_SALE.xls'.
    data: begin of itab occurs 0,
    vbeln like vbak-vbeln,
    vkorg like vbak-vkorg,
    end of itab.
    start-of-selection.
    select vbeln vkorg from vbak into table itab
    where vkorg = p_vkorg.
    CALL FUNCTION 'SAP_CONVERT_TO_XLS_FORMAT'
    EXPORTING
    I_FIELD_SEPERATOR =
    I_LINE_HEADER =
    I_FILENAME = p_file
    I_APPL_KEEP = ' '
    TABLES
    I_TAB_SAP_DATA = itab
    CHANGING
    I_TAB_CONVERTED_DATA =
    EXCEPTIONS
    CONVERSION_FAILED = 1
    OTHERS = 2
    IF SY-SUBRC 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    write:/ 'Error while downloading'.
    else.
    write:/ 'Successful '.
    ENDIF.
    For headings to appear in the Excel file, APPEND the fieldname to the first line of the Internal Table and pass the table to the FM.
    2. TYPES:
      BEGIN OF type_final,
        string(50) TYPE c,                 " String Value for Title
      END OF type_final.
    data:
    wa_final     TYPE type_final.     " Work Area to hold Title Data
    Internal table to hold Title Data                                   *
    DATA:
      i_final    TYPE STANDARD TABLE OF type_final.
    FORM f400_dwnloadplantdata USING p_filepath TYPE any
                                 p_table TYPE STANDARD TABLE.
      DATA:
          lw_file2 TYPE string .           " File Path
      lw_file2 = p_filepath.
    *&      Form  header
    This Subroutine gets data for displaying title                     *
    There are no interface parameters to be passed to this subroutine. *
    FORM header .
      wa_final-string = text-021.
      APPEND wa_final TO i_final.
      wa_final-string = text-022.
      APPEND wa_final TO i_final.
      wa_final-string = text-023.
      APPEND wa_final TO i_final.
      wa_final-string = text-024.
      APPEND wa_final TO i_final.
      wa_final-string = text-025.
      APPEND wa_final TO i_final.
      wa_final-string = text-026.
      APPEND wa_final TO i_final.
      wa_final-string = 'Sr.No'.
      APPEND wa_final TO i_final.
    ENDFORM.                               " header
      CALL FUNCTION 'GUI_DOWNLOAD'
         EXPORTING
      BIN_FILESIZE                    = BIN_FILESIZE
           filename                        = lw_file2
           filetype                        = 'DBF'
      APPEND                          = ' '
        write_field_separator           = con_tab
      HEADER                          = '00'
      TRUNC_TRAILING_BLANKS           = 'X'
      WRITE_LF                        = 'X'
       COL_SELECT                      = 'X'
       COL_SELECT_MASK                 = w_col_sel
      DAT_MODE                        = ' '
      CONFIRM_OVERWRITE               = ' '
      NO_AUTH_CHECK                   = ' '
      CODEPAGE                        = ' '
      IGNORE_CERR                     = ABAP_TRUE
      REPLACEMENT                     = '#'
      WRITE_BOM                       = ' '
      TRUNC_TRAILING_BLANKS_EOL       = 'X'
      WK1_N_FORMAT                    = '0'
      WK1_N_SIZE                      = ' '
      WK1_T_FORMAT                    = ' '
      WK1_T_SIZE                      = ' '
    IMPORTING
      FILELENGTH                      = FILELENGTH
         TABLES
           data_tab                        = i_output3
           fieldnames                      = i_final
         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
      IF sy-subrc  0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.                               " IF sy-subrc EQ 0
    ENDFORM.                               " f400_dwnloadplantdata
    see i_final is a header table...where i have given header in text elements.& have passes in FM gui...
    3.
    DATA : BEGIN OF it_join_fields OCCURS 0,
    field_name(20),
    END OF it_join_fields.
    CLEAR it_join_fields.
    it_join_fields-field_name = 'pernr'.
    APPEND it_join_fields.
    CLEAR it_join_fields.
    it_join_fields-field_name = 'empname'.
    APPEND it_join_fields.
    CLEAR it_join_fields.
    it_join_fields-field_name = 'new_joinee'.
    APPEND it_join_fields.
    CLEAR it_join_fields.
    it_join_fields-field_name = 'begda'.
    APPEND it_join_fields.
    CLEAR it_join_fields.
    it_join_fields-field_name = 'fath_name'.
    APPEND it_join_fields.
    CLEAR it_join_fields.
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    BIN_FILESIZE =
    filename = file_name
    filetype = 'ASC'
    append = 'X'
    write_field_separator = 'X'
    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 = ' '
    WRITE_LF_AFTER_LAST_LINE = ABAP_TRUE
    SHOW_TRANSFER_STATUS = ABAP_TRUE
    IMPORTING
    FILELENGTH =
    TABLES
    data_tab = it_join_det_new
    fieldnames = it_join_fields
    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
    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.
    it_join_det_new is ur internal table with data.
    4. WS_EXCEL   FM.
    Regards,
    deepthi.

  • Need to extend vendor to a new Purchasing Org

    Hello All,
    I am getting a flat file with existing vendors in SAP System. I need to extend these vendor to the new specified Purchase Org. and also update the fields as per in the excel file (being uploaded).
    One way is to use BDC and perform the desired functionality.
    Second method is to use the BAPI BAPI_VENDOR_CREATE, which again uses CALL TRANSACTION.
    Is there any other method to extend vendor's (except the other 2 stated above).
    Thanks in advace..!!
    Regards,
    Tarun

    Hello,
    Can be done using IDoc, by populating the various segments for basic type CREMAS05 using the new purchasing org and then passing the details to function module IDOC_INBOUND_SINGLE.
    Pass the sender and receiving systems/ports both as the same.
    Other alternative approach is using BDC; extending vendor using XK01 (for new purchasing org) and then update the extended vendor using XK02.
    Regards,
    Tarun

  • Export data to EXCEL file

    Hello All,
    I have 3 internal tables and I need them exported to an one excel file.
    It will have two headers, that shows the description and the other ones will show the DATA.
    Here are an example:
    Header Data                                                   Stage Data                Delivery Data               
    Shipment     Service Agent     Name      SCAC       Stage     Origin     Name     Origin       Region
    12124     51054     LTL Carrier     RLQD     u2026     1     Philadelphia           PA     u2026
    12124     51054     LTL Carrier     RLQD     u2026     2     New York          NY     u2026
    12124     51054     LTL Carrier     RLQD     u2026     2     New York          NY     u2026
    Do you know what kind of function module should I use?
    Thank you,
    Ricardo

    Hi,
    Check out this LINK
    ps: Don´t forget to scroll down..the rest of the code is at the end of the page

Maybe you are looking for

  • Scene Graph traversal. Getting all the children of a node recursively

    Hi, Requirement: To resize all the controls of a scene (including controls that contain text like label, button) as per the scene size Approach: To implement the above requirement (see code snippet below), I added Listeners for width and height prope

  • Photos in text of blog entry do not port to main blog page

    I have posted before about the photos from my entry page disappearing when ported to my main blog page. I have yet to find a solution so I'm asking for help again. I'm am trapped using iWeb 1.1 until I find a solution. I use the Modern Template with

  • Acrobat Reader XI jpeg 2000 insufficient data error

    Good morning,   We've been generating pdf reports with a third party control for about 4 years now.  With the release of Reader 10.1.4 (IIRC) our clients started having problems reading the pdfs and we confirmed the behavior.  Initially, it seemed th

  • Distributed clustered environment

    Hi , Distributed clustered environment: I am going to configure Clustered environment of BO 3.1 , I have some doubt hence I have less experience in clustering. Configuration details : 1) 2 CMS on 2 diffrent unix box 2) Report servers will be installe

  • Tranferring ipod music & playlists to itunes using windows

    My external hard drive crashed with my 12,000 songs on it. The small bright spot of this is all of my music is still on my ipod. I'm very nervous trying "podutil" since this is the only item that has my library on it. Has anyone had success using thi