GOS Toolbar

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 6

Sap Note On GOS Toolbar Storage information - 530792

Transactions:
OAC0 - Content Reporsitory
OACT - Content Categories - Define Link to content Reporsity
SOFFDB - Storage for SAPoffice (database)

GOS Toolbar Tables Relations

SOPR - Gloabla Folder setting

SOOD - Header
URL45000000000032

SOC3 - Contents
SOC3-SRTFD = SOOD-OBJTP + SOOD-OBJYR + SOOD-OBJNO

SOFM- Folder Entry


SOFM-FOLTP = SOPR-AFRYR
SOFM-FOLYR = SOPR-AFRNO
SOFM-DOCTP = SOOD-OBJTP
SOFM-DOCYR = SOOD-OBJYR
SOFM-DOCNO = SOOD-OBJNO

FM - SO_FOLDER_ROOT_ID_GET - To Get Folder path


FM - SO_OBJECT_INSERT - To store GOS contents
FM - BINARY_RELATION_CREATE - To create relation between BO and contents

-----------------------------------------------------------------------------------
--------
-----------------------------------------------------------------------------------
--------
Example-1 - To create URL

IV_NAME - WRQ0000487 "//Some Name


IV_CONTENT - vhdwas.honeywell.com/dma_int/index.html?=&refid=WRQ0000451&sap-
client=300&sap-language=EN "//URL To be updated
IS_LPORB-INSTID - WRQ0000487 or KUNNR "Object Key
IS_LPORB-TYPEID - ZSD_CUSTWF or KNA1 "Business Object/BO
IV_OBJTP - URL
-----------------------------------------------------------------------------------
--------
Example-2 - To Create Attachment in GOS

IV_NAME - WRQ0000487 "//Some Name


IV_CONTENT_HEX - BinaryData of attachment
IS_LPORB-INSTID - WRQ0000487 or KUNNR "Object Key
IS_LPORB-TYPEID - ZSD_CUSTWF or KNA1 "Business Object/BO
IV_OBJTP - URL
-----------------------------------------------------------------------------------
--------
-------------------------------
Interface---------------------------------------------------
IV_NAME TYPE STRING
IV_CONTENT TYPE STRING OPTIONAL
IV_CONTENT_HEX TYPE XSTRING OPTIONAL
IS_LPORB TYPE SIBFLPORB
IV_OBJTP TYPE SO_OBJ_TP OPTIONAL
value( RT_MESSAGES ) TYPE BAPIRETTAB
IV_OBJID TYPE SIBFBORIID
-----------------------------------------------------------------------------------
--------
DATA ls_message TYPE bapiret2.

DATA:
l_filename TYPE string,
l_filefullname TYPE string,
l_mime_type TYPE string,
l_size TYPE i,
l_offset TYPE i,
l_offset_old TYPE i,
l_temp_len TYPE i,
l_objname TYPE string,
l_obj_type TYPE so_obj_tp,
l_hex_null TYPE x LENGTH 1 VALUE '20',
l_document_title TYPE so_text255,
l_file_ext TYPE string,

tl_objcont TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 6,


wl_objcont LIKE LINE OF tl_objcont,

tl_ls_doc_change TYPE STANDARD TABLE OF sodocchgi1,


wl_doc_change LIKE LINE OF tl_ls_doc_change,

tl_data TYPE soli_tab,


wl_data TYPE soli,
tl_xdata TYPE solix_tab,
wl_xdata TYPE solix,

l_folder_id TYPE sofdk,


wl_object_id TYPE soodk,
l_object_id_fol TYPE so_obj_id,
l_object_id TYPE so_obj_id,
* l_doc_info TYPE sofolenti1,
l_object_hd_change TYPE sood1,

l_tab_size TYPE int4,


l_retype TYPE breltyp-reltype,

tl_urltab TYPE STANDARD TABLE OF sood-objdes.

*C-- get foler


CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
EXPORTING
region = 'B'
IMPORTING
folder_id = l_folder_id .
IF iv_objtp = gc_type_file.
l_size = xstrlen( iv_content_hex ).
*C-- get file name and extension
CALL METHOD split_path
EXPORTING
iv_path = iv_name
IMPORTING
ev_filename = l_filename .

CALL METHOD split_file_extension


EXPORTING
iv_filename_with_ext = l_filename
IMPORTING
ev_filename = l_objname
ev_extension = l_file_ext.

wl_doc_change-obj_name = l_objname.
wl_doc_change-obj_descr = l_objname.
wl_doc_change-obj_langu = sy-langu.
wl_doc_change-sensitivty = 'F'.
wl_doc_change-doc_size = l_size.

l_offset = 0.
WHILE l_offset <= l_size.
l_offset_old = l_offset.
l_offset = l_offset + 255.
IF l_offset > l_size.
l_temp_len = xstrlen( iv_content_hex+l_offset_old ).
CLEAR wl_xdata-line WITH l_hex_null IN BYTE MODE.
wl_xdata-line = iv_content_hex+l_offset_old(l_temp_len).
ELSE.
wl_xdata-line = iv_content_hex+l_offset_old(255).
ENDIF.
APPEND wl_xdata TO tl_xdata.
ENDWHILE.

* set object type relation type and other header info


l_retype = 'ATTA'.
l_obj_type = 'EXT'.

l_object_hd_change-objnam = wl_doc_change-obj_name.
l_object_hd_change-objdes = wl_doc_change-obj_descr.
l_object_hd_change-objsns = wl_doc_change-sensitivty.
l_object_hd_change-objla = wl_doc_change-obj_langu.
l_object_hd_change-objlen = wl_doc_change-doc_size.
l_object_hd_change-file_ext = l_file_ext.

*
* prepare header
DATA tl_obj_header TYPE STANDARD TABLE OF solisti1.
DATA wl_header TYPE solisti1.
CONCATENATE '&SO_FILENAME=' l_filename INTO wl_header.
APPEND wl_header TO tl_obj_header.
CLEAR wl_header.
wl_header = '&SO_FORMAT=BIN'.
APPEND wl_header TO tl_obj_header.

* change hex data to text data


CALL FUNCTION 'SO_SOLIXTAB_TO_SOLITAB'
EXPORTING
ip_solixtab = tl_xdata
IMPORTING
ep_solitab = tl_data.

ELSE.
* for note
l_size = strlen( iv_content ).
l_objname = iv_name.

wl_doc_change-obj_descr = l_objname.
wl_doc_change-sensitivty = 'O'.
wl_doc_change-obj_langu = sy-langu.

* put content into table


l_offset = 0.

IF iv_objtp = gc_type_note.
* it's a note
l_retype = 'NOTE'.
l_obj_type = 'RAW'.
l_object_hd_change-file_ext = 'TXT'.

* read note content into table


WHILE l_offset <= l_size.
l_offset_old = l_offset.
l_offset = l_offset + 255.
IF l_offset > l_size.
l_temp_len = strlen( iv_content+l_offset_old ).
CLEAR wl_data-line.
wl_data-line = iv_content+l_offset_old(l_temp_len).
ELSE.
wl_data-line = iv_content+l_offset_old(255).
ENDIF.
APPEND wl_data TO tl_data.
ENDWHILE.

* get title from content , if it's initial


IF l_objname IS INITIAL.
READ TABLE tl_data INDEX 1 INTO l_document_title.
WHILE l_document_title+49 <> ' '.
SHIFT l_document_title RIGHT.
ENDWHILE.
SHIFT l_document_title LEFT DELETING LEADING ' '.
wl_doc_change-obj_descr = l_document_title.
ENDIF.

