Application Development and Automation 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: 
Read only

Exceptions for BAPI_USER_GETLIST

Former Member
0 Likes
5,082

Hi All,

I have called a Bapi inside a program. In this Bapi there are no Exceptions maintained.

Thus when I check my program through Code Inspector it throws an error stating EXCEPTION specification that sets the SY-SUBRC Thus the value of SY-SUBRC is always 0.

Call to FM is as follows,

CALL FUNCTION 'BAPI_USER_GETLIST'
       EXPORTING
*       MAX_ROWS        = 0
         with_username   = lv_user  
*      IMPORTING
*        rows            =
       TABLES
*       SELECTION_RANGE =
*       SELECTION_EXP   =
         userlist        = lt_user
*       RETURN 

Please tell me how to tackle this error as i cannot add exception in the Standard Bapi.

1 ACCEPTED SOLUTION
Read only

matt
Active Contributor
0 Likes
2,451

CALL FUNCTION 'BAPI_USER_GETLIST'

       EXPORTING

*       MAX_ROWS        = 0

         with_username   = lv_user  

*      IMPORTING

*        rows            =

       TABLES

*       SELECTION_RANGE =

*       SELECTION_EXP   =

         userlist        = lt_user

*       RETURN

    EXCEPTIONS

        others = 0.

11 REPLIES 11
Read only

matt
Active Contributor
0 Likes
2,452

CALL FUNCTION 'BAPI_USER_GETLIST'

       EXPORTING

*       MAX_ROWS        = 0

         with_username   = lv_user  

*      IMPORTING

*        rows            =

       TABLES

*       SELECTION_RANGE =

*       SELECTION_EXP   =

         userlist        = lt_user

*       RETURN

    EXCEPTIONS

        others = 0.

Read only

Former Member
0 Likes
2,451

Thanks a lot Matthew.

This issue is now closed.

Read only

Former Member
0 Likes
2,451

hi,

if it is standard bapi then u can ignore such error by adding

"#EC at end of error point and proceed the code inspector will hide such errors.

Read only

former_member420878
Active Participant
0 Likes
2,451

Hi,

I do agree with above post.

Add exceptions as others = 0 / 1/ 2, as explained above.

if you are using,

Exceptions

    Others  = 1.

that means your sy-subrc will be 1 when you are catched with exception.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
2,451

BAPI should not raise this error in SCI, first use parameter RETURN where the BAPI will return the error and success message. Does SCI stil raise an error ?

Regards,

Raymond

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
2,451

Which version of ABAP are you working on?

BAPIs don't have exceptions and you do not need to handle them as well. No sure why CI is throwing this error? Can you share the screenshot of your Code Inspector?

BR,

Suhas

Read only

matt
Active Contributor
0 Likes
2,451

Code inspector depends on how its rules are configured. It sometimes gets it wrong. Unfortunately, some quality teams fail to understand this.

Read only

Former Member
0 Likes
2,451

Hi ,

If you are referring to the Extended Code Checks then you can suppress this message

by using pragma ##FM_SUBRC_OK (or pseudo comment "#EC FB_RC).

There is no harm in implementing this and this message can be ignored . This is just an information that even if you verify sy-subrc it will always be 0.

Thanks and Regards,

Sriranjani Chimakurthy.

Read only

arindam_m
Active Contributor
0 Likes
2,451

Hi,

Are you checking sy-subrc after the FM call may be thats why the message comes in extended check. indicating that its a redundant sy-subrc check as it has no exceptions.

Cheers,

Arindam 

Read only

Former Member
0 Likes
2,451

You might be checking sy-subrc after function module call.

since BAPI's don't have exceptions you no need to check sy-subrc value, instead of that check

   RETURN parameter of bapi and give messages accordingly.

call function 'BAPI_USER_GETLIST'

..

..

if lt_return[] is not initial.

     loop lt_return ....

          .......

     endloop.

endif.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
2,451

I would hope that SCI throwed an error for not using returned RETURN parameter... too sad