Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

error at download

hi all ,

i have data in my ztable (zcust) and i need to download it into a notepad. i hav started but it gives me runtime error when calling the FM i,e gui_download. so pls can u correct my code incase if i have gone wrong. below is my code:

PARAMETERS: p_file TYPE rlgrap-filename.

Data: Begin of i_string occurs 0,

line(1024) type c,

End of i_string.

types: begin of s_cust1,

zempno like zcust1-zempno,

zcustnumber like zcust1-zcustnumber,

zcustname like zcust1-zcustname,

zcustbd like zcust1-zcustbd,

zno_chil like zcust1-zno_chil,

END OF s_cust1.

data: i_cust1 TYPE STANDARD TABLE OF s_cust1 WITH HEADER LINE.

data: wa_cust1 like LINE OF i_cust1.

Data: filename type string,

delim(1) type c value '|',

g_lines type i.

select zempno

zcustnumber

zcustname

zcustbd

zno_chil

from zcust1

into CORRESPONDING FIELDS OF TABLE i_cust1.

if sy-subrc = 0.

message i009(zdd) with 'records fetched'.

endif.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

CALL FUNCTION 'KD_GET_FILENAME_ON_F4'

CHANGING

file_name = p_file.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

  • BIN_FILESIZE =

filename = 'c:\Documents and Settings\Desktop\down.txt'

FILETYPE = 'ASC'

  • APPEND = ' '

WRITE_FIELD_SEPARATOR = 'X'

tables

data_tab = i_cust1.

*

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

thanks in advance

jacob

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question