2016 Jan 22 10:41 AM
We have one requirement wherein we need to attach document links (URLs) from external server as GoS Link attachment in SAP.
We are trying to develop this functionality for Profit Center (KE53).
in KE53, the GoS button is not present originally, we have added it using enhancements.
Refer the foll code for how we added the GoS button to profit center
ENHANCEMENT 1 ZGOS_PROFIT_CENTER.
DATA: LR_GOS_MANAGER TYPE REF TO CL_GOS_MANAGER,
LS_BORIDENT TYPE BORIDENT.
LS_BORIDENT-OBJTYPE = 'BUS0015'.
LS_BORIDENT-OBJKEY = '12345678902011'.
CREATE OBJECT LR_GOS_MANAGER
EXPORTING
IS_OBJECT = LS_BORIDENT
IP_NO_COMMIT = ' '
EXCEPTIONS
OBJECT_INVALID = 1.
ENDENHANCEMENT.
While doing this enhancement we have used OBJTYPE as BUS0015 which is the business object for profit center and OBJKEY as 12345678902011 which is simply a random string. But GoS button has appeared in KE53 transaction and it is working fine.
But when I try to update GoS using my custom program, using same value for OBJTYPE i.e., BUS0015, and for OBJKEY I have tried various combinations but none of them work.
Can anyone help me with this OBJKEY part.
We have one requirement wherein we need to attach document links (URLs) from external server as GoS Link attachment in SAP.
We are trying to develop this functionality for Profit Center (KE53).
in KE53, the GoS button is not present originally, we have added it using enhancements.
Refer the foll code for how we added the GoS button to profit center
ENHANCEMENT 1 ZGOS_PROFIT_CENTER.
DATA: LR_GOS_MANAGER TYPE REF TO CL_GOS_MANAGER,
LS_BORIDENT TYPE BORIDENT.
LS_BORIDENT-OBJTYPE = 'BUS0015'.
LS_BORIDENT-OBJKEY = '12345678902011'.
CREATE OBJECT LR_GOS_MANAGER
EXPORTING
IS_OBJECT = LS_BORIDENT
IP_NO_COMMIT = ' '
EXCEPTIONS
OBJECT_INVALID = 1.
ENDENHANCEMENT.
While doing this enhancement we have used OBJTYPE as BUS0015 which is the business object for profit center and OBJKEY as 12345678902011 which is simply a random string. But GoS button has appeared in KE53 transaction and it is working fine.
But when I try to update GoS using my custom program, using same value for OBJTYPE i.e., BUS0015, and for OBJKEY I have tried various combinations but none of them work.
Can anyone help me with this OBJKEY part.
2016 Jan 22 10:46 AM
Hi,
could you check this document ? http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/0e6b0d95-0a01-0010-4696-ca0a48de5...
regards
Fred
2016 Jan 22 10:51 AM
2016 Jan 22 11:07 AM
FORM attach_url_gos USING p_docno
p_url
p_title
p_version
p_type.
DATA lt_objhead TYPE STANDARD TABLE OF soli.
DATA lt_objcont TYPE STANDARD TABLE OF soli.
DATA ls_objcont TYPE soli.
DATA lt_urltab TYPE STANDARD TABLE OF sood-objdes.
DATA l_tab_size TYPE i.
DATA l_url_id TYPE so_url.
DATA l_obj_id TYPE soodk.
DATA l_obj_data TYPE sood1.
DATA: folder_id TYPE sofdk.
DATA document_title TYPE sood-objdes.
DATA document_id TYPE sofmk.
DATA: is_object TYPE borident.
DATA rel_doc TYPE borident.
DATA: lv_doc_type(2) TYPE c.
* DATA: lv_message(50) TYPE c.
CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
EXPORTING
region = 'B'
IMPORTING
folder_id = folder_id
EXCEPTIONS
OTHERS = 1.
l_url_id = p_url." FILE URL
* document_title = p_title+0(47) p_version+0(3).
CONCATENATE p_title+0(46) '-' p_version INTO document_title.
CONDENSE document_title.
WHILE NOT l_url_id IS INITIAL.
CONCATENATE '&KEY&' l_url_id(250) INTO ls_objcont.
APPEND ls_objcont TO lt_objcont.
SHIFT l_url_id LEFT BY 250 PLACES.
ENDWHILE.
l_obj_data-objsns = 'O'.
l_obj_data-objla = sy-langu.
IF document_title IS INITIAL.
SPLIT p_url AT '/' INTO TABLE lt_urltab.
DESCRIBE TABLE lt_urltab LINES l_tab_size.
READ TABLE lt_urltab INDEX l_tab_size INTO document_title.
ENDIF.
l_obj_data-objdes = document_title.
CALL FUNCTION 'SO_OBJECT_INSERT'
EXPORTING
folder_id = folder_id
object_type = 'URL'
object_hd_change = l_obj_data
IMPORTING
object_id = l_obj_id
TABLES
objhead = lt_objhead
objcont = lt_objcont
EXCEPTIONS
active_user_not_exist = 35
folder_not_exist = 6
object_type_not_exist = 17
owner_not_exist = 22
parameter_error = 23
OTHERS = 1000.
WAIT UP TO 3 SECONDS.
IF sy-subrc = 0.
document_id-foltp = folder_id-foltp.
document_id-folyr = folder_id-folyr.
document_id-folno = folder_id-folno.
document_id-doctp = l_obj_id-objtp.
document_id-docyr = l_obj_id-objyr.
document_id-docno = l_obj_id-objno.
ELSE.
ENDIF.
*"""""""""""""""""""""""""""""""""""""""""""""
*Object inserted and document data fetched:
* now create a binary relation to link PO with this URL
is_object-objkey = p_docno. "Controlling area + Profit Center
is_object-objtype = p_type. "'BUS0015'.
IF NOT is_object-objkey IS INITIAL.
IF NOT document_id IS INITIAL.
CLEAR rel_doc.
rel_doc-objkey = document_id.
rel_doc-objtype = 'MESSAGE'.
CALL FUNCTION 'BINARY_RELATION_CREATE'
EXPORTING
obj_rolea = is_object
obj_roleb = rel_doc
relationtype = 'URL'
EXCEPTIONS
OTHERS = 1.
ENDIF.
ELSE.
ENDIF.
ENDFORM. " ATTACH_URL_GOS
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |