As a developer, we frequently come across BDC / BAPI developments. When we have BDC and BAPI, Error Handling plays a crucial rule.

Recently, I was engaged in a development of BDC. And when it comes to BDC. BDCMSGCOLL plays a crucial role when opting for ‘CALL TRANSACTION’ method.

Here, in my case, I need to simply display a meaning full messages that are returned after ‘Call Transaction’ into BDCMSGCOLL.

Instead going pillar to post, a simple combination of function modules does the entire job required. The output and sample coding as in below.

Function Modules Used :

  • CONVERT_BDCMSGCOLL_TO_BAPIRET2
  • RSCRMBW_DISPLAY_BAPIRET2

*  messages of call transaction
DATA:   messtab TYPE STANDARD TABLE OF bdcmsgcoll,
            
bapiret2 TYPE STANDARD TABLE OF bapiret2.

****************************SOME BDC Here************

   PERFORM bdc_field   USING BDC_CURSOR   DF05B-PSBET(01).
  
PERFORM bdc_field   USING RF05A-ABPOS   1.
*
  
ct_params-defsize = X.
  
ct_params-updmode = L.
  
ct_params-dismode = p_mode.


  
CALL TRANSACTION FB05 USING bdcdata
  
OPTIONS FROM ct_params
  
MESSAGES INTO messtab.

*Convert BDCMSGCOLL to BAPIRET2
CALL FUNCTION CONVERT_BDCMSGCOLL_TO_BAPIRET2
  
TABLES
  
imt_bdcmsgcoll = messtab[]
  
ext_return  = bapiret2.
*

*Display messages from BAPIRET2
  
CALL FUNCTION RSCRMBW_DISPLAY_BAPIRET2
  
TABLES
  
it_return = bapiret2.

With Combination of above two function modules, following desired out put obtained with out any custom code.

Output:

BAPIRET2 msg.png

Always giving a simple search into utility function modules from the standard SAP Repository is quite a rewarding. you will come out clean with no bug-fixing and formatting almost every time. 🙂

*with SAP_ABA 731

To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

  1. Clemens Li

    Thank you for sharing these functions. I also tried FINB_BAPIRET2_DISPLAY.

    RSCRMBW_DISPLAY_BAPIRET2:

    No information about message class and number, Type can be guessed from icon color with ivalid header text ‘T’.

    Uses obsolete TABLES parameter

    Message text displayed only if present in message table.

    No navigation at all.


    Judgement: Disappointing. Please do not use.


    FINB_BAPIRET2_DISPLAY:

    – Displays an annoying column ITEM

    Displays the (shortened) message text derived from parameters in message table

    Displays details and message text in full length on double-click

    – Forward navigation from technical details possible


    Judgement: Quite OK. Please use.


    I prefer to store my messages using SAP application log. FUNCTION ‘BAL_DSP_LOG_DISPLAY’ does the best job. Quite similar to FINB_BAPIRET2_DISPLAY, but no ITEM column in the display.


    The great advantage is if you can navigate to the message definition, then do a where-used-list to find the source code where the message was issued.

    Regards Clemens




    (0) 

Leave a Reply