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

Author: Kin C. Chan

email: chan.kinc@gmail.com

Submitted: 10/3/2011

The Issue 

SAP BW is a great tool…but some of the tools (i.e. transports) are not very user-friendly toward the developer community.  Here are a couple of BW Transport related items that have bothered me since the beginning of my BW career:

  1. Routines and Formulas – there is no version management or remote compare option like there is for ABAP programs
  2. Object descriptions – there are so many generated objects in BW, it is often very difficult to tell what’s what in a given transport

The Solution

A few years ago, I designed and created this utility to help address these concerns…and frankly, to make my life easier.  It’s been updated many times along the way (to support additional objects) and cleaned up just recently before sharing with the SDN community.  Here are the two main features of this utility:

  1. Display friendly descriptions for many 3.x object and some 7.0 objects
  2. Ability to display the ‘content’ of routines and formulas from the development environment…as well as from the QA and Production environments (no, this isn’t version management, but it does simplify the process of comparing objects across systems)

Limitations (of course there are limitations!!) ...

  • can be modified for additional 7.0 objects 
  • objects from other tools like BPS, IP and more

The Code

Here it is...enjoy! 

Feedback is most welcomed.

Error rendering macro 'code': Invalid value specified for parameter 'lang'
*&---------------------------------------------------------------------*
*& Report :  ZBW_TRANSPORT_ANALYSIS
*& Author :  Kin Chan
*& Company:  sanofi-aventis U.S.
*& Date   :  Initial version - Sept, 2011
*&---------------------------------------------------------------------*
*&   Problem :  BW transports are not BW developer-friendly,
*&              due to the number of objects with generated IDs
*&
*&   Solution:  A utility that helps us see what's what in a
*&              BW transport...and also allows us to see and compare
*&              selected objects in other systems (QA and Production).
*&              Particularly useful for Routines and Formulas.
*&
*&
*&...Main Features......................................................
*&   1.'X-ray' for ROUTINES and FORMULAS:
*&     - display content of all of these objects from the transport's
*&       point of view, instead of reviewing the definition from
*&       the infoProvider's pov
*&
*&   2. display content (Routines & Formulas) from QA and Production
*&       - login required...duh!
*&       - ex. review modifications by self / team member / offshore
*&         resource and compare to production (prior to migration, etc.)
*&
*&   3. display 'meaningful' description for most 3.x and some
*&      7.0 objects
*&        - ***FUTURE***...BPS, IP objects, and more
*&
*&
*&...LIMITATIONS.......................................................
*&   1. not all objects types are currently supported
*&      - additional objects *may* be added in the future (as needed,
*&        as requested, etc.)
*&   2. 7.0 formula DESCRIPTION not currently available
*&      - content displays w/o any problem
*&   3. (plenty more)
*&
*&
*&...SELECTION SCREEN..................................................
*&
*&   1. Transport request(s)
*&      - specify Transport request and all transport tasks below
*&        will be analyzed
*&      - specify Transport task and only the task will be analyzed
*&
*&   2. RFC destination for Dev, QA and Production
*&      - needed in order to retrieve info from these systems
*&
*&   3. Existance check for QA and PRD
*&      - checks whether ROUTINES and FORMULAs exist or are new
*&
*&
*&...OUTPUT............................................................
*&
*&   Column
*&   ------
*&   1 to 6.  Self explanatory
*&
*&   7,8,9. DMG/CMG/PMG
*&            - indicates whether the ROUTINE or FORMULA exist in QA
*&              or Prod
*&            - check is based on existance of description only
*&            - other objects types are not checked!!
*&   10. Object's description
*&            - typically the user description
*&            - sometimes a little less straight forward (query
*&              elements, 3.x vs. 7.0 formulas, etc.)
*&
*&   Buttons
*&   -------
*&   1. Development System, QA or Consilidation, Production System
*&      - display the CONTENT of Routines and Formulas
*&      - locally or remotely based on selection
*&
*&
*&...Misc / Others.....................................................
*&   1. selection text
*&        CB_PRD             Existence check?
*&        CB_QA	             Existence check?
*&        P_RFCDEV         RFC destination for Dev
*&        P_RFCPRD         RFC destination for Prd
*&        P_RFCQA	         RFC destination for QA
*&        S_REQID	         Transport request(s) / Task(s)
*&
*&   2. GUI status (SE80)
*&        DEV = Development   Shift-F1
*&        QA  = QA            Shift-F2
*&        PRD = Production    Shift-F4
*&
*&   3. Default values for your systems
*&        - change the values for Dev, QA and PRD (line 200+-)
*&
*&---------------------------------------------------------------------*
REPORT  ZBW_TRANSPORT_ANALYSIS  LINE-COUNT  60
                                LINE-SIZE   186
                                NO STANDARD PAGE HEADING.

* # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
* # #   T A B L E S                                                 # #
* # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
tables:
  objt.


* # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
* # #   V A R I A B L E S                                           # #
* # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
data:
  begin of g_object_rec                 ,
    e071               like e071        ,
    ddtext             like objt-ddtext ,
    obj_desc_DEV(60)   type c           ,
    obj_desc_QA(60)    type c           ,
    obj_desc_PRD(60)   type c           ,
  end of g_object_rec                   ,
  g_object_rec2        like e071        ,
  g_object_tab         like g_object_rec
                       occurs 0         ,
  g_rfc_dest           like rfcdes-rfcdest.

data:
  g_routine_rec         like rsaabap,
  g_routine_tab         like rsaabap
                        occurs 0    .
data:
  g_formula0_rec        type RSFOBUEV000   ,
  g_formula0_tab        like g_formula0_rec
                        occurs 0           ,
  g_formula1_rec        type RSFOBUEV001   ,
  g_formula1_tab        like g_formula1_rec
                        occurs 0           .

data:
  g_hide_data           like e071       ,
  G_CURSOR_FIELD(30)    TYPE C          ,
  G_CURSOR_VALUE(200)   TYPE C          .

data:
  g_transno like e071-trkorr.


* # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
* # #   C O N S T A N T S                                           # #
* # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
constants:
  c_delimiter(1)      type c
                      value '|',
  c_len_delimiter(2)  type n
                      value 01 ,
  c_len_separator(2)  type n
                      value 02 ,
  c_len_reqid(2)      type n
                      value 12 ,
  c_len_pos(2)        type n
                      value 06 ,
  c_len_objtext(2)    type n
                      value 20 ,
  c_len_pgmid(2)      type n
                      value 04 ,
  c_len_object(2)     type n
                      value 04 ,
  c_len_objname(2)    type n
                      value 40 ,
  c_len_sys(2)        type n
                      value 03 ,
  c_len_objdesc(2)    type n
                      value 60 .



* # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
* # #   S E L E C T I O N - S C R E E N                             # #
* # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
select-options:
  s_reqid   for g_transno
            obligatory      .

selection-screen:
  skip 2.

parameters:
  p_rfcdev(12) type c
               default 'DMG070'.  " <<<<<<<<<<<<<CHANGE<<<<<<<
selection-screen:
  skip 1.

parameters:
  p_rfcqa(12)  type c
               default 'CMG070',  " <<<<<<<<<<<<<CHANGE<<<<<<<
  cb_qa        as checkbox
               default ' '     .

selection-screen:
  skip 1.

