Is it possible to programatically interrogate the fields of a screen (selection screen) of a given program in order to get their types?

StackOverflow https://stackoverflow.com/questions/18130838

  •  24-06-2022
  •  | 
  •  

Question

I have a list of programs whose selection screens variants I would like to check for hardcoded values of parameters of type BUKRS.

The function module RS_VARIANT_CONTENTS does almost all of the job, in that for a given variant and program, it returns a list of the values filled in that variant.

Unfortunately it doesn't return the types of those parameters, only their values. Thus I figure I need an additional check, namely for the type of the parameter defined in the screen.

Now I realize that the keyword PARAMETERS defines both a screen field and a data object in the current program, the type of either of those would be of great help (being obviously the same). This is of course in the happy case where I even have a PARAMETERS data object defined, and not a SELECT-OPTIONS.

I have also come across function module DYNPRO_FIELD_GET which gives me the screen fields, as defined in the selection screen, but again, no help with the types.... So yeah, any help would be appreciated.

I have even found a FuBa called GET_DICTIONARY_FIELDS which promised to give me exactly what i wanted: a list of all the variables in a program, which I could then corroborate with the list given by RS_VARIANT_CONTENTS to get the information I wanted - unfortunately in the version of my system, it's inactive.

[EDIT]

It should be noted that RS_SELSCREEN_INFO returns the types of the data objects as defined in the program with their respective statements. For example for:

DATA gv_asdfg TYPE mara-matnr.

it returns MARA-MATNR. Of course the name of the table field is no indication of the name of the data element, so:

In order to get the domain for these types one could use CL_ABAP_DATADESCR=>DESCRIBE_BY_NAME( ) and provide the types given by RS_SELSCREEN_INFO. For the resulting object, the property one should look for is ->ABSOLUTE_NAME. In my case, the condition is ...->ABSOLUTE_NAME = '\TYPE=BUKRS'.

Was it helpful?

Solution

You could try to use the function module RS_SELSCREEN_INFO. Given a report name, it will return a list of the parameters and select options along with the DDIC reference information, if set.

OTHER TIPS

Althouth vwegert's answer actually did the complete trick, i've also found 2 function modules that help a lot.

These are GET_GLOBAL_SYMBOLS - this returns the global variables of a program. It works for variables defined by DATA and PARAMETERS but it fails to work for SELECT-OPTIONS.

The other one is GET_COMPONENT_LIST - this could be used to get the elementary data types of the variables declared with SELECT-OPTIONS.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top