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 :
* 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‘
imt_bdcmsgcoll = messtab
ext_return = bapiret2.
*Display messages from BAPIRET2
CALL FUNCTION ‘RSCRMBW_DISPLAY_BAPIRET2‘
it_return = bapiret2.
With Combination of above two function modules, following desired out put obtained with out any custom code.
➕ 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