Skip to Content

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

down load display2

hi all,

i have written the code to download the data that is in my ztable(zcust1)and i have written the code to it but when i execute it the data doent come in my flatfile(notpad) which is of down.txt.

so where i have gone wrong in my code please assist me with ur help.

below is my code .

thanks

jacob.

tables: zcust1,zemplease.

PARAMETERS: p_file TYPE rlgrap-filename.

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.

data: wa_cust1 like line of i_cust1.

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.

filename = p_file.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = filename

FILETYPE = 'ASC'

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.

if sy-subrc = 0.

cl_gui_frontend_services=>execute(

EXPORTING

DOCUMENT = filename

OPERATION = 'OPEN'

EXCEPTIONS

CNTL_ERROR = 1

).

IF sy-subrc ne 0.

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

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

ENDIF.

endif.

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