我们打开一个 SAP 帮助文档的页面,看到如下链接:
https://help.sap.com/docs/SAP...
其中 q=site
表明查询关键字为 site,loio 后面是一串 guid:loio76a5e87baecd4900b2d0f16e3768354e
version=2205
表明 Commerce Cloud 的版本号。
在SAP CRM中URL对象以逻辑对象(LOIO)和物理对象(PHIO)的形式存储。
为了获得LOIO和PHIO的值,我们需要使用方法:CL_CRM_DOCUMENTS=>GET_INFO_URL。
我们需要将 INSTID_A + TYPEID_A + CATID_A 字段传递到数据库表 SKWG_BREL 作为输入。
函数 SDOK_LOIO_GET_URI 可以用来读取 url.
使用如下的代码,根据 loio guid,获得 document url:
TYPES : BEGIN OF l_typ_instid,
instid_a LIKE skwg_brel-instid_a,
END OF l_typ_instid.
** Get URL link
DATA : l_tab_loios TYPE skwf_ios,
l_tab_phios TYPE skwf_ios,
l_wa_loios TYPE skwf_io,
l_wa_phios TYPE skwf_io,
l_wa_busobject TYPE sibflporb,
l_wa_object TYPE sdokobject,
l_wa_skwg TYPE skwg_brel,
l_wa_url TYPE sdokcomurl,
l_var_url TYPE saeuri.
DATA : l_tab_skwg TYPE STANDARD TABLE OF skwg_brel,
l_tab_instid TYPE STANDARD TABLE OF l_typ_instid.
FIELD-SYMBOLS : TYPE l_typ_instid,
TYPE os_guid.
LOOP AT it_object_guid ASSIGNING .
APPEND INITIAL LINE TO l_tab_instid ASSIGNING .
-instid_a = .
ENDLOOP.
SELECT *
FROM skwg_brel
INTO TABLE l_tab_skwg
FOR ALL ENTRIES IN l_tab_instid
WHERE instid_a = l_tab_instid-instid_a
AND instid_b LIKE ‘L/CRM_L_URL%’.
SORT l_tab_skwg BY instid_a typeid_a catid_a.
DELETE ADJACENT DUPLICATES FROM l_tab_skwg
COMPARING instid_a typeid_a catid_a.
LOOP AT l_tab_skwg INTO l_wa_skwg.
CLEAR : l_wa_busobject.
REFRESH : l_tab_loios, l_tab_phios.
l_wa_busobject-instid = l_wa_skwg-instid_a.
l_wa_busobject-typeid = l_wa_skwg-typeid_a.
l_wa_busobject-catid = l_wa_skwg-catid_a .
CALL METHOD cl_crm_documents=>get_info_url
EXPORTING
business_object = l_wa_busobject
IMPORTING
loios_url = l_tab_loios
phios_url = l_tab_phios.
LOOP AT l_tab_loios INTO l_wa_loios.
CLEAR : l_wa_object, l_var_url, l_wa_url.
MOVE-CORRESPONDING l_wa_loios TO l_wa_object.
CALL FUNCTION ‘SDOK_LOIO_GET_URI’
EXPORTING
object_id = l_wa_object
IMPORTING
uri = l_var_url.
MOVE l_wa_skwg-instid_a TO l_wa_url-component.
MOVE l_var_url TO l_wa_url-url.
APPEND l_wa_url TO et_urls.
ENDLOOP.
ENDLOOP.
SAP Document 存储支持如下几种方式:
- SAP DMS
- Generic Object Services
- Direct upload as in CRM, PPM
- Business Document Services
- Archivelink