BAPI to retrieve "Check Values" (like SU53 result)

Sometimes BAPI/RFC calls fail due to missing authorization and it is not easy to research the reason.

Sometimes BAPI/RFC calls fail due to missing authorization and it is not easy to find the reason. While it is possible with SAPGUI to retrieve this information via transaction SU53 to display check values, this might not be possible from another front-end (i.e. Web) since this information is only stored temporarily (it is lost as soon as the user logs off). The following BAPI can be called immediately after the failing BAPI/RFC -i.e....

in an error routine. It returns the check values in an ASCII table.


FUNCTION Z_BAPI_GET_AUTH_VIOLATION_INFO.
*"----------------------------------------------------------------------
*"*"Local interface:
*"       TABLES
*"              ASCII_LIST STRUCTURE  W3HTML
*"----------------------------------------------------------------------
* This BAPI returns information about authority violation, similar to
* transaction code SU53.
* Since that information gets stored temporarily in SAP, the BAPI has to
* be called in an active session.
* I.e. if a an authority violation occurs and the user logs off, no
* information will be available after re-logon.
************************************************************************

  DATA: ASCII_TEMP  LIKE LISTZEILE OCCURS 1 WITH HEADER LINE,
        OUTPUT_LIST LIKE ABAPLIST  OCCURS 1 WITH HEADER LINE.
  SUBMIT SAPMS01G EXPORTING LIST TO MEMORY AND RETURN.

  CALL FUNCTION 'LIST_FROM_MEMORY'
       TABLES
            LISTOBJECT = OUTPUT_LIST
       EXCEPTIONS
            NOT_FOUND  = 1
            OTHERS     = 2.

  CALL FUNCTION 'LIST_TO_ASCI'
       TABLES
            LISTASCI           = ASCII_TEMP
            LISTOBJECT         = OUTPUT_LIST
       EXCEPTIONS
            EMPTY_LIST         = 1
            LIST_INDEX_INVALID = 2
            OTHERS             = 3.

  LOOP AT ASCII_TEMP.
    ASCII_LIST = ASCII_TEMP.
    APPEND ASCII_LIST.
  ENDLOOP.

ENDFUNCTION.
This was first published in March 2002

Dig deeper on SAP ABAP

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchManufacturingERP

SearchOracle

SearchDataManagement

SearchAWS

SearchBusinessAnalytics

SearchCRM

SearchContentManagement

SearchFinancialApplications

Close