‎2016 Aug 30 10:14 AM
Hi,
I have created a program which generates a selection screen dynamically and then runs it via submit.
I would like to get the technical information of a parameter at runtime in the called program.
For exapmle: The technical information I want for P_123 is SPFLI-CONNID.
I do not want the RTTI method describe_by_data solution, as it returns only the absolute_name, type_kind (C), length(16), decimals(0), which is not useful to me. I need smth like the F1 help, TABLENAME-FIELD.
Is there any function to do this? Or some FIND FIRST OCCURRENCE OF p_123 IN (top_include instead of table)?
Thank you guys!
BR,
Matei
‎2016 Aug 30 11:02 AM
Hello,
At runtime your P_123 has the type S_CONN_ID (data element from the ABAP Dictionary) and that is returned by the RTTI.
Why do you need to know more? Normally, it is not relevant how the type was defined, but what the type is.
If you really need to know how it was defined, let' say by "TYPE spfli-connid" or by "TYPE s_conn_id" or ..., I'm afraid you have in fact to do some static code analysis, something like
READ REPORT top_include INTO prog.
CONCATENATE LINES OF prog INTO str.
CONDENSE str.
FIND REGEX 'p_123 TYPE (...)' IN str IGNORING CASE SUBMATCHES ...
or use the SCAN command or ...
Horst
‎2016 Aug 30 11:02 AM
Hello,
At runtime your P_123 has the type S_CONN_ID (data element from the ABAP Dictionary) and that is returned by the RTTI.
Why do you need to know more? Normally, it is not relevant how the type was defined, but what the type is.
If you really need to know how it was defined, let' say by "TYPE spfli-connid" or by "TYPE s_conn_id" or ..., I'm afraid you have in fact to do some static code analysis, something like
READ REPORT top_include INTO prog.
CONCATENATE LINES OF prog INTO str.
CONDENSE str.
FIND REGEX 'p_123 TYPE (...)' IN str IGNORING CASE SUBMATCHES ...
or use the SCAN command or ...
Horst
‎2016 Aug 30 11:21 AM
Thank you for your quick answer Horst,
I already started debugging to see what happens at F1 help Was also useful
I need to know the tablename and the field of the parameter as they are in the F1 help, because I need to save them in a database which contains a rsparams kind of structure.
For example: I EQ MARA MATNR 1000036
I EQ MARC WERKS 1000 ...
These will be used later in order to update those fields.
I will test your solution in a few moments.
Thank you again!
‎2016 Aug 30 11:38 AM
I also started debugging F1 and also played with CALL FUNCTION 'DYNPRO_FIELD_GET' ....
In fact, somewhere there must be a function module that fills the structure that is used for the technical information after F1. Some more debugging should find it. In the end, I guess better than my above "solution".
Above I forgot that it is about Dynpro-Fields, where the relevant information is in fact stored somewhere. This is different to pure ABAP fields, where you don't have the information.
‎2016 Aug 30 1:22 PM
There are a few function modules (not released) to retrieve selection screen parameters and their "ddic type". For instance, RS_REPORTSELECTSCREEN_INFO, SELOPTS_AND_PARAMS. RTTI does not retain the table/structure and component, only the underlying type (data element S_CONN_ID in your case)
‎2016 Aug 30 1:29 PM
‎2016 Aug 31 12:51 PM
You may use the secret help-id statement:
DATA: lv_help_id TYPE string.
DESCRIBE FIELD p_123 HELP-ID lv_help_id.
‎2016 Aug 31 1:06 PM
Yes, that should do it.
And not secret. There's even an example under DESCRIBE FIELD.
I thought that would return the name of the DE too, but no it doesn't.
Give the points to Shai, no wait, I'm close to diamond ...
‎2016 Aug 31 1:39 PM
Horst Keller wrote:
I thought that would return the name of the DE too, but no it doesn't.
That's the reason it's secret...