parameters:
  p_rfcprd(12) type c
               default 'PMG070',  " <<<<<<<<<<<<<CHANGE<<<<<<<
  cb_prd       as checkbox
               default ' '     .





* # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
* # #   S T A R T - O F - S E L E C T I O N                         # #
* # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
Start-of-selection.


* 1. retrieve list of objects from selected transport(s)
  perform retrieve_objects_list tables g_object_tab
                                       s_reqid     .

* 2. long text associated with each object
  perform retrieve_object_desc_all
                                tables g_object_tab.

* 3. text description associate with object type
  perform retrieve_object_type_text
                                tables g_object_tab.
*                                      g_objt_tab.






* # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
* # #   E N D - O F - S E L E C T I O N                             # #
* # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
End-of-selection.

* 4. output transport object list with available descriptions
  perform display_object_list tables g_object_tab.






* # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
* # #   A T   L I N E - S E L E C T I O N                           # #
* # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
AT LINE-SELECTION.






* # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
* # #   A T   U S E R - C O M M A N D                               # #
* # #                                                               # #
* # #   - Display content of ROUTINES and FORMULAS, local and remote# #
* # #     - other objects not supported                             # #
* # #                                                               # #
* # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
AT USER-COMMAND.

* buttons are only valid for Routines and Formulas
  if ( g_hide_data-pgmid  = 'R3TR'     ) and
     ( g_hide_data-object = 'ROUT' or
       g_hide_data-object = 'RSFO'     )   .

    CASE SY-UCOMM.

*-----1. retrieve and display routines/formulas locally---
      WHEN 'DEV'.

        case g_hide_data-object.

*         1a. Routines
          when 'ROUT'.
            perform retrieve_routine_content_dev
                                     tables g_routine_tab
                                     using  g_hide_data-obj_name.

            perform display_routine_popup
                                     tables g_routine_tab
                                     using  g_hide_data-obj_name.

*         1b. Formulas
          when 'RSFO'.
*           perform retrieve_formula0 tables g_formula0_tab
            perform retrieve_formula_content_loc
                                     tables g_formula1_tab
                                     using  g_hide_data-obj_name.
*           perform display_formula0  tables g_formula0_tab
            perform display_formula_popup
                                     tables g_formula1_tab
                                     using  g_hide_data-obj_name.

        endcase.

*-----2. retrieve and display routines/formulas remotely---
      WHEN 'QA' or 'PRD'.

*       RFC destination
        if     sy-ucomm = 'QA'.

           g_rfc_dest = p_rfcqa.

        elseif sy-ucomm = 'PRD'.

            g_rfc_dest = p_rfcprd.

        endif.

        case g_hide_data-object.

*         2a. Routines
          when 'ROUT'.

            perform retrieve_routine_content_rem
                                     tables g_routine_tab
                                     using  g_rfc_dest
                                            g_hide_data-obj_name.
            perform display_routine_popup
                                     tables g_routine_tab
                                     using  g_hide_data-obj_name.

*         2b. Formulas
          when 'RSFO'.

            perform retrieve_formula1_remote
                                     tables g_formula1_tab
                                     using  g_rfc_dest
                                            g_hide_data-obj_name.
            perform display_formula_popup
                                     tables g_formula1_tab
                                     using  g_hide_data-obj_name.

        endcase.


    ENDCASE.

* 3. error message if cursor not on Routine or Formula
  else.

    message i001(00)
       with 'Please place cursor on a ROUTINE or FORMULA'.

  endif.

  CLEAR: G_HIDE_DATA   ,
         G_CURSOR_FIELD,
         G_CURSOR_VALUE.






* # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
* # #   R O U T I N E S                                             # #
* # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #


***********************************************************************
* Retrieve description of Object Type (displays in column 3)
***********************************************************************
form retrieve_object_type_text
          tables p_object_tab  like      g_object_tab.


data:
  l_object_rec            like g_object_rec.
*  l_objt_rec              like g_objt_rec  .
data: ls_object_texts_rec like   ko100,
      lt_object_texts     like   ko100
                          occurs 0.


** retrieve text v1
*  refresh  p_objtext_tab.
*  select * from       objt
*           into table p_objtext_tab
*           where      language = 'EN'.
*
*  sort p_objtext_tab by objectname.



* retrieve text for Object Type
  CALL FUNCTION 'TR_OBJECT_TABLE'
         TABLES
                wt_object_text = lt_object_texts.

  sort lt_object_texts by PGMID OBJECT.


* 1. retrieve descriptions 1 at a time -----------------------------
  loop at p_object_tab into l_object_rec.

**---2a. lookup OBJECT TYPE description from itab v1
*    clear           l_objt_rec.
*    read table      g_objt_tab
*          into      l_objt_rec
*          with key  objectname = l_object_rec-e071-object
*          binary search.
*    l_object_rec-ddtext = l_objt_rec-ddtext.

*---2b. lookup OBJECT TYPE description from itab v2
    clear           ls_object_texts_rec.
    read table      lt_object_texts
          into      ls_object_texts_rec
          with key  PGMID  = l_object_rec-e071-PGMID
                    OBJECT = l_object_rec-e071-OBJECT
          binary search.

    l_object_rec-ddtext = ls_object_texts_rec-text.

    modify p_object_tab from l_object_rec.

  endloop.

endform.     "retrieve_object_type_text



***********************************************************************
* Compile list of objects based on Transport(s) selected
***********************************************************************
form retrieve_objects_list tables p_object_tab like g_object_tab
                                  p_reqid_tab                   .

data:
  l_object_rec   like g_object_rec,
  l_e070_rec     like e070        ,
  l_e070_tab     like e070
                 occurs 0         .

ranges:
  l_request_tab  for e070-trkorr.


*-1. at least one transport is mandatory-----------------------------
  check not p_reqid_tab[] is initial.

* 2. retrieve children of specified transport(s)
  select * from       e070
           into table l_e070_tab
           where      STRKORR in p_reqid_tab.

* 3. combine selected transports and their children into single list
  l_request_tab[] = p_reqid_tab[].
  loop at l_e070_tab into l_e070_rec.

    l_request_tab-sign   = 'I'              .
    l_request_tab-option = 'EQ'             .
    l_request_tab-low    = l_e070_rec-trkorr.
    append l_request_tab.

  endloop.

* 4. retrive list of objects based on the consolidated transport
*    list
  select * from    e071
           into    table
                   p_object_tab
           where   TRKORR in l_request_tab.

  sort p_object_tab
    by e071-TRKORR e071-AS4POS.

endform.  "retrieve_objects_list


***********************************************************************
* Retrieve the (user entered) description for all objects in the list
*   - ***not 100% complete***
***********************************************************************
form retrieve_object_desc_all
                          tables p_object_tab like g_object_tab.


data:
  l_object_rec   like g_object_rec,
  l_e070_rec     like e070        ,
  l_e070_tab     like e070
                 occurs 0         .


* 1. retrieve descriptions 1 at a time -----------------------------
  loop at p_object_tab into l_object_rec.

*---Retrieve descriptions and store in itab

*---2. Development System (all objects)
    perform retrieve_object_desc_single
                          using    l_object_rec-e071-pgmid
                                   l_object_rec-e071-object
                                   l_object_rec-e071-obj_name
                                   'X'         "cb_dmg
                                   p_rfcdev    "space
                          changing l_object_rec-obj_desc_DEV .

