Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

I tried to determine the method to know what standard SAP functions, classes, and other objects may be used by customers, and it is not so easy. This topic is important because we, developers, may call forbidden objects that do not ensure integrity, like calling a low-level database update function, which doesn't check the validity of parameters we pass to it.

There are multiple tools offered by sap to find the enabled objects, because with every release there is a new tool, and previous tools are preserved for ascendant compatibility.

I found the following sources of information :

  • reuse library (SE83 transaction) : this should be the official repository of all functions and classes that can be used. It contains also demo programs.
  • sap official documentation : sap library, abap online documentation.
  • some function modules are said "released" (address_into_printform), "marked for release" (bp_event_raise) or "internally released" (address_show_printform), since a given date in SE37. I could find the following text in sap library for "internally released" (but nothing for "marked for release") : "SAP internal: If the BAPI is only to be used internally, and therefore not for release to customers, the status of the function module must be set to Released internally".
  • I found that table RODIR contains a list of "released" classes and more (this table is normally used for function modules only).
  • some function modules are flagged obsolete in SE37
  • sap Notes : some notes explain how the developer may call a given function to achieve a given goal. For example, report SNIF in note 729358.
  • "Batch input" programming : we may call any transaction, by using CALL TRANSACTION ... USING ... (also function modules BDC_OPEN_JOB, etc.)
  • BOR - Business Object Repository (SWO1 transaction) : Sap library says "The Business Object Repository (BOR) is the central access point for the SAP business object types and their BAPIs"
  • BAPI explorer (BAPI transaction)
  • ABAP controls examples (DWDM transaction) : the objects called in these demo programs can be used by the customer.

I thought that the "reuse library" was the current tool, but I wanted to make sure by creating a little program (on minisap 7.0 SP 12) to check that the reuse library is coherent with the other informations.

