Skip to Content

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

download display

hi all,

am using fm to download the data into a note pad and everything works fine but how can i display it in the note pad pls see my below code and assist me

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.

filename = p_file.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = filename

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.

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