cancel
Showing results for 
Search instead for 
Did you mean: 

Fiori - BAPI Return Message in oData Service

tharaka_fernando
Contributor
0 Kudos

Dear All Gurus,

I have created a Gateway Service (For a Custom App) to create Purchase Order (ERP) Using BOR object "PurchaseOrder.CreateFromData1".

When I execute the program in GW Client , Im getting below output (please find attached txt document for the full output). I understand that this is ann error throwing from BAPI and I guess this is from the BAPI Return structure and feel like the complete message is not showing but only the 1st line of Return message. Due to this I am not able to identify what data is missing and where is the cause of this error ...

Plz advice how to get the full message

Message Output

........

<code>SY/530</code>

  <message xml:lang="en">No instance of object type PurchaseOrder has been created. External reference:</message>

- <innererror>

  <transactionid>CC0413E45C29F16BB68C0050569C4F03</transactionid>

  <timestamp />

- <Error_Resolution>

  <SAP_Transaction />

  <SAP_Note />

  </Error_Resolution>

- <errordetails>

- <errordetail>

  <code>BAPI/001</code>

  <message>No instance of object type PurchaseOrder has been created. External reference:</message>

  <propertyref />

  <severity>error</severity>

  </errordetail>

......................

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

Hello T Fdo,

There are more than one message your BAPI is throwing, the o data response is showing only

one message.

You can build the message object and pass that object to the exception object in the method of your DPC class.

Steps are:

1. Get the BAPI return in lt_return table of type bapiret2.

2. set the message object in the context of DPC class.

      me->mo_context->get_message_container( )->add_messages_from_bapi(

        EXPORTING

          it_bapi_messages          = lt_return    " Return parameter table

      ).

3. Raise the exception and send the message object to exception object.

      raise EXCEPTION type /IWBEP/CX_MGW_BUSI_EXCEPTION

      EXPORTING

        message_container = me->mo_context->get_message_container( )

        .

Hope it helps.

Cheers,

Anurag.

masa_139
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Tharu,

I would test the BAPI in SE37 with test mode or set an external breakpoint in the BAPI.

Regards, Masa

SAP Customer Experience Group - CEG