‎2007 Apr 17 5:20 AM
can anyone please tell how to extract datas in application server
and presentation server
wat is application server?
wat is presentation server?
‎2007 Apr 17 5:24 AM
If u want see the data in application server to presentation server plz go through info.
Presentaion Server- Where SAP GUI have.
Application Server - Where SAP Installed.
Database Server - Where Database installed.
If u want see the file in application or presentation then go for the t.code CZ3Y and Cz3z.
Rewards points.
Rgds,
P.Nag
‎2007 Apr 17 5:28 AM
Hi Arun ,
Presentation server is basically the maching on which SAP GUI is installed , so to put it simply the machine from which you access the SAP system i.e. your machine. To access data from presentation server you can use GUI_UPLOAD , GUI_DOWNLOAD function modules.
Application server is basically the SAP Server , to access data from this you need to user OPEN Dataset , close dataset , Read Dataset e.t.c commands,
Please refer to the help for each for more info.
Regards
Arun
‎2007 Apr 17 5:38 AM
Prsention server is the sap gui...for example if ur drawing money from ATM...now the ATM macine or SAP gui in the ATM is the presentation server whereas the one that takes data from the presentaion server(the ATM) to the database server is the application server....
with regards
vijay
‎2007 Apr 17 5:41 AM
hi Arun,
Check out these sample programs to understand the same
http://www.sapdevelopment.co.uk/file/file_downloadsap.htm ( Application Server )
http://www.sapdevelopment.co.uk/file/file_updownpop.htm ( Presentation Server)
Regards,
Santosh
‎2007 Apr 17 5:45 AM
Hi,
Try 2 understand the following codes these 2 are self explanatory.
presentation server.....................
*"Table declarations...................................................
tables: kna1.
*"Selection screen elements............................................
select-options: s_kunnr for kna1-kunnr. " Customer Number 1
"----
Type declaration of the structure to hold Customer master *
"----
data:
begin of fs_kna1,
kunnr type kna1-kunnr, " Customer Number 1
adrnr type kna1-adrnr, " Address
anred type kna1-anred, " Title
erdat type kna1-erdat, " Date on which Record Was reated
ernam type kna1-ernam, " Name of Person who Created
end of fs_kna1.
"----
Internal table to hold Customer master *
"----
data:
t_kna1 like standard table
of fs_kna1.
"----
Type declaration of the structure to hold file data *
"----
data:
begin of fs_table,
str type string,
end of fs_table.
"----
Internal table to hold file data *
"----
data:
t_table like standard table
of fs_table.
field-symbols: <fs>.
*" Data declarations...................................................
"----
Work variables *
"----
data:
w_char(50) type c.
select kunnr " Customer Number 1
adrnr " Address
anred " Title
erdat " Date on which Record Was reated
ernam " Name of Person who Created
from kna1
into table t_kna1
where kunnr in s_kunnr.
if sy-subrc eq 0.
loop at t_kna1 into fs_kna1.
do.
assign component sy-index of structure fs_kna1 to <fs>.
if sy-subrc ne 0.
exit.
else.
move <fs> to w_char.
if sy-index eq 1.
fs_table-str = <fs>.
else.
concatenate fs_table-str ',' w_char into fs_table-str.
endif. " IF SY-INDEX...
endif. " IF SY-SUBRC...
enddo. " DO...
append fs_table to t_table.
endloop. " LOOP AT T_KNA1...
endif. " IF SY-SUBRC...
call function 'GUI_DOWNLOAD'
exporting
BIN_FILESIZE =
filename = 'C:\Assign\kna1'
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
IMPORTING
FILELENGTH =
tables
data_tab = t_table
FIELDNAMES =
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.
2nd prog.............
data:
begin of fs_spfli,
carrid(3) type c, "spfli-carrid,
connid(4) type c, "spfli-connid,
countryfr(3) type c, " spfli-countryfr,
cityfrom(20) type c, " spfli-cityfrom,
airpfrom(3) type c, " spfli-airpfrom,
countryto(3) type c, " spfli-countryto,
cityto(20) type c, " spfli-cityto,
airpto(3) type c, " spfli-airpto,
end of fs_spfli.
data:
t_spfli like standard table
of fs_spfli.
select carrid
connid
countryfr
cityfrom
airpfrom
countryto
cityto
airpto
from spfli
into table t_spfli.
call function 'DOWNLOAD'
EXPORTING
BIN_FILESIZE = ' '
CODEPAGE = ' '
FILENAME = 'D:\backup\spfli'
FILETYPE = ' '
ITEM = ' '
MODE = ' '
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
FILEMASK_MASK = ' '
FILEMASK_TEXT = ' '
FILETYPE_NO_CHANGE = ' '
FILEMASK_ALL = ' '
FILETYPE_NO_SHOW = ' '
SILENT = 'S'
COL_SELECT = ' '
COL_SELECTMASK = ' '
NO_AUTH_CHECK = ' '
importing
ACT_FILENAME =
ACT_FILETYPE =
FILESIZE =
CANCEL =
tables
data_tab = t_spfli
FIELDNAMES =
EXCEPTIONS
INVALID_FILESIZE = 1
INVALID_TABLE_WIDTH = 2
INVALID_TYPE = 3
NO_BATCH = 4
UNKNOWN_ERROR = 5
GUI_REFUSE_FILETRANSFER = 6
OTHERS = 7.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
application server.....................
*"Table declarations...................................................
tables: bkpf. " Accounting Document Header
*"Selection screen elements............................................
parameters:
p_burks like bkpf-bukrs. " Company Code
select-options:
s_gjahr for bkpf-gjahr. " Fiscal year
"----
Type declaration of the structure to hold Accounting Document Header*
"----
data:
begin of fs_bkpf,
bukrs type bkpf-bukrs, " Company Code
belnr type bkpf-belnr, " Accounting Document Number
gjahr type bkpf-gjahr, " Fiscal year
blart type bkpf-blart, " Document type
bldat type bkpf-bldat, " Document date in document
end of fs_bkpf.
"----
Internal table to hold Accounting Document Header *
"----
data:
t_bkpf like standard table
of fs_bkpf.
"----
Type declaration of the structure to hold file data *
"----
data:
begin of fs_table,
str type string,
end of fs_table.
"----
Internal table to hold file data *
"----
data:
t_table like standard table
of fs_table.
field-symbols: <fs>.
*" Data declarations...................................................
"----
Work variables *
"----
data:
w_char(50) type c,
w_file_name(50) type c value 'YH645_050103'.
select bukrs " Company Code
belnr " Accounting Document Number
gjahr " Fiscal year
blart " Document type
bldat " Document date in document
from bkpf
into table t_bkpf
where bukrs eq p_burks
and gjahr in s_gjahr.
if sy-subrc eq 0.
loop at t_bkpf into fs_bkpf.
do.
assign component sy-index of structure fs_bkpf to <fs>.
if sy-subrc ne 0.
exit.
else.
move <fs> to w_char.
if sy-index eq 1.
fs_table-str = <fs>.
else.
concatenate fs_table-str ',' w_char into fs_table-str.
endif. " IF SY-INDEX...
endif. " IF SY-SUBRC...
enddo. " DO...
append fs_table to t_table.
endloop. " LOOP AT T_KNA1...
endif. " IF SY-SUBRC...
open dataset w_file_name for output in text mode encoding default.
loop at t_table into fs_table.
transfer fs_table-str to w_file_name.
endloop. " LOOP AT T_TABLE...
regards,
kiran kumar k
‎2007 Apr 17 5:48 AM
hI..,
Hi..,
<b>Check this program, it first downloads a file into PRESENTATION server and then upoloads into an internal table and then SAVES THE FILE IN APPLICATION LAYER..
AND AGAIN READS IT FROM APPLICATION LAYER...</b>
tables:
spfli.
data:
wa_spfli type spfli,
w_line(2000) type c,
w_line_up like w_line,
w_file(20) type c value 'GUI-APPTEXT',
w_diff type boolean,
w_count type i,
w_count1 type i.
data:
t_spfli like standard table
of spfli
initial size 0.
data :
t_file like standard table
of w_line
initial size 0,
t_file_up like t_file.
select *
into table t_spfli
from spfli.
call function 'GUI_DOWNLOAD'
exporting
BIN_FILESIZE =
filename = 'D:\spfli'
filetype = 'ASC'
APPEND = ' '
tables
data_tab = t_spfli
FIELDNAMES =
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.
clear t_file.
call function 'GUI_UPLOAD'
exporting
filename = 'D:\spfli'
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
tables
data_tab = t_file
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
<u><b>
*SAVING FILE IN APPLICATION SERVER..</u>
open dataset w_file for output in TEXT MODE ENCODING DEFAULT.
loop at t_file into w_line.
transfer w_line to w_file.
endloop. " Loop at t_file into w_line.
close dataset w_file.
<u>
*READING FILE FROM APPLICATION SERVER...</u>
open dataset w_file for input in TEXT MODE ENCODING DEFAULT.
do.
read dataset w_file into w_line_up.
if sy-subrc ne 0.
exit.
endif. " If sy-subrc ne 0.
append w_line_up to t_file_up.
enddo. " Do.
close dataset w_file.</b>
loop at t_file_up into w_line_up.
write 😕 w_line_up.
endloop.
regards,
sai ramesh