‎2014 Jun 30 7:01 PM
Hello,
I'll explain this question in 2 parts , the general idea and it's intents
I've been trying to do some dynamic coding and I still didn't manage a way to find out a variable name at runtime.
I wanted to pass the variable into a method/subroutine and find out what is the variable name along with some other properties:
o_dynsel->add_select_option( s_matnr[] ).
Here's the idea:
While using the dynamic selection FM's (FREE_SELECTION_INIT), I wanted to map the select-options I have on screen to their corresponding fields inside the function. This can be achieved If:
Plus, I wanted to do this as generic as possible.
I could do this using a text with the variable name:
o_dynsel->add_select_option( i_selop = 'S_MATNR'
i_ref_field = 'MARA-MATNR' ).
But I simply don't like it that way(plus, I can always get spelling errors! )
‎2014 Jul 01 11:02 AM
You will only have access to actual parameter, not that format parameter.
If the variable name is not being passed, you can read the call stack , read the code where it was called, and then do string manipulation to get the variable name.
Look at this snippet where method is able to return the names select-options being passed.
/.
‎2014 Jul 01 11:02 AM
You will only have access to actual parameter, not that format parameter.
If the variable name is not being passed, you can read the call stack , read the code where it was called, and then do string manipulation to get the variable name.
Look at this snippet where method is able to return the names select-options being passed.
/.