ELSE.
* it's url (not note)
l_retype = 'URL'.
l_obj_type = 'URL'.
IF l_objname IS INITIAL.
SPLIT iv_content AT '/' INTO TABLE tl_urltab.
DESCRIBE TABLE tl_urltab LINES l_tab_size.
READ TABLE tl_urltab INDEX l_tab_size INTO wl_doc_change-obj_descr.
ENDIF.

WHILE l_offset <= l_size.


l_offset_old = l_offset.
l_offset = l_offset + 250.
IF l_offset > l_size.
l_temp_len = strlen( iv_content+l_offset_old ).
CLEAR wl_data-line.
wl_data-line = iv_content+l_offset_old(l_temp_len).
ELSE.
wl_data-line = iv_content+l_offset_old(250).
ENDIF.
CONCATENATE '&KEY&' wl_data-line INTO wl_data-line.
APPEND wl_data TO tl_data.
ENDWHILE.
ENDIF.

wl_doc_change-doc_size = l_size.
l_object_hd_change-objdes = wl_doc_change-obj_descr.
l_object_hd_change-objsns = wl_doc_change-sensitivty.
l_object_hd_change-objla = wl_doc_change-obj_langu.
l_object_hd_change-objlen = wl_doc_change-doc_size.
ENDIF.

* save object
CALL FUNCTION 'SO_OBJECT_INSERT'
EXPORTING
folder_id = l_folder_id
* OBJECT_FL_CHANGE = OBJECT_FL_CHANGE
object_hd_change = l_object_hd_change
object_type = l_obj_type
* ORIGINATOR_ID = OWNER_ID
* OWNER = USER-USRNAM
IMPORTING
* OBJECT_FL_DISPLAY = OBJECT_FL_DISPLAY
* OBJECT_HD_DISPLAY = OBJECT_HD_DISPLAY
object_id = wl_object_id
TABLES
objcont = tl_data
objhead = tl_obj_header
* OBJPARA = OBJECT_PARA
* OBJPARB = OBJECT_PARB
EXCEPTIONS
component_not_available = 01
folder_not_exist = 06
folder_no_authorization = 05
object_type_not_exist = 17
operation_no_authorization = 21
parameter_error = 23
OTHERS = 1000.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 INTO ls_message-message.
ls_message-type = sy-msgty.
ls_message-id = sy-msgid.
ls_message-number = sy-msgno.
ls_message-message_v1 = sy-msgv1.
ls_message-message_v2 = sy-msgv2.
ls_message-message_v3 = sy-msgv3.
ls_message-message_v4 = sy-msgv4.
APPEND ls_message TO rt_messages.
RETURN.
ENDIF.

* create relation
DATA l_obj_rolea TYPE borident.
DATA l_obj_roleb TYPE borident.
l_obj_rolea-objkey = is_lporb-instid.
l_obj_rolea-objtype = is_lporb-typeid.
l_obj_rolea-logsys = is_lporb-catid.
l_object_id_fol = l_folder_id.
l_object_id = wl_object_id.
CONCATENATE l_object_id_fol l_object_id INTO l_obj_roleb-objkey RESPECTING
BLANKS.
l_obj_roleb-objtype = 'MESSAGE'.
CLEAR l_obj_roleb-logsys.

CALL FUNCTION 'BINARY_RELATION_CREATE'


EXPORTING
obj_rolea = l_obj_rolea
obj_roleb = l_obj_roleb
relationtype = l_retype
EXCEPTIONS
OTHERS = 1.
IF sy-subrc = 0.
COMMIT WORK AND WAIT.
* Object ID
iv_objid = l_obj_roleb-objkey.
ELSE.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 INTO ls_message-message.
ls_message-type = sy-msgty.
ls_message-id = sy-msgid.
ls_message-number = sy-msgno.
ls_message-message_v1 = sy-msgv1.
ls_message-message_v2 = sy-msgv2.
ls_message-message_v3 = sy-msgv3.
ls_message-message_v4 = sy-msgv4.
APPEND ls_message TO rt_messages.
RETURN.
ENDIF.

You might also like