*---3. QA System
*      - description only, for ROUTINEs and FORMULAs
*        (existence check)
    perform retrieve_object_desc_single
                          using    l_object_rec-e071-pgmid
                                   l_object_rec-e071-object
                                   l_object_rec-e071-obj_name
                                   cb_qa
                                   p_rfcqa
                          changing l_object_rec-obj_desc_QA .

*---4. Production System
*      - description only, for ROUTINEs and FORMULAs
*        (existence check)
    perform retrieve_object_desc_single
                          using    l_object_rec-e071-pgmid
                                   l_object_rec-e071-object
                                   l_object_rec-e071-obj_name
                                   cb_prd
                                   p_rfcprd
                          changing l_object_rec-obj_desc_PRD.

*---5. save desc to itab
    modify p_object_tab from l_object_rec.

  endloop.


endform.  "retrieve_object_desc_all


***********************************************************************
* Display all of the objects with the user descriptions
***********************************************************************
form display_object_list tables p_object_tab structure g_object_rec.

data:
  l_object_rec    like g_object_rec             ,
  l_obj_desc      like g_object_rec-obj_desc_DEV.
DATA:
  L_EXCLUDE_TAB   TYPE STANDARD TABLE OF TAB_TYPE
                  WITH NON-UNIQUE DEFAULT KEY
                       INITIAL SIZE 5            .


  SET PF-STATUS '0100' EXCLUDING L_EXCLUDE_TAB.


  loop at p_object_tab into l_object_rec.

    at new e071-trkorr.
      uline.
    endat.

*   Transport #, item, object Desc, type, name or ID
    new-line.
    write at (c_len_delimiter) c_delimiter               .
    write at (c_len_reqid)     l_object_rec-e071-trkorr  .
    write at (c_len_delimiter) c_delimiter               .
    write at (c_len_pos)       l_object_rec-e071-as4pos  .
    write at (c_len_delimiter) c_delimiter               .
    write at (c_len_objtext)   l_object_rec-ddtext       .
    write at (c_len_delimiter) c_delimiter               .
    write at (c_len_pgmid)     l_object_rec-e071-pgmid   .
    write at (c_len_delimiter) c_delimiter               .
    write at (c_len_object)    l_object_rec-e071-object  .
    write at (c_len_delimiter) c_delimiter               .
    write at (c_len_objname)   l_object_rec-e071-obj_name.
    write at (c_len_delimiter) c_delimiter               .

*   if description found in Development
    clear l_obj_desc.
    if l_object_rec-obj_desc_DEV > space.
      write at (c_len_sys)       'DEV'      .
      write at (c_len_delimiter) c_delimiter.
      l_obj_desc = l_object_rec-obj_desc_DEV.
    else.
      write at (c_len_sys)       '   '      .
      write at (c_len_delimiter) c_delimiter.
    endif.

*   if description found in QA (only checked for Routines and Formulas)
    if l_object_rec-obj_desc_QA > space.
      write at (c_len_sys)       'QA'      .
      write at (c_len_delimiter) c_delimiter.
      l_obj_desc = l_object_rec-obj_desc_QA.
    else.
      write at (c_len_sys)       '   '      .
      write at (c_len_delimiter) c_delimiter.
    endif.

*   if description found in Production (only checked for Routines and
*   Formulas)
    if l_object_rec-obj_desc_PRD > space.
      write at (c_len_sys)       'PRD'      .
      write at (c_len_delimiter) c_delimiter.
      l_obj_desc = l_object_rec-obj_desc_PRD.
    else.
      write at (c_len_sys)       '   '      .
      write at (c_len_delimiter) c_delimiter.
    endif.

    write at (c_len_objdesc)   l_obj_desc   .
    write at (c_len_delimiter) c_delimiter  .

*---prepare for line selection
    G_HIDE_DATA =  l_object_rec.
    HIDE : G_HIDE_DATA.
    CLEAR: G_HIDE_DATA.

  endloop.

  uline.

endform.  "display_object_list


***********************************************************************
* Retrieve content of selected routine locally (dev system)
***********************************************************************
form retrieve_routine_content_dev
                      tables p_routine_tab
                      using  p_object_name.


  refresh              p_routine_tab.
  select * from        rsaabap
           into table  p_routine_tab
                where  codeid  = p_object_name
                  and  objvers = 'A'          .


endform.   "retrieve_routine_content_dev


***********************************************************************
* Retrieve content of selected formula locally (dev system)
***********************************************************************
form retrieve_formula_content_loc
                       tables p_formula1_tab
                       using  p_object_name.


  refresh              p_formula1_tab.
  select * from        RSFOBUEV001
           into table  p_formula1_tab
           where       formid  = p_object_name
             and       objvers = 'A'          .


endform.   "retrieve_formula_content_loc

***********************************************************************
* Display content of selected routine in a popup window
***********************************************************************
form display_routine_popup
                     tables p_routine_tab
                     using  p_object_name.

data:
  l_routine_rec         like g_routine_rec,
  L_TLINE               LIKE TRTAB        ,
  L_POPUP_TAB           LIKE TRTAB
                        OCCURS 0          .

data: list_tab like trtab occurs 0 with header line.


* prep for popup window
  if p_routine_tab[] is initial.

    l_tline = '(not found)'.
    append l_tline to l_popup_tab.

  else.
    refresh l_popup_tab.
    loop at p_routine_tab into l_routine_rec.

      l_tline        =  l_routine_rec-line.
      append l_tline to l_popup_tab.

    endloop.

  endif.

* display routine
  list_tab-line = l_routine_rec-codeid.
  CALL FUNCTION 'LAW_SHOW_POPUP_WITH_TEXT'
        EXPORTING
          TITELBAR     = p_object_name
          HEADER_LINES = 1
          LINE_SIZE    = 80
        TABLES
          LIST_TAB     = L_POPUP_TAB.



endform.  "display_routine_popup



***********************************************************************
* Display content of selected formula in a popup window
***********************************************************************
form display_formula_popup
                      tables p_formula1_tab
                      using  p_object_name.

data:
  l_formula1_rec        like g_formula1_rec,
  L_TLINE               LIKE TRTAB         ,
  L_POPUP_TAB           LIKE TRTAB
                        OCCURS 0           .
data: list_tab like trtab occurs 0 with header line.


* prep for popup window
  if p_formula1_tab[] is initial.

    l_tline = '(not found)'.
    append l_tline to l_popup_tab.

  else.
    refresh l_popup_tab.
    loop at p_formula1_tab into l_formula1_rec.

      concatenate    l_tline l_formula1_rec-FSYM
             into    l_tline
        separated by space.


    endloop.

    append l_tline to l_popup_tab.

  endif.

* display formula in a popup
  list_tab-line = l_formula1_rec-formid.
  CALL FUNCTION 'LAW_SHOW_POPUP_WITH_TEXT'
        EXPORTING
          TITELBAR     = p_object_name
          HEADER_LINES = 1
          LINE_SIZE    = 80
        TABLES
          LIST_TAB     = L_POPUP_TAB.



endform.  "display_formula_popup


***********************************************************************
* Retrieve content of selected routine from a remote system
***********************************************************************
form retrieve_routine_content_rem
                      tables p_routine_tab
                      using  p_rfc_dest
                             p_object_name.


