您的位置:首页 > 移动开发 > Objective-C

ABAP - FM to get Where-used list result

2008-12-10 14:14 1016 查看
Where-used list在SAP中是一个非常有用的功能,但是有时我们需要在abap code中得到where used list的结果,保存在一个内表中,从而能做进一步的处理。<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

 

下面这个FM能帮我们完成这个功能:

  RS_EU_CROSSREF

 

****************************************************************

Example:

****************************************************************

 

 

*定义要搜索的字符串

 DATA: BEGIN OF findstrings OCCURS 10.
        INCLUDE STRUCTURE rsfind.
 DATA: END OF findstrings.

 

*保存查到的结果

    DATA: lt_founds LIKE rsfindlst OCCURS 0 WITH HEADER LINE,

 

*保存要查找的范围

    DATA: BEGIN OF it_scope_object_cls OCCURS 100.
 DATA: type LIKE euobj-id.
 DATA: END OF it_scope_object_cls.

 

*--------------------------------------------------------

*下面实现了查找所有用到Domain 'PSTYV'的table/structure有哪些.

*--------------------------------------------------------

 

*存入domain 'PSTYV'

 findstrings-object = 'PSTYV'.
 APPEND findstrings.

 

*Put the table type and structure type into the internal table

 it_scope_object_cls-type = 'DT'.  "data table
 APPEND it_scope_object_cls.

 

 it_scope_object_cls-type = 'DS'.  "data structure
 APPEND it_scope_object_cls.

 

    CALL FUNCTION 'RS_EU_CROSSREF'
    EXPORTING
      i_find_obj_cls                     = 'DD'
*    I_SCOPE_OBJ_CLS                    = 'P'
*   REKURSIV                           = ' '
*   I_ANSWER                           = ' '
*   I_ACTUAL_INCLUDE                   = ' '
*   NO_DIALOG                          = ' '
*   EXPAND_SOURCE_IN_BATCH_MODE        = 'X'
*   EXPAND_SOURCE_IN_ONLINE_MODE       = ' '
*   WITHOUT_TEXT                       = ' '
* IMPORTING
*   O_SCOPE_OBJ_CLS                    =
*   O_ANSWER                           =
   TABLES
      i_findstrings                      = findstrings[]
      o_founds                           = lt_founds[]
*   O_FINDSTRINGS                      =
*   i_scope_objects                    = 

*   I_ACTUAL_SOURCE                    =
      i_scope_object_cls                 = it_scope_object_cls[]
*   I_SCOPE_DEVCLASS                   =
*   I_EXCLUDE_SCOPE_OBJECT_CLS         =
* EXCEPTIONS
*   NOT_EXECUTED                       = 1
*   NOT_FOUND                          = 2
*   ILLEGAL_OBJECT                     = 3
*   NO_CROSS_FOR_THIS_OBJECT           = 4
*   BATCH                              = 5
*   BATCHJOB_ERROR                     = 6
*   WRONG_TYPE                         = 7
*   OBJECT_NOT_EXIST                   = 8
*   OTHERS                             = 9
            .
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

**********************************************************************

 

1. Now the where used list has been put into internal table lt_founds[].

2. If the search scope only has one type, we can use parameter I_SCOPE_OBJ_CLS, otherwise we need to put

    them into a internal table and export it to parameter I_SCOPE_OBJECT_CLAS.

3. Some object types list as below:

    P:         Report

    INCL:      Include

    FF:        Function Module

    0:         Class/Interface

    WO:        BSP Application

    YT:        Web Dynpro Component

    PS:        Screen

 

    DD:        Domains

    DE:        Data elements

    DS:        Structure

    DT:        Data Tables

    DA:        Table types

    DV:        View

    ME:        Entity Types

    DL:       Lock objects

    DH:        Search Helps

 

    DTF:       Table Fields

    DSF:       Structure Fields

    DVF:       View Fields

    MEA:       Entity Type Attribute

 

    3I :       Virtual interface

    KI:        Package Interface

    L:         Logical database

    GE:        Test scripts(eCATT)

    GD:        Test Data (eCATT)

    C:         Test Cases (CATT)

    B:         Authorization object

    A:         Dialog Modules
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