on 04-06-2018 10:24 AM
Hi Experts
We have a requirement to perform a POST operation on OData in a ABAP Report,we have our request payload in a string variable and we are trying to call the Create_entity method in our Zreport.
Presently, we are calling the OData URL (http client call) for the post operation, but if the number of HTTP calls are more, it causes a dump.
Please suggest a solution to achieve the same using standard methods.
Hi Pallabi,
you can try the transaction SECATT_ODATA.
Running the wizard would generate classes for each entity set of your OData service.
Instead of creating tests you can have a look at the generated coding.
When using the service /sap/opu/odata/IWBEP/GWSAMPLE_BASIC you would get for example a class ZCL_GWSAMPLE_BASI_SC_BUSINESSP with a method INSERT_BUSINESSPARTNER.
Regards,
Andre
method INSERT_BUSINESSPARTNER.
*--------------------------------------------------------------------*
DATA lp_ecatt_odata_client TYPE REF TO cl_ecatt_apl_odata_client.
DATA l_url_ressource_path TYPE string.
DATA l_edm_abap_mapping TYPE string.
DATA l_query_str TYPE string.
*--------------------------------------------------------------------*
* Prepare ressource path for URL
IF ip_url_ressource_path IS NOT INITIAL.
"from caller, maybe with navigation steps
l_url_ressource_path = ip_url_ressource_path->get_ressource_path( ).
ENDIF.
IF l_url_ressource_path IS INITIAL.
"or canonic ressource identifier of EntitySet
l_url_ressource_path = `BusinessPartnerSet`.
ENDIF.
* Create eCATT OData client
lp_ecatt_odata_client = me->get_ecatt_odata_client( ).
IF lp_ecatt_odata_client IS BOUND.
"get EDM Metadata Model
l_edm_abap_mapping = me->get_edm_abap_field_mapping( ).
lp_ecatt_odata_client->get_service_metadata(
EXPORTING i_edm_abap_mapping_stream = l_edm_abap_mapping ).
* Call the service
"insert entity
CALL METHOD lp_ecatt_odata_client->insert_entity(
EXPORTING
i_entity_set_name = `BusinessPartnerSet` "#EC NOTEXT
i_entity_container = co_service_container "#EC NOTEXT GWSAMPLE_BASIC_Entities
i_url_ressource_path = l_url_ressource_path "#EC NOTEXT
"i_url_query_options = l_query_str
ip_request_options = ip_request_options
i_property_selection_mode = i_property_selection_mode
it_selected_properties = it_property_selection
CHANGING
cs_entity_data = cs_businesspartner
).
ENDIF.
endmethod.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.