data:
  l_char512          like tab512    ,
  l_columns_tab      like RFC_DB_FLD
                     occurs 0       ,
  l_options_rec      like RFC_DB_OPT,
  l_options_tab      like RFC_DB_OPT
                     occurs 0       ,
  l_data_rec         like tab512    ,
  l_data_tab         like tab512
                     occurs 0       .



*-retrieve routine ------------
  refresh:  l_columns_tab,
            l_options_tab,
            p_routine_tab   .

  concatenate 'CODEID = '''
              p_object_name
              ''' AND OBJVERS = ''A'''
         into l_options_rec.
  append l_options_rec to l_options_tab.

  CALL FUNCTION 'RFC_READ_TABLE'
    destination p_rfc_dest
    EXPORTING
      QUERY_TABLE                = 'RSAABAP'
    TABLES
      OPTIONS                    = l_options_tab
      FIELDS                     = l_columns_tab
      DATA                       = p_routine_tab
    EXCEPTIONS
      TABLE_NOT_AVAILABLE        = 1
      TABLE_WITHOUT_DATA         = 2
      OPTION_NOT_VALID           = 3
      FIELD_NOT_VALID            = 4
      NOT_AUTHORIZED             = 5
      DATA_BUFFER_EXCEEDED       = 6
      OTHERS                     = 7
            .
  IF SY-SUBRC <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  ELSE.

*    loop at l_data_tab into l_data_rec.
*      p_pgm_name_remote = l_data_rec.
*      exit.
*    endloop.

  ENDIF.

endform.  "retrieve_routine_content_rem


***********************************************************************
* Retrieve content of selected formula from a remote system
***********************************************************************
form retrieve_formula1_remote
                      tables p_formula1_tab
                      using  p_rfc_dest
                             p_object_name.


data:
  l_char512          like tab512         ,
  l_columns_tab      like RFC_DB_FLD
                     occurs 0            ,
  l_options_rec      like RFC_DB_OPT     ,
  l_options_tab      like RFC_DB_OPT
                     occurs 0            ,
  l_data_rec         like tab512         ,
  l_data_tab         like tab512
                     occurs 0            ,
  l_formula1_rec     like g_formula1_rec ,
  l_subrc(6)         type n              .



*-retrieve routine ------------
  refresh:  l_columns_tab  ,
            l_options_tab  ,
            p_formula1_tab .

  concatenate 'FORMID = '''
              p_object_name
              ''' AND OBJVERS = ''A'''
         into l_options_rec.

  append l_options_rec to l_options_tab.

  CALL FUNCTION 'RFC_READ_TABLE'
    destination p_rfc_dest
    EXPORTING
*     QUERY_TABLE                = 'SFOBUEV001'
*     QUERY_TABLE                = 'RSFOBUEV000'
      QUERY_TABLE                = 'RSFOBUEV001'
    TABLES
      OPTIONS                    = l_options_tab
      FIELDS                     = l_columns_tab
      DATA                       = p_formula1_tab
    EXCEPTIONS
      TABLE_NOT_AVAILABLE        = 1
      TABLE_WITHOUT_DATA         = 2
      OPTION_NOT_VALID           = 3
      FIELD_NOT_VALID            = 4
      NOT_AUTHORIZED             = 5
      DATA_BUFFER_EXCEEDED       = 6
      OTHERS                     = 7
            .

  IF SY-SUBRC <> 0.

    l_subrc = sy-subrc.
    concatenate 'RFC_READ_TABLE error, SY-SUBRC = '
                l_subrc
           into l_formula1_rec-fsym
           separated by space.
    append l_formula1_rec to p_formula1_tab.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  ELSE.

*    loop at l_data_tab into l_data_rec.
*      p_pgm_name_remote = l_data_rec.
*      exit.
*    endloop.

  ENDIF.

endform.  "retrieve_formula1_remote



***********************************************************************
* Retrieve the user description of a single object
*   - local or remote
***********************************************************************
form retrieve_object_desc_single
                          using    p_pgmid
                                   p_object_type
                                   p_object_name
                                   p_rfc_selected
                                   p_rfc_dest
                          changing p_object_desc.


    clear p_object_desc.
*------------------------------------------------------------------
*---1. Transfer, Transformation and Update ROUTINES ---------------
*------------------------------------------------------------------
    if ( p_pgmid       = 'R3TR'      ) and
       ( p_object_type = 'ROUT'      ).

      perform           retrieve_desc_Routine
              using     p_rfc_selected
                        p_rfc_dest
                        p_object_name
              changing  p_object_desc.

*------------------------------------------------------------------
*---2. Formulas ---------------------------------------------------
*------------------------------------------------------------------
    elseif ( p_pgmid       = 'R3TR'     ) and
           ( p_object_type = 'RSFO'     )     .

      perform           retrieve_desc_Formula
              using     p_rfc_selected
                        p_rfc_dest
                        p_object_name
              changing  p_object_desc.

*------------------------------------------------------------------
*---3. InfoPackages -----------------------------------------------
*------------------------------------------------------------------
    elseif p_pgmid       = 'R3TR' and
           p_object_type = 'ISIP'    .

      perform           retrieve_desc_infoPackage
              using     p_rfc_dest
                        p_object_name
              changing  p_object_desc.

*------------------------------------------------------------------
*---4. InfoPackage Events -----------------------------------------
*------------------------------------------------------------------
    elseif p_pgmid       = 'R3TR' and
           p_object_type = 'EVEN'    .

      perform           retrieve_desc_infoPkg_event
              using     p_rfc_dest
                        p_object_name
              changing  p_object_desc.

*------------------------------------------------------------------
*---5a. Process Chain Desc ----------------------------------------
*------------------------------------------------------------------
    elseif p_pgmid       = 'R3TR' and
           p_object_type = 'RSPC'    .

      perform           retrieve_desc_Process_Chain
              using     p_rfc_dest
                        p_object_name
              changing  p_object_desc.

*------------------------------------------------------------------
*---5b. Process Chain Trigger Desc          -----------------------
*------------------------------------------------------------------
    elseif p_pgmid       = 'R3TR' and
           p_object_type = 'RSPT'    .

      perform           retrieve_desc_PChain_Trigger
              using     p_rfc_dest
                        p_object_name
              changing  p_object_desc.

*------------------------------------------------------------------
*---5c. Process Chain Variant Desc          -----------------------
*------------------------------------------------------------------
    elseif p_pgmid       = 'R3TR' and
           p_object_type = 'RSPV'    .

      perform           retrieve_desc_PChain_Variant
              using     p_rfc_dest
                        p_object_name
              changing  p_object_desc.

*------------------------------------------------------------------
*---6. Update Rules -----------------------------------------------
*------------------------------------------------------------------
    elseif p_pgmid       = 'R3TR' and
           p_object_type = 'UPDR'    .

      perform           retrieve_desc_Update_Rule
              using     p_rfc_dest
                        p_object_name
              changing  p_object_desc.

*------------------------------------------------------------------
*---7. InfoObject - retrieve long description ---------------------
*------------------------------------------------------------------
    elseif p_pgmid       = 'R3TR' and
           p_object_type = 'IOBJ'    .

      perform           retrieve_desc_infoObject
              using     p_rfc_dest
                        p_object_name
              changing  p_object_desc.

