Program in which  i am downloading   p0002-pernr ,  pernr-ename ,  p0002-sp

I have written a program in which  i am downloading   p0002-pernr ,  pernr-ename ,  p0002-sprsl  in to c:\temp  in csv format ,  i am able to download the file but the program continue running its not stoping   its  acting like an infinite loop   program is given bellow .  i am using logical database in this (pnp) . and when the downloading part is removed and  given the write command  its writting result with out delay . only when downloading i am getting problem   I am using function module GUI_DOWNLOAD to download .
*-- Declaration
TABLES: pernr.
INFOTYPES: 0002.                     "Personal Data
*-- Selection screen
INITIALIZATION.
*-- Processing
DATA: Begin of it_final OCCURS 0,
text(1000) TYPE C,
END OF it_final.
DATA: Begin of it_final1 OCCURS 0,
text(1000) TYPE C,
END OF it_final1.
GET pernr.
  PROVIDE  pernr sprsl from p0002  BETWEEN pnpbegda AND pnpendda.
  CONCATENATE   p0002-pernr pernr-ename p0002-sprsl  into it_final-text separated by ',' .
write it_final-text.
   ENDPROVIDE.
append  it_final.
CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
   BIN_FILESIZE                  =
      filename                      = 'c:\temp\test.csv'
  FILETYPE                      = 'ASC'
    APPEND                        = ' '
     WRITE_FIELD_SEPARATOR         = 'X'
    HEADER                        = '00'
    TRUNC_TRAILING_BLANKS         = ' '
    WRITE_LF                      = 'X'
    COL_SELECT                    = ' '
    COL_SELECT_MASK               = ' '
    DAT_MODE                      = ' '
IMPORTING
    FILELENGTH                    =
    tables
      data_tab                      = it_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
    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.

Look at the BOLD part ...
Declaration
TABLES: pernr.
INFOTYPES: 0002. "Personal Data
Selection screen
INITIALIZATION.
Processing
DATA: Begin of it_final OCCURS 0,
text(1000) TYPE C,
END OF it_final.
DATA: Begin of it_final1 OCCURS 0,
text(1000) TYPE C,
END OF it_final1.
start-of-selection. <--- add this
GET pernr.
PROVIDE pernr sprsl from p0002 BETWEEN pnpbegda AND pnpendda.
CONCATENATE p0002-pernr pernr-ename p0002-sprsl into it_final-text separated by ',' .
write it_final-text.
ENDPROVIDE.
append it_final.
end-of-selection.  <--- add this
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
filename = 'c:\temp\test.csv'
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = 'X'
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
IMPORTING
FILELENGTH =
tables
data_tab = it_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
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.

Similar Messages

Maybe you are looking for

  • How to install in linux Enterprise Edition 6.0

    How to install in linux Enterprise Edition 6.0

  • Top right screen panel blank.  Audio no video.

    Have been trying to cure this problem which started in earlier version..Have done clean reload of 9.0.2 hoping it would fix video problem. When installing or re-installing imovie, have removed App, all Imovie referenced folders, and cleaned entries i

  • Handle special characters in org name

    Hi, I need to do a org recon from my Directory server. Some of the org names have the '/' character and OIM says it can't create the org because of the special character. Could someone please tell me how do I handle this. Thanks, Supreetha

  • Stop and restart screen sharing

    When I call stop() on the ScreenSharePublisher it seems like it's not stopped in the right way or something. If I try to start it again I get this trace: ERROR:The Connection wasn't closed properly by abrupt killing of sharing instance. You need to c

  • Print pmt advice sheet one by one for giving document number ranges

    Hi experts, i developed payment advice program (used as scripts),just enter only one document number and it will print payment advice sheet for that document number only.Now my clnt requirement is they want to enter document numbers in the ranges (EX