cancel
Showing results for 
Search instead for 
Did you mean: 

Error Handling through SAP Gateway

pranay_aitha2
Participant
0 Kudos

Hi,

We have few Update and Create Services being called, once these services are called and the record is updated or created, is there a way to get the success of error messages posted to the front end?

Thank you in Advance.

Accepted Solutions (1)

Accepted Solutions (1)

arunchembra1
Participant
0 Kudos

Hi,

Yes, its possible for that you have to add little code in ABAP level to show successful message in device. You have to do the following steps.

1. Capture the message in RFC RETURN table.

2.

if lt_return is not initial.

   read table lt_return into ls_return index  1 .

   message = ls_return-message.

  raise exception type /iwbep/cx_mgw_busi_exception

      exporting

       textid = /iwbep/cx_mgw_busi_exception=>business_error

       message = message.

endif.

Thnaks,

Arun

pranay_aitha2
Participant
0 Kudos

Thanks Arun.

It worked for us.

0 Kudos

Hi Arun,

I did raise the exception in my RFC FM. But the Gateway service ran into errors without even creating the record in backend.

Let me explain my scenario in detail.

I have a Gateway System connected to SolMan. The OData services are consumed by sharepoint. Its a complete Z Solution in SolMan so an RFC is consumed by the service. The Create service is called from sharepoint application and the record got created successfully in SolMan. However,GW system is unable to catch the return message and throws an exception /iwfnd/cx_mgw_tech_exception. I debugged the entire scenario and I could see that the message is being passed from SolMan but somehow, GW is unable to catch it.

Am I doing something wrong here ? Please let me know your inputs as I'm new to Gateway

Regards,

Naresh

Former Member
0 Kudos

Please apply add-on Patch for the exceptions; We have similar Requirement and initially got similar  error message.

Former Member
0 Kudos

Hi Arun,

Is it possible to fetch the return messages from BAPIRET2 table in Odata service.

In my scenario the BAPI is returning success messages like ''Contact Created or Lead Created'', i have to fetch those messages in Odata service.

Could you please tell me what should be done for that and where I need to add the code for fetching the success message.

With Regards

Neha Pandey

Former Member

Why only index 1?

IF lt_return IS NOT INITIAL.

     mo_context->get_message_container( )->add_messages_from_bapi(

          it_bapi_messages = lt_return

          iv_determine_leading_msg = /iwbep/if_message_container=>

               gcs_leading_msg_search_option-first ).

     RAISE EXCEPTION TYPE /iwbep/cx_mgw_busi_exception

          EXPORTING

               textid = /iwbep/cx_mgw_busi_exception=>business_error

               message_container = mo_context->get_message_container( ).

ENDIF.

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

if i just raise the below exception code in my method in sap gateway is it going to take care of message handling or i have do anything explicitly in the font end too? If so how to do it


raise exception type /iwbep/cx_mgw_busi_exception

      exporting

       textid = /iwbep/cx_mgw_busi_exception=>business_error

       message = message.

Former Member
0 Kudos

Passing error messages back by the exception channel is normal but I do not advocate the use of success messages, they are meaningless when you have the HTTP status codes. Why do people have to start clagging up a nice simple system? Keep simple things simple guys.

jibin_joy
Contributor
0 Kudos

Hi ,

 

" is there a way to get the success of error messages posted to the front end" means ?

Regards,

Jibin Joy

pranay_aitha2
Participant
0 Kudos

Hi Joy,

I meant, Can we post a success or error message from R/3 system to the Frontend(.Net or system which uses these gateway Services)

Thank you!!