*------------------------------------------------------------------
*---8. InfoCube and multiProviders - retrieve description ---------
*------------------------------------------------------------------
    elseif ( p_pgmid       = 'R3TR'    ) and
           ( p_object_type = 'CUBE' or
             p_object_type = 'MPRO'    )     .

      perform           retrieve_desc_infoCube_MP
              using     p_rfc_dest
                        p_object_name
              changing  p_object_desc.

*------------------------------------------------------------------
*---9. DSO - retrieve description  --------------------------------
*------------------------------------------------------------------
    elseif p_pgmid       = 'R3TR' and
           p_object_type = 'ODSO'    .

      perform           retrieve_desc_DSO
              using     p_rfc_dest
                        p_object_name
              changing  p_object_desc.

*------------------------------------------------------------------
*---10. Infoset - retrieve description  ---------------------------
*------------------------------------------------------------------
    elseif p_pgmid       = 'R3TR' and
           p_object_type = 'ISET'    .

      perform           retrieve_desc_infoSet
              using     p_rfc_dest
                        p_object_name
              changing  p_object_desc.

*------------------------------------------------------------------
*---11. Transformation  -------------------------------------------
*------------------------------------------------------------------
    elseif p_pgmid   = 'R3TR'  and
       p_object_type = 'TRFN'      .

      perform           retrieve_desc_Transformation
              using     p_rfc_dest
                        p_object_name
              changing  p_object_desc.

*------------------------------------------------------------------
*---12. Query Element - retrieve description ----------------------
*------------------------------------------------------------------
    elseif p_pgmid       = 'R3TR' and
           p_object_type = 'ELEM'    .

      perform           retrieve_desc_Query_Element
              using     p_rfc_dest
                        p_object_name
              changing  p_object_desc.

*------------------------------------------------------------------
*---13. Web Template - retrieve description -----------------------
*       - added 2/10/2011
*------------------------------------------------------------------
    elseif p_pgmid       = 'R3TR' and
           p_object_type = 'BTMP'    .

      perform           retrieve_desc_Web_template
              using     p_rfc_dest
                        p_object_name
              changing  p_object_desc.

*------------------------------------------------------------------
*---14. DTP - retrieve description --------------------------------
*------------------------------------------------------------------
    elseif p_pgmid       = 'R3TR' and
           p_object_type = 'DTPA'    .

      perform           retrieve_desc_DTP
              using     p_rfc_dest
                        p_object_name
              changing  p_object_desc.

*------------------------------------------------------------------
*---20. Aggregate - retrieve description     ----------------------
*------------------------------------------------------------------
    elseif p_pgmid       = 'R3TR' and
           p_object_type = 'AGGR'    .

      perform           retrieve_desc_AGGR
              using     p_rfc_dest
                        p_object_name
              changing  p_object_desc.

*------------------------------------------------------------------
*---25. Program - retrieve description       ----------------------
*------------------------------------------------------------------
    elseif ( p_pgmid       = 'R3TR' and
             p_object_type = 'PROG'     ) or
           ( p_pgmid       = 'LIMU' and
             p_object_type = 'REPS'     ).

      perform           retrieve_desc_PROG_Incl
              using     p_rfc_dest
                        p_object_name
              changing  p_object_desc.

*------------------------------------------------------------------
*---26. Program Variant - retrieve description       --------------
*------------------------------------------------------------------
    elseif p_pgmid       = 'LIMU' and
           p_object_type = 'VARX'     .

      perform           retrieve_desc_Variant
              using     p_rfc_dest
                        p_object_name
              changing  p_object_desc.

*------------------------------------------------------------------
*---27. Table - retrieve description         ----------------------
*------------------------------------------------------------------
    elseif p_pgmid       = 'R3TR' and
           p_object_type = 'TABU'     .

      perform           retrieve_desc_Table
              using     p_rfc_dest
                        p_object_name
              changing  p_object_desc.

*------------------------------------------------------------------
*---31. BSP Application - retrieve description         ------------
*------------------------------------------------------------------
    elseif p_pgmid       = 'LIMU' and
           p_object_type = 'WAPD'     .

      perform           retrieve_desc_BSP
              using     p_rfc_dest
                        p_object_name
              changing  p_object_desc.

*-----------------------------------------------------------------
*
*---99. xxxxxx - retrieve description ----------------------------
*------------------------------------------------------------------




    endif.

endform.    "retrieve_object_desc_single



***********************************************************************
* Retrieve the description of a single ROUTINE
*   - local or remote
***********************************************************************
form retrieve_desc_routine
              using     p_rfc_selected
                        p_rfc_dest
                        p_object_name
              changing  p_object_desc.

data:
  l_char512          like tab512    ,
  l_columns_tab      like RFC_DB_FLD
                     occurs 0       ,
  l_options_rec      like RFC_DB_OPT,
  l_options_tab      like RFC_DB_OPT
                     occurs 0       ,
  l_data_rec         like tab512    ,
  l_data_tab         like tab512
                     occurs 0       ,
  l_TROUTINE_rec     like RSTRANSTEPROUT,
  l_RSTRAN_rec       like RSTRAN    .


*-----1a. Routines - retrieve description locally -----------------
      if p_rfc_dest = space    or
         p_rfc_dest = p_rfcdev   .

        select single txtlg
               from   rsaroutt
               into   p_object_desc
               where  codeid  =  p_object_name
                 and  objvers = 'A'
                 and  langu   = 'EN'          .

*-------1b. Routine Desc. for transformation routines
*         - RSTRANSTEPROUT: routine ID -> Transformation ID + Rule ID
*         - RSTRANRULET: Transfm ID + Rule ID + A -> Routine desc.

*       Routine ID -> Transformation ID + Rule ID
        if p_object_desc is initial.

          clear         l_TROUTINE_rec.
          select single *
                 from   RSTRANSTEPROUT
                 into   l_TROUTINE_rec
                 where  CODEID  =  p_object_name
                   and  objvers = 'A'            .

*         retrieve text
          if l_TROUTINE_rec is initial.
          else.

            select single TXTLG
                   from   RSTRANRULET
                   into   p_object_desc
                   where  TRANID  = l_TROUTINE_rec-TRANID
                     and  RULEID  = l_TROUTINE_rec-RULEID
                     and  OBJVERS = 'A'.

          endif.

        endif.

*-------1c. Routine desc. for Start, End and other 'global' routines
*           - default to pre-defined descriptions (usability) below
*             rather than leaving blank
        if p_object_desc is initial.

          clear         l_RSTRAN_rec.
          select single *
                 from   RSTRAN
                 into   l_RSTRAN_rec
                 where  ( STARTROUTINE  = p_object_name or
                          ENDROUTINE    = p_object_name or
                          EXPERT        = p_object_name or
                          GLBCODE       = p_object_name or
                          GLBCODE2      = p_object_name    )
                   and  ( OBJVERS = 'A'                    ).

          if l_RSTRAN_rec-STARTROUTINE = p_object_name.
            p_object_desc = '(Start Routine)'.

          elseif l_RSTRAN_rec-ENDROUTINE = p_object_name.
            p_object_desc = '(End Routine)'.

          elseif l_RSTRAN_rec-EXPERT = p_object_name.
            p_object_desc = '(Expert Routine)'.

          elseif l_RSTRAN_rec-GLBCODE = p_object_name.
            p_object_desc = '(Global Definition)'.

          elseif l_RSTRAN_rec-GLBCODE2 = p_object_name.
            p_object_desc = '(Global Definition 2)'.

          endif.

        endif.

