Skip to Content
author's profile photo Former Member
Former Member

Exceptions for BAPI_USER_GETLIST

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

9 Answers

  • Best Answer
    Posted on May 22, 2013 at 09:45 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 22, 2013 at 09:59 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 22, 2013 at 10:00 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 22, 2013 at 10:05 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 22, 2013 at 10:09 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 22, 2013 at 10:11 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 22, 2013 at 10:13 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 22, 2013 at 12:34 PM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 29, 2013 at 02:06 PM

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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.