I found the following :

  • reuse library contains objects that are not assigned to products (so they can't be found!! I discovered these objects in table RLB_DB_TRR) for example CL_GUI_FRONTEND_SERVICES, BAL_LOG_CREATE, ...
  • reuse library contains 2 function modules defined in products, that are flagged obsolete (POPUP_TO_CONFIRM_WITH_MESSAGE and POPUP_TO_DECIDE)
  • reuse library contains function modules that are in equal proportions flagged either "released" or "internally released" in SE37, and very few are "marked for release" (bp_event..., job_open, job_close), and some others are obsolete.
  • reuse library does not contain BAPIs except in rare cases. So we should rely on BAPI explorer (but see below about bapi explorer)
  • in BAPI explorer, only BAPIs interfaced with the BOR are listed. So, should we consider that all function modules prefixed with /namespace/BAPI_ can be used ? (since BAPI function module names are standardized this way)
  • sap library mention that we can use function module BALW_RANGES_CHECK, BAPI_CURRENCY_CONV_TO_EXTERNAL, etc., which are not defined in the reuse library, but are defined in SE37 as "internally released". What can we conclude : sap library wins over "internally released" function modules, and on all other things delivered with sap system.
  • sap library : same for other object types, like class CL_ABAP_LIST_UTILITIES which is not listed in reuse library
  • sap library contains class CL_ABAP_CHAR_UTILITIES, which is defined "released" in table RODIR, but it is not in the reuse library
  • sap library contains class cl_batch_event which is neither in table RODIR, nor in reuse library. Sap library does not mention anymore function module bp_event_raise (which was to be used in previous releases), but it is not even classified as obsolete.
  • Some function modules flagged "released" in SE37 are not in the reuse library, like BAPI_USER_CREATE1, GUI_DOWNLOAD, etc.

Conclusion :

  • SAP is not very coherent, I hope that in the next releases, they will create a unique list of objects customers can use, and that they will spend time on it so that it'll be of the best quality!
  • When not sure if an object is standard or not, and if you use it very often or if you are sure it is not best practice to call it, it would be more secure to add a layer between custom programs and standard objects (functions, classes), in case they are changed by SAP (so that you just have to adapt at one place)
  • Because of the uncompleteness of the "reuse library", we can assume that sap will not dare changing doubtful objects and keep ascending compatiblity for them in future releases.

Below is the program I used to analyze reuse library, released function modules, etc.:

REPORT  z_rlb_vs_rodir.

* RLB_DB_TRR : objects in reuse library (and more objects!)
DATA: BEGIN OF lt_rlb OCCURS 0,
        ref_type    TYPE rlb_db_trr-ref_type,
        ref_object  TYPE rlb_db_trr-ref_object,
      END OF lt_rlb.
* RLB_DB_PR / RLB_DB_TRR : reuse library, objects by product
data: begin of gt_tab occurs 0,
        ext_id      type rlb_db_pr-ext_id,
        ref_type    type rlb_db_trr-ref_type,
        ref_object  type rlb_db_trr-ref_object,
      end of gt_tab.
* RODIR:
* CLIOBJECT RELEASED OBSOLETE Meaning
* X                           Marked for release
*           X                 Internally released
* X         X                 Released
* ?         ?        X        Obsolete
DATA: BEGIN OF lt_rodir OCCURS 0,
        objecttype  TYPE rodir-objecttype,
        object      TYPE rodir-object,
        CLIOBJect   TYPE rodir-CLIOBJect,
        released    TYPE rodir-released,
        obSOLETE    TYPE rodir-obsolete,
      END OF lt_rodir.
* TFDIR-FREEDATE must be ignored if RODIR-RELEASED is space or if there
* is no entry in RODIR
DATA: BEGIN OF lt_tfdir OCCURS 0,
        funcname  TYPE tfdir-funcname,
        freedate  TYPE tfdir-freedate,
      END OF lt_tfdir.
* TFDIR : all function modules named /namespace/BAPI are BAPIs
DATA: BEGIN OF lt_tfdir_bapi OCCURS 0,
        funcname  TYPE tfdir-funcname,
        freedate  TYPE tfdir-freedate,
      END OF lt_tfdir_bapi.
* SWOTLV : Business object type Methods (also attributes, ...)
data: begin of lt_swotlv occurs 0,
        abapname type swotlv-abapname,
        LOBJTYPE type swotlv-LOBJTYPE,
      end of lt_swotlv.
DATA l_ref_object LIKE lt_rlb-ref_object.


SELECT ref_type ref_object
      INTO TABLE lt_rlb
      FROM rlb_db_trr
      GROUP BY ref_type ref_object.
SELECT objecttype object CLIOBJect released obsolete
      INTO TABLE lt_rodir
      FROM rodir
      ORDER BY objecttype object.
* strange tfdir-freedate is type date, so initial value should always be
* 00000000, but we also find all spaces!!
SELECT funcname freedate
      INTO TABLE lt_tfdir
      FROM tfdir
      WHERE freedate NE '00000000' and freedate ne space
      ORDER BY funcname.

select rlb_db_pr~ext_id rlb_db_trr~ref_type rlb_db_trr~ref_object
      into table gt_tab
      from rlb_db_pr
        inner join rlb_db_tr
          on rlb_db_tr~tree_id = rlb_db_pr~objects
        inner join rlb_db_trr
          on rlb_db_trr~node_id = rlb_db_tr~node_id.
sort gt_tab by ref_type ref_object.

SELECT funcname freedate
      INTO TABLE lt_tfdir_bapi
      FROM tfdir
      WHERE funcname like 'BAPI_%' or funcname LIKE '/%/BAPI_%'
      ORDER BY funcname.

SELECT abapname LOBJTYPE
      INTO TABLE lt_swotlv
      FROM swotlv
      WHERE modelonly = 'R' and isapi = 'X' and abapname ne space
      group BY abapname lobjtype.


WRITE : / 'Objects which are both in RODIR and in Reuse library'.
LOOP AT lt_rlb WHERE ref_type = 'RLBO'.
  READ TABLE lt_rodir
        WITH KEY
          objecttype = lt_rlb-ref_object(4)
          object     = lt_rlb-ref_object+15
        binary search.
  IF sy-subrc EQ 0.
    clear lt_tfdir.
    if ( lt_rodir-cliobject = 'X' or lt_rodir-released = 'X' )
          and lt_rlb-ref_object(4) = 'FUNC'.
      READ TABLE lt_tfdir
            WITH KEY
              funcname = lt_rlb-ref_object+15
            binary search.
    endif.
    clear gt_tab.
    READ TABLE gt_tab
          WITH KEY
            ref_type   = lt_rlb-ref_type
            ref_object = lt_rlb-ref_object
          binary search.
    WRITE : / lt_rlb-ref_type, lt_rlb-ref_object(4),
          lt_rlb-ref_object+15, lt_rodir-CLIOBJect, lt_rodir-released,
          lt_rodir-obsolete, lt_tfdir-freedate, gt_tab-ext_id.
  ENDIF.
ENDLOOP.

SKIP 5.
WRITE : / 'Objects which are only in Reuse library'.
LOOP AT lt_rlb WHERE ref_type = 'RLBO'.
  READ TABLE lt_rodir
        WITH KEY
          objecttype = lt_rlb-ref_object(4)
          object     = lt_rlb-ref_object+15
        binary search.
  IF sy-subrc NE 0.
    clear lt_tfdir.
    clear gt_tab.
    READ TABLE gt_tab
          WITH KEY
            ref_type   = lt_rlb-ref_type
            ref_object = lt_rlb-ref_object
          binary search.
    WRITE : / lt_rlb-ref_type, lt_rlb-ref_object(4),
          lt_rlb-ref_object+15, gt_tab-ext_id.
  ENDIF.
ENDLOOP.

SKIP 5.
WRITE : / 'Objects which are only in RODIR'.
LOOP AT lt_rodir.
  l_ref_object(4) = lt_rodir-objecttype.
  l_ref_object+15 = lt_rodir-object.
  READ TABLE lt_rlb
        WITH KEY
          ref_type   = 'RLBO'
          ref_object = l_ref_object
        binary search.
  IF sy-subrc NE 0.
    clear lt_tfdir.
    if ( lt_rodir-cliobject = 'X' or lt_rodir-released = 'X' )
          and lt_rodir-objecttype = 'FUNC'.
      READ TABLE lt_tfdir
            WITH KEY
              funcname = lt_rodir-object
            binary search.
    endif.
    WRITE : / lt_rodir-objecttype, lt_rodir-object, lt_rodir-CLIOBJect,
          lt_rodir-released, lt_rodir-obsolete, lt_tfdir-freedate.
  ENDIF.
ENDLOOP.


SKIP 5.
WRITE : / 'business object repository methods which use BAPI '
      & 'function modules not released'.
LOOP AT lt_swotlv.
  clear lt_rodir.
  READ TABLE lt_rodir
        WITH KEY
          objecttype = 'FUNC'
          object     = lt_swotlv-abapname
        binary search.
  clear lt_tfdir_bapi.
  READ TABLE lt_tfdir_bapi
        WITH KEY
          funcname = lt_swotlv-abapname
        binary search.
  IF lt_rodir-released = space or lt_rodir-obsolete = 'X'.
    WRITE : / lt_swotlv-lobjtype, lt_swotlv-abapname, lt_rodir-CLIOBJect,
          lt_rodir-released, lt_rodir-obsolete, lt_tfdir_bapi-freedate.
  ENDIF.
ENDLOOP.


SKIP 5.
WRITE : / 'BAPI function modules which are neither in reuse library ' &
      'nor in RODIR (so not released)'.
LOOP AT lt_tfdir_bapi.
  clear lt_rodir.
  READ TABLE lt_rodir
        WITH KEY
          objecttype = 'FUNC'
          object     = lt_tfdir_bapi-funcname
        binary search.
  IF sy-subrc ne 0.
    WRITE : / lt_tfdir_bapi-funcname, lt_rodir-CLIOBJect, lt_rodir-released,
          lt_rodir-obsolete, lt_tfdir_bapi-freedate.
  ENDIF.
ENDLOOP.

SKIP 5.
WRITE : / 'BAPI function modules which are not in the business object '
      & 'repository'.
LOOP AT lt_tfdir_bapi.
  clear lt_rodir.
  READ TABLE lt_rodir
        WITH KEY
          objecttype = 'FUNC'
          object     = lt_tfdir_bapi-funcname
        binary search.
  clear lt_swotlv.
  READ TABLE lt_swotlv
        WITH KEY
          abapname = lt_tfdir_bapi-funcname
        binary search.
  IF sy-subrc ne 0.
    WRITE : / lt_tfdir_bapi-funcname, lt_rodir-CLIOBJect, lt_rodir-released,
          lt_rodir-obsolete, lt_tfdir_bapi-freedate.
  ENDIF.
ENDLOOP.
  • No labels