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
Requires Free Membership to View
When you register, you will start receiving targeted emails from my award-winning team of editorial writers. Our goal is to keep you informed on the hottest topics and biggest challenges faced by SAP professionals today.
Hannah Smalltree, Editorial Director 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