2008 Jul 29 4:12 AM
aRs -
In this thread here:
you kindly reminded me of the modern way to get attachments using the srgbtbrel table.
I assumed this method would work at this site because this site has DMS and is using an external content server.
But believe it or not, srgbtbrel is empty here at this site..
So I'm dropping back and using the alternative method you showed me last year:
BAPI_REL_GETRELATIONS
I'll post back tomorrow to let you know if the code below works. But I wish that SAP would somewhere make it clear in the documentation when srgbtbrel will work and when it won't - i.e. how DMS has to be installed in order for this table to wind up non-empty. (Or is it a conversion question - maybe some ATTA's can't be converted, and therefore always have to be dealt with using the gerelations BAPI ???)
CALL FUNCTION 'BAPI_REL_GETRELATIONS'
EXPORTING
OBJECTID = wa_objectid
RECURSIONLEVEL = 1
IMPORTING
RETURN = v_rtrn
TABLES
LISTOFRELATIONS = i_listrel.
v_cntr = 0.
v_nmbr = 0.
* filter out the non-ATTA's and non-pdf attachments and put pdf atts into table
LOOP AT i_listrel INTO wa_listrel.
IF wa_listrel-reltype <> 'ATTA'.
CONTINUE.
ENDIF.
v_objtype = wa_listrel-objtype_b.
v_objkey = wa_listrel-objkey_b.
swc_free_object v_obj.
swc_create_object v_obj v_objtype v_objkey.
swc_get_property v_obj 'FileExtension' v_fileext.
IF wa_listrel-reltype = 'PDF'.
swc_get_property v_obj 'Description' v_objdes.
wa_atts-name = v_objdes.
wa_atts-ext = v_fileext.
wa_atts-objkey_b = v_objkey.
APPEND wa_atts TO i_atts.
ENDIF.
ENDLOOP.
LOOP AT i_atts INTO wa_atts.
v_document_id = wa_atts-objkey_b.
CALL FUNCTION 'SO_DOCUMENT_READ_API1'
EXPORTING
DOCUMENT_ID = v_document_id
IMPORTING
DOCUMENT_DATA = wa_sofolent1
TABLES
OBJECT_HEADER = i_objhdr
OBJECT_CONTENT = i_objcont
ATTACHMENT_LIST = i_attlist
EXCEPTIONS
DOCUMENT_ID_NOT_EXIST = 1
OPERATION_NO_AUTHORIZATION = 2
X_ERROR = 3
OTHERS = 4.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_DATA = wa_sofolent1
* PUT_IN_OUTBOX = ' '
* SENDER_ADDRESS = SY-UNAME
* SENDER_ADDRESS_TYPE = 'B'
* COMMIT_WORK = ' '
* IMPORTING
* SENT_TO_ALL =
* NEW_OBJECT_ID =
* SENDER_ID =
TABLES
PACKING_LIST =
* OBJECT_HEADER =
* CONTENTS_BIN =
* CONTENTS_TXT =
* CONTENTS_HEX =
* OBJECT_PARA =
* OBJECT_PARB =
RECEIVERS =
* EXCEPTIONS
* TOO_MANY_RECEIVERS = 1
* DOCUMENT_NOT_SENT = 2
* DOCUMENT_TYPE_NOT_EXIST = 3
* OPERATION_NO_AUTHORIZATION = 4
* PARAMETER_ERROR = 5
* X_ERROR = 6
* ENQUEUE_ERROR = 7
* OTHERS = 8
.
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.
2008 Jul 29 4:41 AM
srgbtbrel table is empty.., but are there any Attachments still in the system.
If that is the case then may be some other table is storing the details..
can you give some details... on exactly what is your problem.
2008 Jul 29 3:10 PM
I think all GOS object with attachments get links from the table srgbtbrel , for DMS you need to use
method cl_binary_relation=>read_links_of_binrels
For testing purpose,
Use transaction OAOR and use your business class and type and execute. system will take to BDN. (Business document navigator) and create an attachment here and check in the srgbtbrel table whether you got the link or not.
You can also try with
in Se37 --> check for function module BDS*
and also
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/abap-SendingGOSattachmentstoanemailaddress&
a®
2008 Jul 29 3:20 PM
aRs -
Thanks.
I will try the method if the getrelations BAPI doesn't work.
But I think it will work because that's the one we used last year.
And even though there is no SOFFDB here (because they have external content server), I think the BAPI will work because there are entries in SOFFPHIO ...
Best
djh
2008 Jul 29 3:21 PM
2008 Jul 29 3:33 PM
Amit -
There seem to be three possible kinds of client sites:
1. Still using the very old SOFFDB table to store attachments
For this kind of site, aRs/Narendran/me worked out the code to get binaries from SOFFDB and get URL's assigned to them - there's a trick to assigning URL's - you have to write the binaries to the user's PC and then use "file://" URL's.. But you only have to do this when you really need URL's, like when you want to pop a picture attachment in the SAP Picture Control.
2. A fully implemented GOS site.
This is the kind of site where you should be able to use standard GOS code, like the stuff in the blog you mention or just a direct read of the srgbtbrel table as in the example provided by aRs in this thread
3. A site where DMS has been implemented but not GOS.
I think BAPI_REL_GETRELATIONS will work here also, as well as in case 1 (see code at beginning of this thread.)
But really - as I said - SAP should publish a document on the three cases:
Oldest: SOFFDB
Next-Oldest: DMS
Current: GOS
IF you search SAP Help for the DMS documentation, you'll see that the refereences have been removed, even though there are still links to it out on the web and inside SDN !!!!!
Best
djh
2008 Jul 29 3:40 PM
2008 Jul 29 3:46 PM
Amit -
In this case, I'm not sure. There's a tremendous performance hit that you take for using the old cluster table SOFFDB instead of an external content server. Plus, as I said, you have to manufacture URL's for the binaries if you ever need them.
Best regards
djh
2022 Jun 06 11:31 AM
Hi,
could you please explain v_fileext and v_objdes where this values are taken from ?
not able to find the value and reference for these fields.
Thanks