cancel
Showing results for 
Search instead for 
Did you mean: 

Creating address of any existing bp using API in SAP Hana Public cloud& cl_http_destination_provider

rajib3301
Explorer
0 Kudos
118

Hi All,

I have developed an app using RAP. When I try to create Address using 'A_BusinessPartnerAddress' of Business Partner ( A2X ) of an existing BP that does not have an address, it is giving me the following message:

Error Message "Internal error when calling operation module BUA_CHECK_ADDRESS_VALIDITY_ALL; a check table is missing" 

code: R11/243

I have gone through the KBA 3109298 and it is the same problem. follow the url for more details.

url:  https://me.sap.com/notes/3109298/E

But here they only explain it for POST request payload.

I am using class cl_http_destination_provider=>create_by_comm_arrangement for creating the destination and Service Consumption Model to create the address there is no way to add any association to use Address Usage  that I can find.

 

My Code : 

METHOD if_oo_adt_classrun~main.
DATA:
ls_business_data TYPE zpatient_reg_scom=>tys_a_business_partner_addre_2,
lo_http_client TYPE REF TO if_web_http_client,
lo_client_proxy TYPE REF TO /iwbep/if_cp_client_proxy,
lo_request TYPE REF TO /iwbep/if_cp_request_create,
lo_response TYPE REF TO /iwbep/if_cp_response_create.

TRY.
DATA(v_guid) = cl_system_uuid=>if_system_uuid_static~create_uuid_c32( ).
CATCH cx_uuid_error INTO DATA(r_uuid_exc).
ENDTRY.
TRY.
" Create http client
TRY.
DATA(lo_destination) = cl_http_destination_provider=>create_by_comm_arrangement(
comm_scenario = 'ZTEST' ).
CATCH cx_http_dest_provider_error.
"handle exception
ENDTRY.

lo_http_client = cl_web_http_client_manager=>create_by_http_destination( lo_destination ).
lo_client_proxy = /iwbep/cl_cp_factory_remote=>create_v2_remote_proxy(
EXPORTING
is_proxy_model_key = VALUE #( repository_id = 'DEFAULT'
proxy_model_id = 'ZPATIENT_REG_SCOM'
proxy_model_version = '0001' )
io_http_client = lo_http_client
iv_relative_service_root = '' ).

ASSERT lo_http_client IS BOUND.

* Prepare business data
ls_business_data = VALUE #(
business_partner = '14013'
validity_start_date = 20240916123000
validity_end_date = 99990101123000
address_uuid = v_guid
city_name = 'Berhampore'
country = 'IN'
language = 'EN'
pobox = '733121'
pobox_postal_code = '733121'
postal_code = '733121'
region = 'WB'
street_name = 'TEST'
).

" Navigate to the resource and create a request for the create operation
lo_request = lo_client_proxy->create_resource_for_entity_set( 'A_BUSINESS_PARTNER_ADDRESS' )->create_request_for_create( ).
" Set the business data for the created entity
lo_request->set_business_data( ls_business_data ).
" Execute the request
lo_response = lo_request->execute( ).
" Get the after image
*lo_response->get_business_data( IMPORTING es_business_data = ls_business_data ).
CATCH /iwbep/cx_cp_remote INTO DATA(lx_remote).  I am getting error here... Please note if I try to create the BP address manually then If i create it from code its working fine. Default address Usage issue I know but My question is how to solve the issue using KBA 3109298 for my scenario
" Handle remote Exception
" It contains details about the problems of your http(s) connection


CATCH /iwbep/cx_gateway INTO DATA(lx_gateway).
" Handle Exception

CATCH cx_web_http_client_error INTO DATA(lx_web_http_client_error).
" Handle Exception
RAISE SHORTDUMP lx_web_http_client_error.

ENDTRY.
ENDMETHOD.

 

mchrista
Participant

As I can see from your code, you are posting a flat entry on BusinessPartnerAddress. The SAP note however suggests to do a deep create in order to mark the first address as default. Creation of this deep create is a bit tricky within ABAP Cloud but I add you the link to the documentation. With this, you should be able to post it as a deep create.

https://help.sap.com/docs/sap-btp-abap-environment/abap-environment/odata-request-deep-create

Further, in S4 (private-cloud and on-prem) you can trace incoming OData-Calls via transaction /iwfnd/traces. Check here, if the deep-create is received. In addition, you can use transaction /iwfnd/gw_client to verify the successful OData execution. Only if it work also in the gateway client, it is successful. 

 

Accepted Solutions (0)

Answers (1)

Answers (1)

Daphne_Mengwein
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello @rajib3301 , looks like your question was answered. Please accept or re-open incase you have any further questions. Thanks!