a month ago - last edited 3 weeks ago
System: SAP S/4HANA Cloud, public edition and Private Edition
Extensibility: Key-User Custom Business Object (CBO)
Preparation step: A PDF is attached to the Business Partner with filename
Read the BP attachment
Encode binary to Base64.
Split into 500-character parts.
Save those parts into CBO(multiple rows/items).
Is there a released (whitelisted) API that CBO key-user logic can call to read a Business Partner attachment by filename or attachment ID?
my call fails before the HTTP request is sent (BLE circuit-breaker “fail-fast”).
Call is from CBO logic using CL_BLE_HTTP_CLIENT.
DATA: lv_comm_scenario type string,
lv_outbound_service type string,
lv_csrf type string,
lv_body type string,
lv_content_length type string.
DATA: lv_filename TYPE string VALUE 'lv_upload_id.pdf'.
lv_comm_scenario = 'YY1_CCS_SMI_INTERNAL'.
lv_outbound_service = 'YY1_OUTB_ADD_ATTACHMENT_REST'.
DATA(lo_client) = cl_ble_http_client=>create( communication_scenario = lv_comm_scenario outbound_service = lv_outbound_service ).
DATA(lo_req1) = cl_ble_http_request=>create( ). lo_req1->set_method( if_ble_http_request=>co_method-get ).
DATA(lv_filter) = |$filter=BusinessObjectTypeName eq 'BUSINESSPARTNER' and LinkedSAPObjectKey eq '9980000154'|.
lo_req1->set_resource_extension( |/AttachmentFolder?{ lv_filter }&$expand=to_Doc&$top=1| ).
TRY.
DATA(lo_res1) = lo_client->send( lo_req1->set_header_parameter( name = 'Accept' value = 'application/json' ) ).
CATCH cx_ble_http_exception INTO DATA(lx).
"-> log/raise lx->get_text( ) "config or DNS/SSL problems show up here RETURN. ENDTRY.
Thanks in advance!
Request clarification before answering.
Hello @sanjaynaiksap
Thank you for reaching out.
CBO logic calls API_CV_ATTACHMENT_SRV, reads and Base64-encodes the file in 500-character chunks, aligned with SAP capabilities. Use BUT000 + leading zeros, call via CL_BLE_HTTP_CLIENT with a comm arrangement, and convert with XCO. SAP Help Portal3648499 - How to use API_CV_ATTACHMENT_SRV to download attachments for enterprise pro...
Let me know if you need further information
With kind regards
Chuma
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 18 | |
| 7 | |
| 7 | |
| 6 | |
| 4 | |
| 4 | |
| 4 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.