Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Suppress Messages in BAPI

Former Member
0 Kudos

Hi All,

We have a requirement where we need to fetch the quotation details and pass it to Java via RFC. we are using BAPISDORDER_GETDETAILEDLIST to fetch details. However, when the sold to party is marked for deletion, while executing the BAPI throws a information message that "Business partner XXXX is marked for deletion". This is resulting in a dump when called from Java via RFC because there is no screen to display such messages.

can some one please tell how to handle such scenarios where the Standard code throws messages, and we are calling that standard code in RFC?

Thanks,

Santhosh.

1 ACCEPTED SOLUTION

venkateswaran_k
Active Contributor
0 Kudos

Dear Santosh,

In this case you need to write a wrapper RFC function  ZBAPISDORDER_GETDETAILEDLIST, 

in which you call this BAPI - BAPISDORDER_GETDETAILEDLIST again.

Before returning the return values, check the messages, and make your return value appropriate to your java requirement

Regards,

Venkat

12 REPLIES 12

Former Member
0 Kudos

You could make your own bapi as a wrapper to this BAPI and catch the message.

Neal

0 Kudos

Thank you Neal for the quick reply. But in the standard code its written as "MESSAGE I191 WITH GT_PARTNERS_MARKED_FOR_DEL-BPARNR. " in the function module "VIEW_KURGV". there is no exception associated with that information message, and more over its in the standard function module. Please suggest how can we handle this with a wrapper because BAPISDORDER_GETDETAILEDLIST doesn't have any Exceptions associated with it.

Thank you ,

Santhosh.

venkateswaran_k
Active Contributor
0 Kudos

Dear Santosh,

In this case you need to write a wrapper RFC function  ZBAPISDORDER_GETDETAILEDLIST, 

in which you call this BAPI - BAPISDORDER_GETDETAILEDLIST again.

Before returning the return values, check the messages, and make your return value appropriate to your java requirement

Regards,

Venkat

0 Kudos

Thanks Venkat for the response.

yes i have a wrapper in place which internally calls the BAPISDORDER_GETDETAILEDLIST . But when i execute the wrapper function module, even then the processing halts with a pop up information message. Once the user click 'Enter' or the 'Tick Mark' on the information message it continues with the processing and returns the values.

Now, we we need to avoid that information message since thats causing a dump when called from JAVA from wrapper RFC.

0 Kudos

Hi Santhosh,

Inside the wrapper function, when you are calling the BAPI,

Try to use the exception ERROR_MESSAGE as follows.

CALL FUNCTION 'BAPISDORDER_GETDETAILEDLIST'

     EXPORTING

          I_BAPI_VIEW     = BAPI_VIEW

     TABLES

          SALES_DOCUMENTS = SALES_DOCUMENTS

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

     EXCEPTIONS

          ERROR_MESSAGE   = 1.

0 Kudos

Thanks venkat . It woks.   It doesnt dump now. But the information message is lost.is there any exception we can catch? as in using TRY .. CATCH block? if so, can you please tell the exception to catch ? i tried with CX_ROOT and nothing is being captured.

* Call the BAPI.

TRY.

   CALL FUNCTION 'BAPISDORDER_GETDETAILEDLIST'

     EXPORTING

       i_bapi_view           = ls_bapi_view

       i_memory_read         = 'A'

     TABLES

       sales_documents       = gt_sales_document

       order_headers_out     = gt_order_headers

       order_items_out       = gt_order_items

       order_business_out    = gt_business_out

       order_partners_out    = gt_partners_out

       order_address_out     = gt_address_out

       order_conditions_out  = gt_order_conditions

       order_textheaders_out = gt_header_texts

       order_textlines_out   = gt_item_texts

     EXCEPTIONS

       error_message         = 1.

CATCH cx_root INTO o_ref.

   BREAK-POINT.

ENDTRY.

Thanks,
Santhosh.

0 Kudos

Hmm..

Check the value of sy-subrc after the function call.. 

At this break point, check is there any global variable name like return.. 

Regards,

Venkat

0 Kudos

I would suggest you to add a RETURN parameter to your ZBAPI, and if ERROR_MESSAGE is raised map the received message to the BAPIRET2 structure (use a FM like BALW_BAPIRETURN_GET2) and add it to table RETURN.

Regards,

Raymond

0 Kudos

Santhosh,

You can also try in this way...

if sy-subrc ne 0.

call function 'MESSAGE_TEXT_BUILD'

     exporting

        msgid               = sy-msgid          "Messg class

        msgnr               = sy-msgno          "Messg No.

        msgv1               =

        msgv2               =

        msgv3               =

        msgv4               =

      importing

        message_text_output = sapmessage.

endif.

0 Kudos

Check this Note 1054781 - Information messages during BAPI processing

DATA : S_RETURN             TYPE BAPIRET2 ,

            PAR1                     LIKE BAPISDPART-KUNNR.

  CALL FUNCTION 'BALW_BAPIRETURN_GET2'

      EXPORTING

        TYPE   =   'I'                          "    S Success, E Error, W Warning, I Info, A Abort    Message Type 

        CL     =  SY-MSGID               "  like 'VP'      Message Class

        NUMBER =   SY-MSGNO      " '191'  Message Number

        PAR1   = PAR1                     " Variable#1 like  Business partner

      IMPORTING

        RETURN = S_RETURN.

SAP Community Network Wiki - Sample Custom FM Using "BALW_BAPIRETURN_GET2" ...

Regard's

Smruti

0 Kudos

Venkat,

the Sy-subrc will be 0. And also the Msgid doesnt correspond to the one in the pop up. I presume its because there are many other messages after that which will affect SY-MSGID .

Thanks,
Santhosh.

0 Kudos

Hi,

Is there a way by which we can suppress pop ups which have been included in a custom user exit. These are pop ups are generated using "COPO_POPUP_TO_DISPLAY_TEXTLIST" and wait for user action ? These problems are creating a problem when the standard BAPI_CUSTOMERQUOTATION_CHANGE is being called for changing the quotation.

Please help.

Thank you,

Santhosh.