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: 

download display

Former Member
0 Kudos

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.

2 REPLIES 2

former_member188685
Active Contributor
0 Kudos

Don't Create Threads . Your program is not at all Structured.

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.


PARAMETERS: p_file TYPE rlgrap-filename." 

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
CHANGING
file_name = p_file.

start-of-selection.   "Add this line
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.

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.
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.

Former Member
0 Kudos

a