Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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.

4 REPLIES 4

Former Member
0 Kudos

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.

0 Kudos

Thanks Sreenivas its solved

former_member184119
Active Contributor
0 Kudos

HI Swaroop ur facing the problem because u r writing the gui_download between the start-of-selection...

and end-of-selection.

Move the data inot final interanl table and append the table.

and write gui_downlaod after end-of-selection.

then it will be increase..

and one more thingis dont write provide..endprovide..

write: rp_provide depends on your requirement,.

Regards

sas

  • reward if useful *

venkat_o
Active Contributor
0 Kudos

Hi Sooraj, If you use any LDB, and GET event, statements after GET are like Statements within SELECT-ENDSELECT. So you should not use GUI_DOWNLOAD for a loop. When u use GET PERNR event, in ur company 1000 employees have been maintained, GET event is triggered 1000 times. ur GUI_DOWNLOAD is interacted with presentation server those many times. What my advise is After GET event use END-OF-SELECTION event. Between GET and END-OF-SELECTION, append the data for each employee. for our example 1000 records will be there . After END-OF-SELECTION download ur final internal table. I hope u can understand. Regards, Venkat.O