*-----1b & 1c. Routines - retrieve description remotely (QA or Prod)---
      else.

*       continue only if destination system selected and
*       RFC specified
        check ( p_rfc_dest     > space  and
                p_rfc_selected > space      ).

        refresh:  l_columns_tab,
                  l_options_tab,
                  l_data_tab   .
        l_char512 = 'TXTLG'.
        append l_char512 to l_columns_tab.

        concatenate 'CODEID = '''
                    p_object_name
                    ''' AND OBJVERS = ''A'' AND LANGU = ''EN'''
               into l_options_rec.
        append l_options_rec to l_options_tab.

        CALL FUNCTION 'RFC_READ_TABLE'
          destination p_rfc_dest
          EXPORTING
            QUERY_TABLE                = 'RSAROUTT'
          TABLES
            OPTIONS                    = l_options_tab
            FIELDS                     = l_columns_tab
            DATA                       = l_data_tab
          EXCEPTIONS
            TABLE_NOT_AVAILABLE        = 1
            TABLE_WITHOUT_DATA         = 2
            OPTION_NOT_VALID           = 3
            FIELD_NOT_VALID            = 4
            NOT_AUTHORIZED             = 5
            DATA_BUFFER_EXCEEDED       = 6
            OTHERS                     = 7
            .
        IF SY-SUBRC <> 0.
*       MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ELSE.
          loop at l_data_tab into l_data_rec.
            p_object_desc = l_data_rec.
            exit.
          endloop.
        ENDIF.

      endif.

endform.   "retrieve_desc_routine


***********************************************************************
* Retrieve the description of a single ROUTINE
*   - local or remote
***********************************************************************
form retrieve_desc_formula
              using     p_rfc_selected
                        p_rfc_dest
                        p_object_name
              changing  p_object_desc.

data:
  l_char512            like tab512    ,
  l_columns_tab        like RFC_DB_FLD
                       occurs 0       ,
  l_options_rec        like RFC_DB_OPT,
  l_options_tab        like RFC_DB_OPT
                       occurs 0       ,
  l_data_rec           like tab512    ,
  l_data_tab           like tab512
                       occurs 0       ,
  l_RFC_table          like DD02L-TABNAME.

statics:
  l_transformation_id  like RSTRANSTEPROUT-TRANID,
  l_rule_id            like RSTRANSTEPROUT-RULEID,
  l_rule_id_char(5)    type c                    .


*-----1. Formula - retrieve description locally ------------------
      if p_rfc_dest = p_rfcdev.

        clear: l_transformation_id,
               l_rule_id          ,
               l_rule_id_char     .

*       1a. text for 3.x formulas
        select single txtlg
               from   rsaformt
               into   p_object_desc
               where  formid  =  p_object_name
                 and  objvers = 'A'
                 and  langu   = 'EN'.

*       1b. text not found so far, second source for 7.0 formula
        if p_object_desc is initial.

          select single TRANID RULEID
                 from   RSTRANSTEPROUT
                 into   (l_transformation_id,
                         l_rule_id           )
                 where  CODEID = p_object_name
                   and  OBJVERS = 'A'.

          if l_transformation_id is initial.
          else.
            select single TXTLG
                   from   RSTRANRULET
                   into   p_object_desc
                   where  LANGU   = 'EN'
                     and  TRANID  = l_transformation_id
                     and  RULEID  = l_rule_id
                     and  OBJVERS = 'A'.
          endif.

        endif.

*-----2. Formula - retrieve description CMG & PMG --------------
      else. "if p_rfc_desc = space.

*       2a. retrieve 3.x formula text
          check ( p_rfc_dest     > space  and
                  p_rfc_selected > space      ).

          refresh:  l_columns_tab,
                    l_options_tab,
                    l_data_tab   .
          l_char512 = 'TXTLG'.
          append l_char512 to l_columns_tab.

          if l_transformation_id is initial.

            l_RFC_table = 'RSAFORMT'.

            concatenate 'FORMID = '''
                        p_object_name
                        ''' AND OBJVERS = ''A'' AND LANGU = ''EN'''
                   into l_options_rec.
            append l_options_rec to l_options_tab.

*       2a. retrieve 7.0 formula text
*           ***NOT WORKING***
*              Transformation ID in Dev, QA and PRD are different
*              cannot retrieve text with available 'key'
*              *possibly add in the future*
          else.

*            l_RFC_table    = 'RSTRANRULET'.
*            l_rule_id_char = l_rule_id    .
*
*            concatenate 'TRANID = '''
*                        l_transformation_id
*                        ''' AND RULEID = '''
*                        l_rule_id_char
*                        ''''
*                   into l_options_rec.
*            append l_options_rec to l_options_tab.
*
*            concatenate ' AND OBJVERS = ''A'' '
*                        ' AND LANGU = ''EN'''
*                   into l_options_rec.
*            append l_options_rec to l_options_tab.

          endif.

          CALL FUNCTION 'RFC_READ_TABLE'
              destination p_rfc_dest
            EXPORTING
                QUERY_TABLE                = l_RFC_table
            TABLES
                OPTIONS                    = l_options_tab
                FIELDS                     = l_columns_tab
                DATA                       = l_data_tab
            EXCEPTIONS
                TABLE_NOT_AVAILABLE        = 1
                TABLE_WITHOUT_DATA         = 2
                OPTION_NOT_VALID           = 3
                FIELD_NOT_VALID            = 4
                NOT_AUTHORIZED             = 5
                DATA_BUFFER_EXCEEDED       = 6
                OTHERS                     = 7
                .



        IF SY-SUBRC <> 0.
*       MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ELSE.
          loop at l_data_tab into l_data_rec.
            p_object_desc = l_data_rec.
            exit.
          endloop.
        ENDIF.

      endif.

endform.   "retrieve_desc_formula


***********************************************************************
* Retrieve the description of a single InfoPackage (only locally)
***********************************************************************
form retrieve_desc_infoPackage
              using     p_rfc_dest
                        p_object_name
              changing  p_object_desc.


      if p_rfc_dest = p_rfcdev.

        clear           p_object_desc.
        select single   TEXT
                 from   rsldpiot
                 into   p_object_desc
                 where  logdpid = p_object_name
                   and  objvers = 'A'
                   and  langu   = 'EN'.

      endif.

endform.    "retrieve_desc_infoPackage


***********************************************************************
* Retrieve the description of a single InfoPackage Event (only locally)
***********************************************************************
form retrieve_desc_infoPkg_event
              using     p_rfc_dest
                        p_object_name
              changing  p_object_desc.


      if p_rfc_dest = p_rfcdev.

        clear           p_object_desc.
        select single   TXTLG
                 from   rseventheadt
                 into   p_object_desc
                 where  chain_id = p_object_name
                   and  objvers = 'A'
                   and  langu   = 'EN'.

      endif.

endform.   "retrieve_desc_infoPackage_event


***********************************************************************
* Retrieve the description of a single Process Chain (only locally)
***********************************************************************
form retrieve_desc_Process_Chain
              using     p_rfc_dest
                        p_object_name
              changing  p_object_desc.


      if p_rfc_dest = p_rfcdev.

        clear           p_object_desc.
        select single   TXTLG
                 from   RSPCCHAINT
                 into   p_object_desc
                 where  chain_id = p_object_name
                   and  objvers = 'A'
                   and  langu   = 'EN'.

      endif.

