List the environment variables used in a program

By | February 28, 2012 | Utilities | 5,184 | 3

In SAP, there is a standard way to list the environment variables used in a program. It’s accessible through transaction SE38, via Menu-Utilities-Environment variables. In SAP forums, I have seen lot of questions about doing this through custom program.

It’s very hard to analyze this logic through standard debugging to know what is written behind to obtain the values. When debugged there were lot of classes and functions involved to form the list. Later after some more research I found a function REPOSITORY_ENVIRONMENT_SET_RFC which provides the result very easily.

Other than this there is also a function REPOSITORY_ENVIRONMENT_ALL which has a parameter called “DEEP” for deep search. The function group “SEUA” has the list of functions under this category.

Below program demonstrates an example of how to list the data elements and function modules used in a program. The list of objects that can be included for display are mentioned in the below code.

Environment variables of the Program

 
REPORT ylist_environment.
 
PARAMETERS:pa_prog TYPE tadir-obj_name.
 
DATA: environment_selection TYPE envi_types,
      source_searched TYPE TABLE OF rsfind,
      output_list TYPE TABLE OF senvi.
 
START-OF-SELECTION.
 
  environment_selection-prog = ' '. "Program
  environment_selection-fugr = ' '. "Function group
  environment_selection-ldba = ' '. "Logical database
  environment_selection-msag = ' '. "Message class
  environment_selection-tran = ' '. "Transaction
  environment_selection-func = 'X'. "Function module
  environment_selection-dial = ' '. "Dialog module
  environment_selection-tabl = ' '. "Database tables
  environment_selection-shlp = ' '. "Search Help
  environment_selection-doma = ' '. "Domain
  environment_selection-dtel = 'X'. "Data element
  environment_selection-view = ' '. "View
  environment_selection-mcob = ' '. "Matchcode object
  environment_selection-mcid = ' '. "Matchcode ID
  environment_selection-para = ' '. "SET/GET parameters
  environment_selection-conv = ' '. "Conversion exit
  environment_selection-suso = ' '. "Authorization objects
  environment_selection-type = ' '. "Type groups
  environment_selection-ttyp = ' '. "Table types
  environment_selection-stru = ' '. "Structure
  environment_selection-enqu = ' '. "Lock object
  environment_selection-sqlt = ' '. "SQL tables
  environment_selection-clas = ' '. "Class
  environment_selection-intf = ' '. "Interfaces
  environment_selection-udmo = ' '. "Data model
  environment_selection-ueno = ' '. "Entity type
  environment_selection-shi3 = ' '. "Area menu
  environment_selection-cntx = ' '. "Context
  environment_selection-ttab = ' '. "Table types
 
  CALL FUNCTION 'REPOSITORY_ENVIRONMENT_SET_RFC'
    EXPORTING
      obj_type          = 'PROG'
      environment_types = environment_selection
      object_name       = pa_prog
    TABLES
      environment       = output_list
      source_objects    = source_searched.
 
 

Like It? Share!!

Don't miss an Update

Get notified of the new post, right into your inbox

Kesavadas Thekkillath{3 articles}

Working with AtoS as Systems Analyst. I love coding in ABAP & OO ABAP. Top Contributor in SCN Community Network

Explore all of his 3 articles.

Load comments

3 Comments

  • Amol Bandal

    Really Good Web for ABAP….

  • Tony

    Can you give an example to show how to use the progarm, i have tried many times,but failed! Thanks and expect you reply.

  • Hello Tony,

    If you want to find out what dictionary objects are used in your program, you can call this code snippet to find out them.

    If you still have issues, please provide your code where you are facing the issue.

    Regards,
    Naimesh Patel

Comments on this Post are now closed. If you have something important to share, you can always contact me.

You seem to be new here. Subscribe to stay connected.