Problem with gui_download

Hi,
in my gui_download function I'm passing the 'ASC' value to the parameter filetype but, once I go to the txt file downladed and I try to save it as a csv file I realise that it's of type UTF-8 and not an ASCII type.
Can anybody tell me why the file downloaded isn't of type ASCII?
Thanks in advance.
Regards.

Hi,
To save .txt file in .csv format.  Follow the below mentioned ways , Hope will help you to solve .....
1) There are different ways in creating a CSV file. The RIGHT way is to use the function SAP_CONVERT_TO_CSV_FORMAT. You can just go through the FM. To complete, for every convert fuction there is an equal and opposite convert function,  TEXT_CONVERT_CSV_TO_SAP.
2) Use this [LINK|How to create .csv file from ABAP report; as well.
Regards,
Saravana.S
Edited by: saravanasap on Jan 27, 2012 5:49 AM

Similar Messages

  • Problem with GUI_DOWNLOAD fm in Background

    Hi Friends
    In my Report I am using the FM: GUI_DOWNLOAD and while running the report in foreground, I am getting the proper results. But while running the same in Background I am getting the error: CONTROL_FLUSH_ERROR .
    As my understanding ,to resolve this we have to upgrade the sap gui.
    Can anyone suggest me the exact reason for this error and the solution as well.
    Points are assured for useful answers.
    Regards,
    Sree

    Dear sir ,
    there is nothing to worry about it,
    while instaltion of the sap-gui,
    your grapics gui nested options are not tckied,
    at the time of instalation,
    in that there are two option one is at os level and
    2nd one is backen level.
    pls check the both option ticked or not.
    also check that the gui patch of new Ecc.vesrion, is
    under the AMC of the sap or not.
    pls ask to your basis admisitrator to reasign the
    runtime memory area roll out, should be more then rool in
    area.
    i think problem must solve.
    pls try and do this and keep in contact.
    REWARDS are expected.
    yours
    vivek

  • Problem with GUI_download in background

    Hi all,
            When i ran the program in the background,the job has been canceled.
            the report should download the records into the local file have checked in debug mode the job has canceled when it comes to GUI_DOWNLOAD,GUI_download will not work in background or not.
    if i ran the program in foreground it will generate the file.
    please help me.
    thanks
    sriman.

    Hi Sriman,
    The FM GUI_DOWNLAOD will not work in background mode, as it has to download to the local PC, but when run in background it is being run on the APP server and thus loses the link with the Desktop, so it does not know what desktop to download the file to and hits an error which is why the program will dump.
    Better to use the open dataset commands if running in background as this will download the file to the server, where the code is being run, you can easily FTP the file back on to the desktop if need be.

  • Problem with gui_download when using DBF FILE type.

    Good Day Experts.
    I am trying to download excel file using function module  GUI_DOWNLOAD.
    declared  a table it_string type table string.
    initially I  appending my header to it_string. and then passing  my internal table to it  .
    this is how I am passing data into it_string.
    so in gui_download I am passing parameters as below. but I am not getting data into the excel file.
    I tried both ways passing field separator  as 'X' and '#'.
    please guide me where I am wrong.

    Hello Surendra,
    Can you please upload your code sample. Thanks.
    What i manage to find is using this function module  WS_DOWNLOAD.
    The file is downloaded in the directory -->  C:/
    Here is the code sample :
    TABLES: usr03,dd02l.
    DATA: zx030l LIKE x030l.
    DATA BEGIN OF zdfies OCCURS 0.
             INCLUDE STRUCTURE dfies.
    DATA END OF zdfies.
    DATA: BEGIN OF flditab OCCURS 0,
           fldname(11) TYPE c,
           END OF flditab.
    DATA itabusr03 LIKE usr03 OCCURS 0 WITH HEADER LINE.
    DATA tname LIKE dd02l-tabname.
    SELECT * FROM usr03 INTO TABLE itabusr03.
    tname = 'USR03'.
    PERFORM getfieleds.
    PERFORM dwdbffile.
    FORM getfieleds.
       CALL FUNCTION 'GET_FIELDTAB'
         EXPORTING
           langu               = sy-langu
           only                = space
           tabname             = tname
           withtext            = 'X'
         IMPORTING
           header              = zx030l
         TABLES
           fieldtab            = zdfies
         EXCEPTIONS
           internal_error      = 01
           no_texts_found      = 02
           table_has_no_fields = 03
           table_not_activ     = 04.
       CASE sy-subrc.
         WHEN 0.
           LOOP AT zdfies.
             flditab-fldname = zdfies-fieldname.
             APPEND flditab.
           ENDLOOP.
         WHEN OTHERS.
           MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH  sy-subrc.
       ENDCASE.
    ENDFORM.                    "GETFIELEDS
    FORM dwdbffile.
       CALL FUNCTION 'WS_DOWNLOAD'
         EXPORTING
    *      filename                = 'C:\USR03.DBF'
           filename                = 'C:\USR03.XLS'
           filetype                = 'DBF'
         TABLES
           data_tab                = itabusr03
           fieldnames              = flditab
         EXCEPTIONS
           file_open_error         = 1
           file_write_error        = 2
           invalid_filesize        = 3
           invalid_type            = 4
           no_batch                = 5
           unknown_error           = 6
           invalid_table_width     = 7
           gui_refuse_filetransfer = 8
           customer_error          = 9
           OTHERS                  = 10.
       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.                    "DWDBFFILE
    Thanks and Kind Regards,
    Yovish.

  • Problem with Gui_download using ASC File type - japanese characters

    Hi,
    During upgrade,while downloading data for japanese characters using GUI_DOWNLOAD Function module with file type as 'ASC', the space between 2 fields data getting much wider compared to 4.6C Version ws_download Function module's  data.
    Example: the gap between first field data and second field data in ECC 6.0 is 6 characters length,but in 4.6C it is 2 characters length.
    Is there any possibility to get the results similar to 4.6c version.Please give your valueable suggestions.
    Thanks
    BalaNarasimman

    Hi Sandra
    Please find the detailed information for your questions.
    1.Internal table content before download:During Debugging,it was observed that internal table content was same in both versions.For testing,i used only brand new data(Transaction entry).
    2.Download with code Page conversion:Yes,codepage parameter 4103 was explicitly passed into GUI_DOWNLOAD Function module.Also the front end code page which is used by system is 4110 . No errors occured.
    3.System is an Unicode system only.
    4.Actually this 6 character does not refer the byte value,only the gap between 2 fields data is getting referred in ECC 6.0.Please find the below example.
    Example - File data after Download:
    ECC 6.0: Field1            Field2      (gap - 6 characters space between 2 fields data)  Using GUI_Download
    data       u0152©Ïu201Dԍu2020      EN                               
         4.6C: Field1            Field2       (gap - 2 characters space between 2 fields data) Using WS_Download
         data    u0152©Ïu201Dԍu2020  EN    
    Note:Special characters are Japanese characters:

  • Problem with GUI_DOWNLOAD XLS File

    Hi Experts,
    I have used GUI_DOWNLOAD function to download my internal tables in .xls file in local system.  I have used 'ASC' as file type.
    File has been successfully created as .xls. But when you open that file in our local system and update some entries and try to save it, but it has not saving and its giving error. I am not able to update/change that file.
    Is there any other FM which I will use to download a .xls file perfectly...
    Regards,
    Ramesh.

    USe Function Like this:
    data : if_intern type  kcde_cells occurs 0 with header line.
    For calling File
    call function 'KD_GET_FILENAME_ON_F4'
        EXPORTING
          program_name = syst-repid
        CHANGING
          file_name    = p_file1.
    For Excel data upload
    call function 'KCD_EXCEL_OLE_TO_INT_CONVERT'
        EXPORTING
          filename    = p_filename
          i_begin_col = vf_start_col
          i_begin_row = p_brow2
          i_end_col   = vf_end_col
          i_end_row   = p_erow2
        TABLES
          intern      = if_intern.
    if if_intern[] is initial.
        p_text = 'No Data Uploaded'.
    endif.
    Edited by: shelly Malik on Aug 18, 2009 12:34 PM

  • GUI_DOWNLOAD: problems with table containing char length 8000

    Hi
    I have some problems using GUI_DOWNLOAD. Here is some of my code:
    DATA: g_record TYPE Z_CHAR8000 OCCURS 0 WITH HEADER LINE.
    z_char8000 is a char of length 8000
    insert code to fill data in g_record
        CALL FUNCTION 'GUI_DOWNLOAD'
          EXPORTING
            filename                  = g_filename
          filetype                  = 'ASC'  
            filetype                  = 'BIN'  
            TRUNC_TRAILING_BLANKS     = 'X'
            TRUNC_TRAILING_BLANKS_EOL = 'X'
          TABLES
            data_tab                = g_record
          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.
    An example of data in g_record:
    Hans,Kruger,Berlin,Superstrass 3,0101709991,,,,,,,,,,,,
    When I open the resulting file in notepad the above data is present, and that's a good thing! The bad thing is that for every entry I have in the g_record table the GUI_DOWNLOAD puts 8000 characters into the file (the data from g_record and trailing blanks so that the line becomes 8000 chars long). I dont want the trailing blanks and TRUNC_TRAILING_BLANKS dont seem to work. Have any of you had hte same problem and/or is there a solution?!
    I have tried using filetype ASC and here I dont get the trailing blanks, but another problem hits me. I cant download more that 1024 characters from each entry in g_record and thats not good enough!
    Regards Anders

    Hi Andres,
    take this itab-definition for your download:
    TYPES:BEGIN OF ty_down,
          line TYPE string,
          END OF ty_down.
    DATA wa_down TYPE ty_down.
    DATA g_record  TYPE TABLE OF ty_down.
    regards Andreas

  • Problem with function 'GUI_DOWNLOAD'

    Hi to everybody!!
    I've a problem with the function GUI_DOWNLOAD, when I execute the program this make a dump and the problem is in this function.
    I've read the log and this said that :
    An exception occurred that is explained in detail below.
    The exception, which is assigned to class 'CX_SY_DYN_CALL_PARAM_NOT_FOUND', was
      not caught in
    procedure "CREAR_FICHERO" "(FORM)", nor was it propagated by a RAISING clause.
    Since the caller of the procedure could not have anticipated that the
    exception would occur, the current program is terminated.
    The reason for the exception is:
    Function module "GUI_DOWNLOAD" was called
    with the parameter "ACCESS_DENIED".
    This parameter is not defined.
    Can anybody tell me what's the meaning of this?
    Thanks very much,
    Regards,
    Rebeca

    Hi,
    You must have the write access to the file in OS level to which you are trying to download the table content using the function module 'GUI_DOWNLOAD'.The error occurs because the system is trying to write in a file to which, the write permission is not permitted for the user.If you are catching the exceptions properly.It will give the proper message instead of dump.
    Regards,
    Ajith

  • Problem with pdf display downloaded from application server

    Hi all,
    I have a problem with displaying pdf downloaded from application server (saved in BINARY MODE).
    I am getting the pdf output of adobe form in FPFORMOUTPUT-PDF as rawstring back to my program and then converting that rawstring into binary form using the function module SCMS_BINARY_TO_STRING.
    Now, when I export the data to presentation server directly using cl_gui_frontend_services=>gui_download, the pdf is downloaded properly.
    However, when I save the data to application server file by looping at the internal table obtained from SCMS_XSTRING_TO_BINARY and using TRANSFER, and subsequently downloading the file in "unconverted format" from AL11 to my desktop, I am getting a "blank" pdf file (with the same number of pages as the one downloaded using gui_download).
    I have tried different encodings during download but in those cases i get corrupted pdf message. only the default option of INTIAL value seems to work.
    I am forced to believe that there is a problem in my code which saves the data to app server but I cant find any solution that is logical. Any solution to this would be greatly appreciated.
    Regards,
    Sasi
    Edited by: Sasi Upadrasta on Sep 29, 2010 7:55 PM

    used a program to read the file from appl server and then downloading it to desktop.

  • Replacing download with gui_download

    Hi,
    as part of upgradation i am  trying to replace Download fm with  Gui_download but the problem is in download function i have  exp parameter  filemask_mask but  its not available in gui_download. Is there any way to  down load? Please help me out!!
    Thanks and Reg,
    Archana
    Edited by: archana pakanati on Feb 9, 2009 8:14 AM

    Hi,
    Refer to the following code:
    *& Report  ZDOWNLOAD_PROGRAM
    report  zdownload_program.
    parameter : p_path type rlgrap-filename default 'C:\Pdata.xls'.
    data : gt_output   type standard table of trdirt,
           wa_output   type trdirt,
           p_filen     type string.
    at selection-screen on value-request for p_path.
      clear p_path.
      call function 'F4_FILENAME'
        importing
          file_name = p_path.
    start-of-selection.
      select * from trdirt
               into table gt_output
               where name like 'Z%'
                  or name like 'Y%'.
    end-of-selection.
      move : p_path to p_filen.
      call function 'GUI_DOWNLOAD'
        exporting
      BIN_FILESIZE                    =
          filename                        = p_filen
       filetype                        = 'ASC'
      APPEND                          = ' '
       write_field_separator           =
    cl_abap_char_utilities=>horizontal_tab
      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
    IMPORTING
      FILELENGTH                      =
        tables
          data_tab                        = gt_output
      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.
    Regards
    Rajesh Kumar

  • CONTROL_FLUSH_ERROR with GUI_DOWNLOAD

    Dear All
      My report throws "CONTROL_FLUSH_ERROR with GUI_DOWNLOAD "   even though i am using it in foreground .
    Any help will be rewarded .
    Regards
    Jaman

    Check out this thread
    https://forums.sdn.sap.com/click.jspa?searchID=875715&messageID=2952760
    You will get "CONTROL_FLUSH_ERROR " error when there is some problem with SAP GUI. Check your Gui installation and if possible uninstall the exixting GUI and reinstall the new GUI from fresh.
    or use
       CALL METHOD cl_gui_frontend_services=>gui_download
          EXPORTING
            bin_filesize = l_xml_size
            filename     = 'c:tempflights.xml'
            filetype     = 'BIN'
          CHANGING
            data_tab     = l_xml_table
          EXCEPTIONS
            OTHERS       = 24.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                     WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
    Regards,
    Santosh

  • Problem with column selection in GUI_DOWLOAD

    Hi everyone !
    I want to save data from an internal table to a DAT file using GUI_DOWLOAD. In this internal table, there are 2 colums that won't be downloaded so I call the FM this way :
        CALL FUNCTION 'GUI_DOWNLOAD'
             EXPORTING
                  FILENAME                = L_FILE
                  FILETYPE                = 'DAT'
                  COL_SELECT              = 'X'
                  COL_SELECT_MASK          = V_COLSELECT
             TABLES
                  DATA_TAB                = TAB_OUT
                  FIELDNAMES              = TAB_FIELDNAMES.
    V_COLSELECT contains an 'X' for each column I need to be downloaded and a space for the 2 other columns.
    In the result file, the columns that I didn't select don't appear BUT there are 2 columns with no header and filled with zeros at the right edge of the file. I don't know where these 2 columns come from. Maybe a problem with fieldnames but I'm not sure (in TAB_OUT, all columns are present but in TAB_FIELDNAMES there are only headers for the selected columns).
    If anybody have an idea, please just tell me.
    Points will be rewarded for helpful answers.
    Thanks.
    Nicolas.

    Hi,
    Try to keep fields same in TAB_FIELDNAMES and TAB_OUT. because anyway you are using COL_SELECT_MASK.
    I think you are using COL_SELECT_MASK properly ie
    if you have 6 field in the TAB_OUT out of that you need to donwload 1,3,6 then your
    COL_SELECT_MASK will be X X  X
    aRs

  • Problem with file receiving through abap web service

    Hi experts,
    I need to created web service for import file from .NET application into SAP.
    ABAP function expect hexadecimal string (same as GUI_UPLOAD / GUI_DOWNLOAD) but hexadecimal string from C# is too long (double longer), and I have no idea how to convert it. Also there is a problem with code page...
    Is there some better way to do this? Any idea is welcome!

    Hi Nemanja,
    Please bear in mind that your SAP system is based on UTF-8 encoding. Since you have the xstring length doubled, most probably your sender system uses UTF-16 encoding. So what you need to do is change the encoding used by your .NET application when sending the data to SAP.
    Alternatively, you can try using XSL Transformations in ABAP to have the input data converted from UTF-16-encoded xstring to ABAP structures. You can find a little example in this thread: ABAP data to XML conv with UTF-8 encoding and custom namespace. The point is to start your XSLT with the following: <?xml version="1.0" encoding="utf-16"?>.
    Hope this helps,
    Greg

  • Problem with Polish Characters while downloading data using GUI_DOWLOAD

    Hi,
    I was trying to create a file on the presentation server using GUI_DOWLOAD.
    I am facing a problem with the data that contains polish characters.. like Ą , Ł..
    There is  a vendor numer in the system as FRĄCZEK, when i was tring to download, the vendor number is downloaded as FR¥CZEK, even i tried to download from SE16 also, still i am facing the same problem.
    I am facing the above problem with soem other polish characters..
    Is there any solution  to download the data properly.. ?
    Guys please help me.
    Thanks in advacnce.
    Regards,
    Sriram.
    Edited by: Srirama Murthy Maddirala on Oct 27, 2009 8:10 AM

    Hi Sriram,
    <li>Get the front-end code page using NLS_GET_FRONTEND_CP.
    <li>Pass the code page through GUI_DOWNLOAD.
    REPORT  ztest.
    TYPE-POOLS:abap.
    DATA:frontend_codepage TYPE  cpcodepage.
    DATA:codepage          TYPE  abap_encoding.
    "Get the Frontend Code page
    CALL FUNCTION 'NLS_GET_FRONTEND_CP'
      EXPORTING
        langu             = sy-langu
      IMPORTING
        frontend_codepage = frontend_codepage.
    "Pass the codepage through GUI_DOWNLOAD function module
    codepage = frontend_codepage.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename = 'C:\temp\data.xls'
        filetype = 'ASC'
        codepage = codepage
      TABLES
        data_tab = it_data.
    Thanks
    Venkat.O

  • Problem with the default selection screen condition

    hi guys,
    I have got some problem with the default screen given by the PNP logical database, P0000 infotype automatically populated according to the condition given in default screen.
    Reg,
    Hariharan

    Don know what u r trying to acheive.
    1) when u have specified PNP in the logical databse field of attributes of program, the SAP wil proivde u default PNP screen and here u can also add ur paramters if u want.
    2) in the program u have to declare like
    INFOTYPES: 0000,0001. "Etc
    for all the infotypes u want to use in the program.
    3) it is the GET PERNR event which wil fil all the p0000 and p0001 (internal tables for al the infotypes declared via INFOTYPES syntax as shown above)
    4) after tht get pernr, u now have data in P tables and u can use it for further reporting.
    5) refer below dummy code -
    REPORT  ZPPL_PREVEMPLOYERS   message-id rp
                                 line-size 250
                                 line-count 65.
    *Program logic :- This Report is used to Download all the Previous
    * Employer (IT0023) records of the employees
    *eject
    *& Tables and Infotypes                                                *
    tables: pernr.
    infotypes: 0000,
               0001,
               0002,
               0023.
    *eject
    *& Constants                                                           *
    constants: c_1(1)       type c               value '1'   ,
               c_3(1)       type c               value '3'   ,
               c_i(1)       type c               value 'I'   ,
               c_x(1)       type c               value 'X'   ,
               c_eq(2)      type c               value 'EQ'  ,
               c_pl03       like p0001-werks     value 'PL03'.
    *eject
    *& Selection-Screen                                                    *
    parameters: p_file  like rlgrap-filename default 'C:TempABC.xls',
                p_test  as checkbox default c_x               .
    *eject
    *& Internal tables                                                     *
    * Internal Table for Output
    data: begin of t_output occurs 0    ,
           pernr like pernr-pernr       ,
           nachn like p0002-nachn       ,
           vorna like p0002-vorna       ,
           orgeh_stext like p1000-stext ,
           plans_stext like p1000-stext ,
           begda like p0023-begda       ,
           endda like p0023-endda       ,
           land1 like p0023-land1       ,
           arbgb like p0023-arbgb       ,
           ort01 like p0023-ort01   .
    data: end of t_output           .
    *eject
    *& Variables                                                           *
    data: o_stext like p1000-stext,
          p_stext like p1000-stext.
    *eject
    *& Initialization                                                      *
    Initialization.
    * Initialize Selection-Screen values
      perform init_selction_screen.
    *eject
    *& AT Selection-screen                                                 *
    at selection-screen .
    * Check if Test run selected, download file name should be entered
      if p_test is initial.  "
        if p_file is initial.
          message e016 with 'Please enter file name'
                            'specifying complete path'.
        endif.
      endif.
    *eject
    *& Start-of Selection                                                  *
    Start-of-selection.
    get pernr.
      clear t_output.
    * Read Infotype 0
      rp-provide-from-last p0000 space pn-begda pn-endda.
      check pnp-sw-found eq c_1.
    * Check if employee is active
      check p0000-stat2 in pnpstat2.      "pernr Active
    * Read Infotype 1
      rp-provide-from-last p0001 space pn-begda pn-endda.
      check pnp-sw-found eq c_1.
    * check if employee belongs to PL03
      check p0001-werks in pnpwerks.  "belongs to PL03
    * Check if emp belongs to Active Group
      check p0001-persg in pnppersg.
    * Read Infotype 2
      rp-provide-from-last p0002 space pn-begda pn-endda.
      check pnp-sw-found eq c_1.
    * Read Org Unit Text.
    CALL FUNCTION 'HR_READ_FOREIGN_OBJECT_TEXT'
         EXPORTING
              OTYPE                   = 'O'
              objid                   = p0001-orgeh
              begda                   = p0001-begda
              endda                   = p0001-endda
              reference_date          = p0001-begda
         IMPORTING
              object_text             = o_stext
          EXCEPTIONS
              nothing_found           = 1
              wrong_objecttype        = 2
              missing_costcenter_data = 3
              missing_object_id       = 4
              OTHERS                  = 5.
    *Read Position Text.
    CALL FUNCTION 'HR_READ_FOREIGN_OBJECT_TEXT'
         EXPORTING
              OTYPE                   = 'S'
              objid                   = p0001-plans
              begda                   = p0001-begda
              endda                   = p0001-endda
              reference_date          = p0001-begda
         IMPORTING
              object_text             = p_stext
         EXCEPTIONS
              nothing_found           = 1
              wrong_objecttype        = 2
              missing_costcenter_data = 3
              missing_object_id       = 4
              OTHERS                  = 5.
    * Gather all the required information related to the emp
      move: pernr-pernr to t_output-pernr,
            o_stext to t_output-orgeh_stext,
            p_stext to t_output-plans_stext,
            p0002-nachn to t_output-nachn,
            p0002-vorna to t_output-vorna.
    * Gather previous Employee details
      loop at p0023.
        move-corresponding p0023 to t_output.
        append t_output.
      endloop.
    *eject
    *& End-of Selection                                                    *
    end-of-selection.
      perform print_report.
    * Downlaod the file
      if not t_output[] is initial.
        if p_test eq space.
          perform download_file.
        endif.
      else.
        write: 'No records selected' color col_negative.
      endif.
    *eject
    *& Top-of-page                                                         *
    Top-of-page.
    * Print Header
      perform print_header.
    *eject
    *&      Form  download_file
    * Description :
    FORM download_file .
      DATA: full_file_name    TYPE string,
            z_akt_filesize    TYPE i     .
      full_file_name = p_file.
    *  download table into file on presentation server
      CALL METHOD cl_gui_frontend_services=>gui_download
        EXPORTING
          filename                = full_file_name
          filetype                = 'DAT'
          NO_AUTH_CHECK           = c_x
          codepage                = '1160'
        IMPORTING
          FILELENGTH              = z_akt_filesize
        CHANGING
          data_tab                = t_output[]
        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
          not_supported_by_gui    = 22
          error_no_gui            = 23
          OTHERS                  = 24.
      IF  sy-subrc               NE        0.
        MESSAGE e016 WITH 'Download-Error; RC:' sy-subrc.
      ENDIF.
    ENDFORM.                    " download_file
    *eject
    *&      Form  print_report
    *Description:
    FORM print_report .
      data: i       type i,
            w_count type i.
      sort t_output.
    * Print the report
      loop at t_output.
        i = sy-tabix mod 2.
        if i eq 0.
          format color col_normal intensified on.
        else.
          format color col_normal intensified off.
        endif.
        write:/1     t_output-pernr          ,
               10     t_output-vorna(25)     ,
               35    t_output-nachn(25)      ,
               61   t_output-orgeh_stext     ,
               102  t_output-plans_stext     ,
               143  t_output-begda           ,
               154   t_output-endda          ,
               168   t_output-land1          ,
               178   t_output-arbgb(40)      ,
               219   t_output-ort01          ,
               249   space              .
      endloop.
      uline.
      Describe table t_output lines w_count.
      Skip 2.
      Write:/ 'Total No of Records Downloaded: ' color col_total,
              w_count.
    ENDFORM.                    " print_report
    *eject
    *&      Form  print_header
    *Description:
    FORM print_header .
      skip 1.
      Uline.
      format Intensified on color col_heading.
      write:/1   'Pers. #'        ,
             10   'Last Name'     ,
             35   'First Name'    ,
             61   'Org Unit'      ,
             102  'Position'      ,
             143  'Beg Date'      ,
            154   'End Date'      ,
            168   'Cntry Key'     ,
            178   'Prev Employer' ,
            219  'City'           ,
            249   space          .
      format intensified off color off.
      uline.
    ENDFORM.                    " print_header
    *eject
    *&      Form  init_selction_screen
    *Description:
    FORM init_selction_screen .
      refresh: pnpwerks,
               pnppersg,
               pnpstat2.
      clear:   pnpwerks,
               pnppersg,
               pnpstat2.
      pnpwerks-sign   = c_i.
      pnpwerks-option = c_EQ.
      pnpwerks-low    = c_pl03.
      append pnpwerks.
      pnppersg-sign   = c_i.
      pnppersg-option = c_EQ.
      pnppersg-low    = c_1.
      append pnppersg.
      pnpstat2-sign   = c_i.
      pnpstat2-option = c_EQ.
      pnpstat2-low    = c_3.
      append pnpstat2.
    ENDFORM.                    " init_selction_screen

Maybe you are looking for

  • Not able to post any question

    I am trying to post a question related to PM module but i am not able to post it. Can anyone help me in this regard.

  • Lumia 620 screen problem.

    I have been having this odd problem where the screen doesn't come on when I press the unlock button. At first I thought the phone had hung but after further investigation, I found that it was just the screen that wasn't coming on. It would still ring

  • Error in Loading data to 0Material

    Hi Experts, I am facing problem in uploading the data for 0MATERIAL from its DataSource. For few materials i am getting this error: 0MATERIAL : Data record 22324 ('  A46203A0079 '): Version '  A46203A0079 ' is not valid Diagnosis      Data record 223

  • Problem with transitions

    Hello. I now often can't put a transition between two clips. I don't know why. Everything es rendered, clips are snapped together but still.

  • Can SocketChannel.write return -1 ?

    Hi, In the SSLEngine documentation sample code it mentions handling a -1 returned by Channel.write() if the channel is closed. This is the only place I've ever seen it mentioned, there's nothing in the javadoc, and I've never come across it in practi