06-23-2008 2:37 PM
hi there,
i am using FM BDS_BUSINESSDOCUMENT_CREATEF to upload files to BDS.
but there is a problem with uploading from application server. i only can upload vom my client.
is there a possiblility to upload files from APPLICATION SERVER to BDS ?
reg, Martin
06-23-2008 2:39 PM
06-23-2008 2:39 PM
06-23-2008 2:42 PM
marcin,
thanks a lot, but thats now what i need ! i know how to upload data from appl.server !!
i want to attach it as BDS-file !!!!
reg, Martin
06-23-2008 2:47 PM
May be this code will give some hints......
Here I have uploaded a file from presentation server and store it in BDS....
report z_gos_demo_jg.
type-pools:sbdst.
data: i_file type standard table of char134 initial size 0.
data: l_hstring(1022) type x.
data: l_cstring(255) type c.
data: w_file(134) type c.
data: wa_buffer type string.
data: l_classname type sbdst_classname.
data: i_component type sbdst_components.
data: w_component type bapicompon.
data: i_signature type sbdst_signature.
data: w_signature type bapisignat.
data: i_content type sbdst_content.
data: w_content type bapiconten.
data: l_file type string.
data: objkey type sbdst_object_key.
l_file = 'C:\TEST.PDF'.
field-symbols: <dummy>.
call method cl_gui_frontend_services=>gui_upload
exporting
filename = l_file
filetype = 'ASC'
has_field_separator = SPACE
header_length = 0
read_by_line = 'X'
dat_mode = SPACE
codepage = SPACE
ignore_cerr = ABAP_TRUE
replacement = '#'
virus_scan_profile =
IMPORTING
filelength =
header =
changing
data_tab = i_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
not_supported_by_gui = 17
error_no_gui = 18
others = 19
.
if sy-subrc = 0.
loop at i_file into w_file.
*Replacing space by ~
translate w_file using '~'.
concatenate wa_buffer w_file into wa_buffer.
endloop.
*Replacing ~ by space
translate wa_buffer using '~'.
do.
l_cstring = wa_buffer.
assign l_cstring to <dummy> type 'X'.
check sy-subrc = 0.
move <dummy> to l_hstring.
APPENDing 255 Characters as a record
APPEND wa_record TO i_record.
move l_hstring to w_content-line.
append w_content to i_content.
shift wa_buffer left by 255 places.
SHIFT wa_buffer LEFT BY 1022 PLACES.
if wa_buffer is initial.
exit.
endif.
enddo.
endif.
l_classname = 'BSEG'.
objkey = '100000000018482007001'.
w_component-doc_count = 1.
w_component-comp_count = 1.
w_component-comp_id = '100000000018482007001'.
*W_COMPONENT-COMP_SIZE
select single mimetype from toadd into w_component-mimetype
where doc_type = 'PDF'.
append w_component to i_component.
w_signature-doc_count = 1.
W_SIGNATURE-DOC_ID = 'MESSAGE' .
w_signature-doc_ver_no = 2.
W_SIGNATURE-DOC_VAR_ID
W_SIGNATURE-DOC_VAR_TG
w_signature-comp_count = 1.
w_signature-prop_name = 'DESCRIPTION'.
w_signature-prop_value = 'FILE'.
append w_signature to i_signature.
call method cl_bds_document_set=>create_with_table
exporting
logical_system =
classname = l_classname
classtype = 'BO'
client = sy-mandt
components = i_component
content = i_content
changing
object_key = objkey
signature = i_signature
EXCEPTIONS
internal_error = 1
error_kpro = 2
parameter_error = 3
not_authorized = 4
not_allowed = 5
nothing_found = 6
others = 7
.
if sy-subrc = 0.
commit work.
endif.
06-23-2008 3:04 PM
Hi,
You have to follow the same procedure as shown in my prog. instead of reading the file from presentation server you have to read it from application server. And after that u have to follow the same logic given in my prog.
To read data from application server use open dataset ,read dataset , close dataset statements.
that means you have to replace
call method cl_gui_frontend_services=>gui_upload
exporting
filename = l_file
filetype = 'ASC'
has_field_separator = SPACE
header_length = 0
read_by_line = 'X'
dat_mode = SPACE
codepage = SPACE
ignore_cerr = ABAP_TRUE
replacement = '#'
virus_scan_profile =
IMPORTING
filelength =
header =
changing
data_tab = i_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
not_supported_by_gui = 17
error_no_gui = 18
others = 19
by
open dataset src_filename for input in text mode
encoding default
message v_message.
if sy-subrc = 0.
Read each line in the source file and add it's contents to the
internal table.
do.
read dataset src_filename into i_filedata.
EOF reached
if sy-subrc <> 0.
exit.
else.
append i_filedata.
endif.
enddo.
if i_filedata[] is not initial.
l_rc = 0.
else.
l_rc = 4.
endif.
else.
l_rc = sy-subrc.
endif.
Close the source file
close dataset src_filename.
06-23-2008 3:09 PM
sorry, but this is NOT working.
i get the return-code = 4 from the function call BDS_BUSINESSDOCUMENT_CREATEF
reg, Martin
06-23-2008 3:10 PM
oh, sorry, i just saw that you are using call of a method in class................ ?!? maybe i should try this instead of BDS_BUSINESSDOCUMENT_CREATEF ???
reg, Martin
06-23-2008 5:03 PM
there is still a problem:
i have a table, which is coming back from CONVERT_OTF, where i convert into a PDF-File.
pdf_lines TYPE TABLE OF tline WITH HEADER LINE
this table PDF_lines contains the pdf-file.
how can i use this table in the method which creates the BDS-document ????
reg, Martin
06-24-2008 8:54 AM
has anybody an idea ? i can't get it working fine for me
best reg, Martin
06-23-2008 2:43 PM
Hi,
Upload the file from Presentation server to application server using the TCODE CG3Z. Remember to copy the file path.
Using the FTP you can transfer the data .
Thanks and regards.
06-23-2008 2:50 PM
sorry guys,
i think you all misunderstand me -> well, then i have to explain it more clearly
the file IS already on application server !!!!!!! i want to put it to BDS from appl.server,
NOT from presenation server !
reg, Martin