We have added search box. Key in SAP issue keyword to search
TopBottom

Announcement: wanna exchange links? contact me at sapchatroom@gmail.com.

[sap-dev] Uploaded File in Service for Object in Va02 Though Background Not Deleting in the Pop GOS

Posted by Admin at
Share this post:
Ma.gnolia DiggIt! Del.icio.us Yahoo Furl Technorati Reddit

Question from sanju-k on May 15 at 12:31 AM
Uploaded file in service for object in va02 though background not deleting in the pop GOS
but when I uploading manually it is deleting.
Please go through this code.

report zbds_so_att_create.
data lv_file type string.
data lv_logical_system type tbdls-logsys.
data lv_filename type string.
data lv_filepath type string.
data lv_object_key type bapibds01-objkey.
data lt_files type table of bapifiles.
data ls_files like line of lt_files.
data ls_signature type bapisignat.
data lt_signature type table of bapisignat.
data gt_filetable type filetable.
data gs_filetable type line of filetable.
data gv_rc type i.
parameters p_vbeln type vbak-vbeln obligatory.
parameters p_file type rlgrap-filename.
at selection-screen on value-request for p_file.
call method cl_gui_frontend_services=>file_open_dialog
changing
file_table = gt_filetable
rc = gv_rc
exceptions
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
others = 5.
read table gt_filetable into gs_filetable index 1.
if sy-subrc eq 0.
p_file = gs_filetable-filename.
endif.
start-of-selection.
data lt_data type table of bapiconten.
data lv_filelength type i.
data lt_components type table of bapicompon.
data ls_components type bapicompon.
data lv_strip type string.
data lv_extension(10).
data lv_mimetype type mimetypes-type.
check p_vbeln is not initial and p_file is not initial.
move p_file to lv_file.
call method cl_gui_frontend_services=>gui_upload
exporting
filename = lv_file
filetype = 'BIN' "Binary Mode
importing
filelength = lv_filelength
changing
data_tab = lt_data
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.
call function 'OWN_LOGICAL_SYSTEM_GET'
importing
own_logical_system = lv_logical_system.
call function 'SO_SPLIT_FILE_AND_PATH'
exporting
full_name = lv_file
importing
stripped_name = lv_filename
file_path = lv_filepath
exceptions
x_error = 1
others = 2.
split lv_filename at '.' into lv_strip lv_extension.
call function 'SDOK_MIMETYPE_GET'
exporting
extension = lv_extension
importing
mimetype = lv_mimetype.
ls_files-doc_count = '1'.
ls_files-comp_count = '1'.
move lv_filename to ls_files-filename.
move lv_filepath to ls_files-directory.
append ls_files to lt_files.
clear ls_files.
ls_components-doc_count = '1'.
ls_components-comp_count = '1'.
ls_components-mimetype = lv_mimetype.
ls_components-comp_size = lv_filelength.
append ls_components to lt_components.
clear ls_components.
ls_signature-doc_count = '1'.
append ls_signature to lt_signature.
ls_signature-prop_name = 'DESCRIPTION'.
ls_signature-prop_value = lv_filename.
append ls_signature to lt_signature.
ls_signature-prop_name = 'LANGUAGE'.
ls_signature-prop_value = sy-langu.
append ls_signature to lt_signature.
ls_signature-prop_name = 'BDS_DOCUMENTTYPE'.
ls_signature-prop_value = 'ATTACHMENT'.
append ls_signature to lt_signature.
clear ls_signature.
move p_vbeln to lv_object_key.
call function 'BDS_BUSINESSDOCUMENT_CREA_TAB'
exporting
logical_system = lv_logical_system
classname = 'BUS2032' "Sales order BO
classtype = 'BO'
object_key = lv_object_key
binary_flag = 'X'
tables
signature = lt_signature
components = lt_components
content = lt_data
exceptions
nothing_found = 1
parameter_error = 2
not_allowed = 3
error_kpro = 4
internal_error = 5
not_authorized = 6
others = 7.
if sy-subrc <> 0.
write:/ 'File not loaded'.
else.
write:/ 'File loaded successfully
 
Reply to this email to post your response.
 
__.____._
Manage Settings | Unsubscribe | Create FAQ | Send Feedback
  
Copyright © 2012 Toolbox.com and message author.
Toolbox.com 4343 N. Scottsdale Road Suite 280, Scottsdale, AZ 85251
sanju-k  
 
View this online
Ask a new question
 
In the Spotlight
Toolbox.com for iPhone & Android: Ask Questions & Get Answers Anywhere. Download the Free App

_.____.__

0 comments:

Post a Comment

T r a n s l a t e to your language