on 03-24-2015 6:12 AM
Hi Team,
I want to return messages which are coming from ECC to Front end with error type and description.
1.I'm using class - /iwbep/if_message_container to return message, even then it is not showing any response to front end for type 'S' Success message.
2. For Query operation (GetEntitySet method) - Return messages are not showing any response in Rest Client for return type 'E' , but return messages are coming from ECC.
Please suggest any better way to send response to front end.
Regards,
Sathish.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Team,
Thanks for your help.
Now I am able to populated Error messages through Rest Client and Success messages are appearing in response Header. But for Error messages,
1.If Return Message from ECC contains 2 Error message, then only 1st message is appearing in Rest Client.
2. Single Error message is repeated thrice in Rest Client.
Please help me out in resolving this....
Regards,
Sathish
Hello Sathish,
Can you please share the code which you are using for error handling ?
Sample code is shown Below which you can make use of :
lo_message_container TYPE REF TO /iwbep/if_message_container.
lo_message_container = mo_context->get_message_container( ).
IF lt_error_out[] IS INITIAL.
lv_msg_text = 'Sales Order not found.'.
CALL METHOD lo_message_container->add_message_text_only
EXPORTING
iv_msg_type = 'E'
iv_msg_text = lv_msg_text.
RAISE EXCEPTION TYPE /iwbep/cx_mgw_busi_exception
EXPORTING
message_container = lo_message_container.
ENDIF.
Regards,
Ashwin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI,
I can write code for Raise exception only when I'm Redefining my DPC_EXT class.Here in my scenario I just do my mapping in Query operation to get Sales Order List and not doing any coding changes in my DPC_EXT class.How can I get Error messages in Response without adding any code in DPC_EXT class.
If you do not want to do any coding and you would like error handling to be done by GW Service Builder itself,
in that case your FM need to have a return structure/table which is of type BAPIRET2.
If you have this then GW builder will automatically implement a piece of code to handle errors.
Example ->
Consider BAPI 'BAPI_USER_GET_DETAIL' ,
Where Return is the table and structure is bapiret2.
When you use this, the below code automatically generated.
if return is not initial.
me->/iwbep/if_sb_dpc_comm_services~rfc_save_log(
exporting
iv_entity_type = iv_entity_name
it_return = return
it_key_tab = it_key_tab ).
endif.
Hi Ashwin,
In FM we have Return table with type BAPIRET2.The below code is also automatically generated. But I'm not getting the response in RestClient.
if return is not initial.
me->/iwbep/if_sb_dpc_comm_services~rfc_save_log(
exporting
iv_entity_type = iv_entity_name
it_return = return
it_key_tab = it_key_tab ).
endif.
I have checked through debugging also,the below method is getting called but there is no response in Rest Client.In Response Header I'm getting as
Regards,
Sathish
Hi Ashwin,
In DPC_EXT class I have redefined GetEntitySet method, in that for 1 entity I have add some code changes and in else part I have called super class. Code looks in DPC_EXT as below,
IF iv_entity_name EQ 'Material'.
*-----------------
--------------
------
* Send specific entity data to the caller interface
copy_data_to_ref(
EXPORTING
is_data = -------
CHANGING
cr_data = er_entityset
).
ELSE.
TRY.
CALL METHOD super->/iwbep/if_mgw_appl_srv_runtime~get_entityset
EXPORTING
iv_entity_name = iv_entity_name
iv_entity_set_name = iv_entity_set_name
iv_source_name = iv_source_name
it_filter_select_options = it_filter_select_options
it_order = it_order
is_paging = is_paging
it_navigation_path = it_navigation_path
it_key_tab = it_key_tab
iv_filter_string = iv_filter_string
iv_search_string = iv_search_string
io_tech_request_context = io_tech_request_context
IMPORTING
er_entityset = er_entityset
es_response_context = es_response_context.
CATCH /iwbep/cx_mgw_busi_exception .
CATCH /iwbep/cx_mgw_tech_exception .
ENDTRY.
ENDIF.
If any Return messages with Error for Entity 'Material' gets populated in Response. For any error message in other entity's which comes under Else part,is not populated in Response.
Please let me know if any changes need to be done in coding.
Regards,
Sathish.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.