endform.   "retrieve_desc_Process_Chain


***********************************************************************
* Retrieve the description of a single Process Chain Trigger (locally)
***********************************************************************
form retrieve_desc_PChain_Trigger
              using     p_rfc_dest
                        p_object_name
              changing  p_object_desc.


      if p_rfc_dest = p_rfcdev.

        clear           p_object_desc.
        select single   TXTLG
                 from   RSPCTRIGGERT
                 into   p_object_desc
                 where  variante = p_object_name
                   and  objvers = 'A'
                   and  langu   = 'EN'.

      endif.

endform.   "retrieve_desc_PChain_Trigger


***********************************************************************
* Retrieve the description of a single Process Chain Variant (locally)
***********************************************************************
form retrieve_desc_PChain_Variant
              using     p_rfc_dest
                        p_object_name
              changing  p_object_desc.

  data: l_PCV_text_rec   like RSPCVARIANTT         ,
        l_variant_type   like rspcvariantt-type    ,
        l_variant        like rspcvariantt-variante.


      l_variant_type = p_object_name+0(10).
      l_variant      = p_object_name+10   .

      if p_rfc_dest = p_rfcdev.

        clear           p_object_desc.
        select single   TXTLG
                 from   RSPCVARIANTT
                 into   p_object_desc
                 where  type     = l_variant_type
                   and  variante = l_variant
                   and  objvers  = 'A'
                   and  langu    = 'EN'.

      endif.

endform.   "retrieve_desc_PChain_Variant


***********************************************************************
* Retrieve the description of a single Update Rule (only locally)
***********************************************************************
form retrieve_desc_Update_Rule
              using     p_rfc_dest
                        p_object_name
              changing  p_object_desc.


  data:
      l_rsupdinfo_rec   like rsupdinfo.

      if p_rfc_dest = p_rfcdev.

        clear l_rsupdinfo_rec.
        select single  *
               from    rsupdinfo
               into    l_rsupdinfo_rec
               where   updid   = p_object_name
                 and   objvers = 'A'.
        if sy-subrc = 0.

          concatenate         l_rsupdinfo_rec-infocube
                              '<-'
                              l_rsupdinfo_rec-isource
                 into         p_object_desc
                 separated by space.

         endif.

       endif.

endform.   "retrieve_desc_Update_Rule


***********************************************************************
* Retrieve the description of a single infoObject (only locally)
***********************************************************************
form retrieve_desc_infoObject
              using     p_rfc_dest
                        p_object_name
              changing  p_object_desc.




      if p_rfc_dest = p_rfcdev.

        clear          p_object_desc.
        select single  TXTLG
               from    rsdiobjt
               into    p_object_desc
               where   iobjnm  = p_object_name
                 and   objvers = 'A'
                 and   langu   = 'EN'.

      endif.

endform.   "retrieve_desc_infoObject


***********************************************************************
* Retrieve the description of a single infoCube or multiProcider (local)
***********************************************************************
form retrieve_desc_infoCube_MP
              using     p_rfc_dest
                        p_object_name
              changing  p_object_desc.


      clear p_object_desc.
      if p_rfc_dest = p_rfcdev.

        select single  TXTLG
               from    rsdcubet
               into    p_object_desc
               where   infocube  = p_object_name
                 and   objvers   = 'A'
                 and   langu     = 'EN'.

      endif.

endform.   "retrieve_desc_infoCube_MP



***********************************************************************
* Retrieve the description of a single DSO (only locally)
***********************************************************************
form retrieve_desc_DSO
              using     p_rfc_dest
                        p_object_name
              changing  p_object_desc.



      if p_rfc_dest = p_rfcdev.

        clear          p_object_desc.
        select single  TXTLG
               from    rsdodsot
               into    p_object_desc
               where   ODSOBJECT = p_object_name
                 and   objvers   = 'A'
                 and   langu     = 'EN'.

      endif.

endform.   "retrieve_desc_DSO


***********************************************************************
* Retrieve the description of a single infoSet (only locally)
***********************************************************************
form retrieve_desc_infoSet
              using     p_rfc_dest
                        p_object_name
              changing  p_object_desc.



      if p_rfc_dest = p_rfcdev.

        clear          p_object_desc.
        select single  TXTLG
               from    RSQISETT
               into    p_object_desc
               where   INFOSET = p_object_name
                 and   objvers   = 'A'
                 and   langu     = 'EN'.

      endif.

endform.   "retrieve_desc_infoSet



***********************************************************************
* Retrieve the description of a single Transformation (only locally)
***********************************************************************
form retrieve_desc_Transformation
              using     p_rfc_dest
                        p_object_name
              changing  p_object_desc.


  data:
    l_RSTRAN_rec       like RSTRAN    .


      if p_rfc_dest = p_rfcdev.

        clear          l_rstran_rec.
        select single  *
               from    rstran
               into    l_rstran_rec
               where   TRANID = p_object_name
                 and   objvers   = 'A'.

        if sy-subrc = 0.
          concatenate     l_rstran_rec-sourcetype
*                         ' '
                          l_rstran_rec-sourcename
                          '->'
                          l_rstran_rec-targettype
*                         ' '
                          l_rstran_rec-targetname
                 into    p_object_desc
            separated by space.

        endif.

      endif.

endform.   "retrieve_desc_Transformation



***********************************************************************
* Retrieve the description of a Query Elements (only locally)
*   - plus Type and Detail info
*&---------------------------------------------------------------------*
*& Query Elements:
*&   1. Definition type of an element
*&      NIL	No definition
*&      REP	Query
*&      SOB	Filter
*&      VAR	Variable
*&      STR	Structure
*&      SEL	Restricted Key Figure
*&      CKF	Calculated key figure
*&      FML	Formula
*&   2. Detailed Information for DEFTP (Specialization for SEL)
*&      RKF	Restricted Key Figure
*&      CON	Condition
*&      EXC	Exception
*&      SOB	Selection object
*&      CHA	Restricted Characteristic
*&      CEL	Cell
***********************************************************************
form retrieve_desc_Query_Element
              using     p_rfc_dest
                        p_object_name
              changing  p_object_desc.


  data:
    l_RSZELTDIR_rec   like RSZELTDIR,
    l_RSZELTTXT_rec   like RSZELTTXT.


      if p_rfc_dest = p_rfcdev.

        clear: l_RSZELTDIR_rec,
               l_RSZELTTXT_rec.

*       added Query Element type                     +KCC 02/16/06
        select single  *
               from    RSZELTDIR
               into    l_RSZELTDIR_rec
               where   eltuid    = p_object_name
                 and   objvers   = 'A'          .

        select single  *
               from    RSZELTTXT
               into    l_RSZELTTXT_rec
               where   eltuid    = p_object_name
                 and   objvers   = 'A'
                 and   langu     = 'EN'.

*&   1. Definition type of an element
*&      NIL	No definition
*&      REP	Query
*&      SOB	Filter
*&      VAR	Variable
*&      STR	Structure
*&      SEL	Restricted Key Figure
*&      CKF	Calculated key figure
*&      FML	Formula

