SO_OBJECT_DOWNLOAD
I have a program that copies Attachments to an external folder. When I run the program from SE80, it works fine. When I run it as a scheduled job, the files do not copy. How can I correct this?
To write the data to application server:
open dataset 'suresh1file' for output in text mode. " suresh1file is a file name in the home directory - check AL11
LOOP AT ITAB1.
TRANSFER ITAB1 TO 'suresh1file'.
delete itab1.
ENDLOOP.
close dataset 'suresh1file'.
To read the data from application server:
open dataset 'suresh1file' for input in text mode.
do.
read dataset 'suresh1file' into itab2.
append itab2.
clear itab2.
if sy-subrc <> 0.
exit.
endif.
enddo.
close dataset 'suresh1file'.
regards,
~Satya
Similar Messages
-
Alternate FM for SO_OBJECT_DOWNLOAD
Hi All,
Can any one tell me is there any altenate FM for "SO_OBJECT_DOWNLOAD" .
I am getting 0 bytes transfered message while using the above FM.
I need to download the vendor attachments from 4.7 and upload it in 6.0The zero bytes result from a suppressed internal error.
the call to "cl_gui_frontend_services=>directory_get_current" fails and kills the process. usually because the ITS Server installation is incorrect.
Declare a data variable of char 250.
Write the value of the destination folder to this variable.
Set the Parameter 'SOL' to the variable.
The failing call is no longer needed and the file is produced.
I.E.
Data ltp_file_path_xs(250) type c,
ltp_pathin type string. "holds target folder path.
ltp_file_path_xs = ltp_pathin.
set parameter id 'SOP' field ltp_file_path_xs.
Call Function 'SO_OBJECT_DOWNLOAD' -
Using FM SO_OBJECT_DOWNLOAD
Hi all,
I am having problem in using this FM. I want to download any file to my local desktop from the file attachment list of an employee in PA20/PA30. I kept on getting Access via 'NULL' object reference not possible error message.
This is how I use it. The filename is obtained through the a pop up box asking user to input a file name with a file path.
CALL FUNCTION 'SO_OBJECT_DOWNLOAD'
EXPORTING
BIN_FILESIZE = 0
DEFAULT_FILENAME = ' '
filetype = 'BIN'
path_and_file = lo_stru_output_param-file_name "C:\Users\sc\Desktop\xyz.pdf
EXTCT = ' '
no_dialog = ' '
CODEPAGE =
IMPORTING
FILELENGTH =
F_CANCELLED =
ACT_FILETYPE =
ACT_FILENAME =
TABLES
objcont = lt_object_cont
EXCEPTIONS
file_write_error = 1
invalid_type = 2
x_error = 3
kpro_error = 4
OTHERS = 5
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.Use this:
DATA lr_conv TYPE REF TO cl_abap_conv_out_ce.
DATA lv_data TYPE string.
DATA lv_xfile TYPE xstring.
lv_data = 'Example text, which will be opened in MS Word.'.
cl_abap_conv_out_ce=>create( RECEIVING conv = lr_conv ).
lr_conv->convert( EXPORTING data = lv_data
IMPORTING buffer = lv_xfile ).
cl_wd_runtime_services=>attach_file_to_response(
EXPORTING i_filename = 'wd4a.doc'
i_content = lv_xfile
i_mime_type = 'application/msword' ). -
Error using SO_OBJECT_DOWNLOAD to download attachments
I am using the SO_OBECJT_DOWNLOAD function to download the attachments to a shared folder. The program works when I run it directly. But after I scheduled it as a background job, the program failed. Here is the description of the error:
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_CODEPAGE_CONVERTER_INIT', was
not caught in
procedure "SO_OBJECT_DOWNLOAD" "(FUNCTION)", nor was it propagated by a RAISING
clause.
Since the caller of the procedure could not have anticipated that the
exception would occur, the current program is terminated.
The reason for the exception is:
Possibly, one of the codepages '4103' or '0000' - needed for the
conversion - is unknown to the system. Another option is, that a Unicode
codepage was specified for a file in LEGACY MODE, which is not allowed.
Additional parameters for the codepage conversion (as , for example, the
replacement character) might have invalid values. You can find further
information under 'Inernal notes'.The attachments are downloaded to a shared folder on a file server. I got codepage convet error when the program trying to read the file, which means the error happens before the file is downloaded.
-
Get manual attachment from a report
Hi all,
I have a problem when trying to retrieve from a report the manual attachments of an SD invoice. Though I'm using a SD invoice, I guess is the same for any object.
I usually use this way to get attachments from objects:
1º ARCHIV_GET_CONNECTIONS -> Attachment info
2º ARCHIVOBJECT_GET_DT_VIA_TABLE or ARCHIVOBJECT_GET_TABLE -> Attachment data
3º Then download, email... or do whatever you want with the files.
My problem now is, if I go inside an invoice and create an attachment manually, then it does not show up on TOA01 or on FM ARCHIV_GET_CONNECTIONS.
Do you know a way to get these manual created attachments or at least where are they stored?
Thanks in advance,
Regards John
Edited by: John Smith on May 26, 2011 1:18 PMHi Madhukar,
Thanks for the answer. That's exactly what I need.
After a while I finally managed to execute them correctly, I'll explain here:
1º Get the attachments info. In my case, as I told, are SD Invoices so class is VBRK
CALL FUNCTION 'BDS_GOS_CONNECTIONS_GET'
EXPORTING
* LOGICAL_SYSTEM =
classname = 'VBRK'
objkey = 'sd invoice number'
* CLIENT = SY-MANDT
tables
gos_connections = it_gos_connections
* EXCEPTIONS
* NO_OBJECTS_FOUND = 1
* INTERNAL_ERROR = 2
* INTERNAL_GOS_ERROR = 3
* OTHERS = 4.
2º We recover the data of any of the attachments we got before:
From table gos_connections we use the field L0I0_ID to enter this next FM:
CALL FUNCTION 'SO_DOCUMENT_READ_API1'
EXPORTING
document_id = it_gos_connections-L0I0_ID
* FILTER = 'X '
* IMPORTING
* DOCUMENT_DATA =
TABLES
* OBJECT_HEADER =
OBJECT_CONTENT = it_object_content
* OBJECT_PARA =
* OBJECT_PARB =
* ATTACHMENT_LIST =
* RECEIVER_LIST =
* CONTENTS_HEX =
* EXCEPTIONS
* DOCUMENT_ID_NOT_EXIST = 1
* OPERATION_NO_AUTHORIZATION = 2
* X_ERROR = 3
* OTHERS = 4.
3º Now we got the data, we can do whatever we want. For example if we want to download it we can go like this:
we use the it_object_content from last FM for this next one.
CALL FUNCTION 'SO_OBJECT_DOWNLOAD'
EXPORTING
* BIN_FILESIZE = 0
* DEFAULT_FILENAME = ' '
FILETYPE = 'BIN' "for PDF
PATH_AND_FILE = 'C:TEST '
* EXTCT = ' '
NO_DIALOG = 'X'
* CODEPAGE =
* IMPORTING
* FILELENGTH =
* F_CANCELLED =
* ACT_FILETYPE =
* ACT_FILENAME =
TABLES
objcont = it_object_content
* EXCEPTIONS
* FILE_WRITE_ERROR = 1
* INVALID_TYPE = 2
* X_ERROR = 3
* KPRO_ERROR = 4
* OTHERS = 5.
Regards
Edited by: John Smith on May 26, 2011 4:29 PM -
How to download the attachments from GOS toolbar.
Hi,
I am facing a problem. I have to go to transaction ME33k and click the GOS toolbar. Then click on the attachment list. After the attachment list arrives, I need to transfer the files to the local system. The issue is that I need to do all this using a custom program. The custom program will transfer the files into the local system and then mail them to specified recipients.
The custom program has been made but I am unable to download files from the SAP internal location to the local PC. Please advise.Please try the next abap code to download all applicant attachments. SAP system 6.40
in this - OBJECT_ID - applicant SAP number
data: i_connections type BDN_CON occurs 0,
i_connections_rec type BDN_CON .
data fol_id like soodk.
data doc_id like soodk.
data: OBJCONT type SOLI occurs 0 .
DATA: PATH TYPE CHAR255,
COMP_ID TYPe CHAR255 .
CALL FUNCTION 'BDS_GOS_CONNECTIONS_GET'
EXPORTING
CLASSNAME = 'APPLICANT'
OBJKEY = OBJECT_ID
CLIENT = SY-MANDT
TABLES
GOS_CONNECTIONS = i_connections
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT i_connections INTO i_connections_rec .
move i_connections_rec-LOIO_ID to FOL_ID .
move i_connections_rec-LOIO_ID+17(25) to doc_id .
CALL FUNCTION 'SO_OBJECT_READ'
EXPORTING
FOLDER_ID = FOL_ID
OBJECT_ID = doc_id
TABLES
OBJCONT = OBJCONT .
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT i_connections INTO i_connections_rec .
move i_connections_rec-LOIO_ID to FOL_ID .
move i_connections_rec-LOIO_ID+17(25) to doc_id .
CALL FUNCTION 'SO_OBJECT_READ'
EXPORTING
FOLDER_ID = FOL_ID
OBJECT_ID = doc_id
TABLES
OBJCONT = OBJCONT .
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CONCATENATE 'D:\GOS\' i_connections_rec-DESCRIPT '.' i_connections_rec-DOCUCLASS into PATH .
CONCATENATE i_connections_rec-DESCRIPT '.' i_connections_rec-DOCUCLASS into COMP_ID .
CALL FUNCTION 'SO_OBJECT_DOWNLOAD'
EXPORTING
DEFAULT_FILENAME = COMP_ID
FILETYPE = 'BIN'
PATH_AND_FILE = PATH
EXTCT = 'K'
NO_DIALOG = 'X'
TABLES
OBJCONT = objcont .
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDLOOP . -
How to transfer the attachment (DB object in the table:SOC3) to FTP Server
Hi,Experts:
I have a requirement to transfer an attachment to FTP Server,but the attachment have exist in DB for objects table(SOC3),I can down it to local PC via FM:SO_OBJECT_DOWNLOAD,but i can't transfer it to FTP Server via Dataset?
Thanks a lot in advance...........Hi Marcel,
Thanks for the reply,
I have exported the .gml file from the dev server Then i trying to import that .gml file in the production server. when i click on the import file option .it is opening the popup and disappearing immediately with out browsing the file I dont know wht is the problem around it.
But agin in the production server, i have just opend one existing model. then i clicked on the Import file option. then the popup is allowing me to browse the .gml file. but after i browsed the file, if say ok, it will be merging with the already opened model itself.
Can u please tell me , what is the problem, i am not able to browse the file ,when no model is not opened in the VC.
REgards
Vijay -
Download Purchase orders Attachment to system
I am working report on purchase order attachment means they should able download PO's attachment of to local drive,
so i am using the function module SO_OBJECT_DOWNLOAD
to download it, but it showing PO's which is having attachment but not downloading
let me knew which is the suitable Function mod for this
Reagrds
ChandruHi,
you can get all released PO's object number's (OBJNR).
Then with that object number you can check, the status changed to REL in table JCDS.
Hop this helps,
Raj -
Function SO_OBJECT_ARCHIVE_READ
Dear Reader,
I am attempting to write a program which will automatically download all files in the General folder in SAP office onto the harddrive.
I use the function SO_OBJECT_DOWNLOAD to download the files after i have read them.
The function SO_OBJECT_READ reads almost everything except...
The archived files which show up as 'arc' when you read them in the SBWP sap business workplace.
I tried to use the function SO_OBJECT_ARCHIVE_READ to get the information about them,
CALL function 'SO_OBJECT_ARCHIVE_READ'
exporting
parent_id = i_folder
object_id = i_object
importing
object_fl_display = ls_obj_fl
object_hd_display = ls_obj_hd
object_rc_display = ls_obj_rc
tables
objcont = lt_objcont
objhead = lt_objhead
objpara = lt_objpara
objparb = lt_objparb
exceptions
active_user_not_exist = 1
communication_failure = 2
object_not_exist = 3
owner_not_exist = 4
parameter_error = 5
substitute_not_active = 6
substitute_not_defined = 7
system_failure = 8
x_error = 9
others = 10.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
but unfortunatly only got the display data under the import and some entries in objpara. The head data objhead and content objcont are very important and unfortunatly missing.
Any advice or help would be appreciatedTry using function SO_NEW_DOCUMENT_SEND_API1
For the input of the "RECEIVERS" table parameter, use rec_type = 'B' andexpress = 'X'
We are using this function(in 31H) for a similar requirement and as soonas the user logs in, they receive a popup box notifying them that anExpress Document is waiting for them to review. -
Upload Gos Document Problem?
Hi friends.I wrote this code.I want to download gos attachment from computer . Where is problem? thansk for all replies.
Data : Lv_Instid_b Like Srgbtbrel-Instid_b.
Data : Lt_Folder Like Soodk Occurs 0 With Header Line ,
Lt_Object Like Soodk Occurs 0 With Header Line .
Data : Lt_Folder Like Soodk Occurs 0 With Header Line .
Data : Lt_Sood1 Like Sood1 .
Data : Gt_Objcont_tab Like Soli Occurs 0 With Header Line .
Lv_Instid_b = 'FOL30000000000004EXT34000000000091'.
Move : Lv_Instid_b+0(3) To Lt_Folder-Objtp ,
Lv_Instid_b+3(2) To Lt_Folder-Objyr ,
Lv_Instid_b+5(12) To Lt_Folder-Objno .
Move : Lv_Filetype To Lt_Sood1-File_ext ,
'ATTA' To Lt_Sood1-Objnam ,
'Eee1' To Lt_Sood1-Objdes ,
5 To Lt_Sood1-Objpri .
CALL FUNCTION 'SO_DOCUMENT_INSERT'
EXPORTING
PARENT_ID = Lt_Folder
OBJECT_HD_CHANGE = Lt_Sood1
DOCUMENT_TYPE = 'EXT'
IMPORTING
DOCUMENT_ID = Lt_Object
TABLES
OBJCONT_TEXT = Gt_Objcont_tab.Hi friends.I wrote this code.I want to download gos attachment from computer
If you want to download GOS file then you need to use fm SO_OBJECT_DOWNLOAD instead of SO_DOCUMENT_INSERT
and in sap we have standard program to do this
Please check RSSOUPDL
a® -
Attached files with Services objects in a equipment
Hi everyone
I have many attached files in functional locations and equipments, using the attachment list of "Services for objects" (files and URL's).
Also, we are moving the maintenance structure to other server and the user dont want to lose the attachments.
Do you know a program(s) or function(s) for downloading the files and upload them again?.
Do you know if exists a server directory with all files attached in functional locations or equipments?
Thanks for suggestions.
RGCALL FUNCTION 'SO_OBJECT_DOWNLOAD'
-
Send Attachment Files Of MM03 via email
Dear Experts,
I have requirement of send Attachment files of MM03 transaction Via Email.
Example.
Go to TCODE MM03.
Select Views: Basic Data1 and Basic Data 2.
Click on GOS (Generic Object Services) where you find Attachment List.
I want to send that PDF files Via Email.
Please tell me how I can read that file and send via Email as attachment.
Thank youHi
1. Readout the GOS FM: BDS_GOS_CONNECTIONS_GET > make list of Attachments...
2. Read the object: FM: SO_OBJECT_READ
3. Download it into a Temp directory: FM: SO_OBJECT_DOWNLOAD
4. Upload into itab: cl_gui_frontend_services=>gui_upload
5. Put Table with text into Email.. & send... FM: SO_NEW_DOCUMENT_ATT_SEND_API1
6. delete Temp file
that was my way....
Robert -
Download GOS apdf attachment on application serever in background
Hi all, i try to download some attachments in pdf format to application server in background.
while i do it in foreground with FM 'SO_OBJECT_DOWNLOAD' it's all ok, but i need to download files in background!!!
Can anybody help me?
Thank you.Hi,
It is not possible to download in background mode from the presentation server to application server. SAP system is completely independent during background mode and wont allow any GUI interactions.
Regards,
Vik -
Hello,
I need in a ALV list, view file that file corresponding in each line(with double click), i go to GOS toolbar and i can open or save the file that i want, but in my program i only can download the file with SO_OBJECT_DOWNLOAD function.
Anyone can help me.
Best Regards.
Eduardo PaivaHello,
With the function SO_OBJECT_DOWNLOAD i do the download of documento to SAP WORKDIR (CALL METHOD cl_gui_frontend_services=>get_sapgui_workdir) and with method CALL METHOD cl_gui_frontend_services=>execute i open the document.
Problem solved.
Best Regards.
Eduardo Paiva
Maybe you are looking for
-
Using Oracle Text with MS WORD
Hi, We have just installed Text and we want to use it for indexing hundreds of MS WORD documents that are in the same directory. But I could not find a document / example about indexing/filtering Word Documents. I will be grateful iy you can help me
-
AutoSize not working properly in TextField when using non-zero line spacing
When using non-zero line spacing, the autoSize property is not functioning as expected, causing text fields to scroll that shouldn't. Also, when using device fonts, the sizes of the TextFields are wrong in the Flash IDE. I have a TextField whose hei
-
Passing instance to other classes
Hi, I have the following class public class myApp extends SingleFrameApplicationWhen I pass the instance like as given below, the instance of SingleFrameApplication is passed. How can I pass the instance of myApp along with this, so that I can access
-
Hi, I've a podcast: https://itunes.apple.com/br/podcast/viajando-para-orlando-podcast/id382249791. I declare in the xml the local where the image that I want to use to illustrate the channel is hosted: <itunes:image href="http://www.viajandoparaorlan
-
The background job "SM:EXEC SERVICES" is ending Green in Just 0 seconds
Solution Manager 4.0 In our customer system the background job "SM:EXEC SERVICES" is ending Green in Just 0 seconds or just 1 second. Here is the log: Job log overview for job: SM:EXEC SERVICES 000000046740000 / 12193100 Date Time Messag