*       display type if desc not available
        if l_RSZELTTXT_rec-txtlg is initial.

          case l_RSZELTDIR_rec-DEFTP.
            when 'NIL'. concatenate l_RSZELTTXT_rec-txtlg
                                    '    (No definition / '
                               into l_RSZELTTXT_rec-txtlg.
            when 'REP'. concatenate l_RSZELTTXT_rec-txtlg
                                    '    (Query / '
                               into l_RSZELTTXT_rec-txtlg.
            when 'SOB'. concatenate l_RSZELTTXT_rec-txtlg
                                    '    (Filter / '
                               into l_RSZELTTXT_rec-txtlg.
            when 'VAR'. concatenate l_RSZELTTXT_rec-txtlg
                                    '    (Variable / '
                               into l_RSZELTTXT_rec-txtlg.
            when 'STR'. concatenate l_RSZELTTXT_rec-txtlg
                                    '    (Structure / '
                               into l_RSZELTTXT_rec-txtlg.
            when 'SEL'. concatenate l_RSZELTTXT_rec-txtlg
                                    '    (Restricted KF / '
                               into l_RSZELTTXT_rec-txtlg.
            when 'CKF'. concatenate l_RSZELTTXT_rec-txtlg
                                    '    (Calculated KF / '
                               into l_RSZELTTXT_rec-txtlg.
            when 'FML'. concatenate l_RSZELTTXT_rec-txtlg
                                    '    (Formula / '
                               into l_RSZELTTXT_rec-txtlg.
          endcase.

*&   2. Detailed Information for DEFTP (Specialization for SEL)
*&      RKF	Restricted Key Figure
*&      CON	Condition
*&      EXC	Exception
*&      SOB	Selection object
*&      CHA	Restricted Characteristic
*&      CEL	Cell
          case l_RSZELTDIR_rec-SUBDEFTP.
            when 'RKF'. concatenate l_RSZELTTXT_rec-txtlg
                                    ' Restricted KF) '
                               into l_RSZELTTXT_rec-txtlg.
            when 'CON'. concatenate l_RSZELTTXT_rec-txtlg
                                    ' Condition) '
                               into l_RSZELTTXT_rec-txtlg.
            when 'EXC'. concatenate l_RSZELTTXT_rec-txtlg
                                    ' Exception) '
                               into l_RSZELTTXT_rec-txtlg.
            when 'SOB'. concatenate l_RSZELTTXT_rec-txtlg
                                    ' Selection object) '
                               into l_RSZELTTXT_rec-txtlg.
            when 'CHA'. concatenate l_RSZELTTXT_rec-txtlg
                                    ' Restricted Char.) '
                               into l_RSZELTTXT_rec-txtlg.
            when 'CEL'. concatenate l_RSZELTTXT_rec-txtlg
                                    ' Cell) '
                               into l_RSZELTTXT_rec-txtlg.
          endcase.

        endif.

        "if sy-subrc = 0.
          concatenate l_RSZELTDIR_rec-DEFTP
                      '/'
                      l_RSZELTDIR_rec-SUBDEFTP
                      '/'
                      l_RSZELTTXT_rec-txtlg
                 into p_object_desc
                 separated by space        .

        "endif.

      endif.

endform.   "retrieve_desc_Query_Element


***********************************************************************
* Retrieve the description of a single Web Template (only locally)
***********************************************************************
form retrieve_desc_Web_Template
              using     p_rfc_dest
                        p_object_name
              changing  p_object_desc.



      if p_rfc_dest = p_rfcdev.

        clear          p_object_desc.
        select single  TXTLG
               from    RSZWBTMPHEADTXT
               into    p_object_desc
               where   OBJID     = p_object_name
                 and   objvers   = 'A'
                 and   langu     = 'EN'.

      endif.

endform.   "retrieve_desc_Web_Template



***********************************************************************
* Retrieve the description of a single DTP (only locally)
***********************************************************************
form retrieve_desc_DTP
              using     p_rfc_dest
                        p_object_name
              changing  p_object_desc.



      if p_rfc_dest = p_rfcdev.

        clear          p_object_desc.
        select single  txtlg
               from    RSBKDTPTH    "Texts on Data Transfer Processes
               into    p_object_desc
               where   DTP       = p_object_name
                 and   langu     = 'EN'         .

      endif.

endform.   "retrieve_desc_DTP


***********************************************************************
* Retrieve the description of a single Aggregate (only locally)
***********************************************************************
form retrieve_desc_AGGR
              using     p_rfc_dest
                        p_object_name
              changing  p_object_desc.



      if p_rfc_dest = p_rfcdev.

        clear          p_object_desc.
        select single  txtlg
               from    RSDDAGGRT    "Aggregate texts
               into    p_object_desc
               where   AGGRUID   = p_object_name
                 and   langu     = 'EN'
                 and   objvers   = 'A'.

      endif.

endform.   "retrieve_desc_AGGR


***********************************************************************
* Retrieve the description of a single Program (only locally)
***********************************************************************
form retrieve_desc_PROG_Incl
              using     p_rfc_dest
                        p_object_name
              changing  p_object_desc.


      if p_rfc_dest = p_rfcdev.

        clear          p_object_desc.
        select single  text
               from    TRDIRT       "Title texts for programs in TRDIR
               into    p_object_desc
               where   NAME      = p_object_name
                 and   SPRSL     = 'EN'.

      endif.

endform.   "retrieve_desc_PROG_Incl


***********************************************************************
* Retrieve the description of a Program Variant (only locally)
***********************************************************************
form retrieve_desc_Variant
              using     p_rfc_dest
                        p_object_name
              changing  p_object_desc.


      if p_rfc_dest = p_rfcdev.

        clear          p_object_desc.
        select single  VTEXT
               from    VARIT       "Variant Texts
               into    p_object_desc
               where   REPORT    = p_object_name
                 and   LANGU     = 'EN'.

      endif.

endform.   "retrieve_desc_Variant


***********************************************************************
* Retrieve the description of a single Table (only locally)
***********************************************************************
form retrieve_desc_Table
              using     p_rfc_dest
                        p_object_name
              changing  p_object_desc.


      if p_rfc_dest = p_rfcdev.

        clear          p_object_desc.
        select single  ddtext
               from    DD02T       "SAP DD: SAP Table Texts
               into    p_object_desc
               where   TABNAME     = p_object_name
                 and   DDLANGUAGE  = 'EN'.

      endif.

endform.   "retrieve_desc_Table


***********************************************************************
* Retrieve the description of a single BSP Appl. (only locally)
***********************************************************************
form retrieve_desc_BSP
              using     p_rfc_dest
                        p_object_name
              changing  p_object_desc.


      if p_rfc_dest = p_rfcdev.

        clear          p_object_desc.
        select single  TEXT
               from    O2APPLT       "O2: BSP Application Texts
               into    p_object_desc
               where   APPLNAME     = p_object_name
                 and   LANGU        = 'EN'.

      endif.

endform.   "retrieve_desc_BSP


***********************************************************************
* Retrieve the description of a single xxxxx (only locally)
*   - TEMPLATE for additional objects to support
***********************************************************************
form retrieve_desc_XXX
              using     p_rfc_dest
                        p_object_name
              changing  p_object_desc.


      if p_rfc_dest = p_rfcdev.

        clear          p_object_desc.
*        select single  xxxxxx
*               from    XXXXXX       "xxxxx Texts
*               into    p_object_desc
*               where   TABNAME     = p_object_name
*                 and   DDLANGUAGE  = 'EN'.

      endif.

endform.   "retrieve_desc_XXX