‎2021 Feb 09 9:47 AM
Hi Experts!
My aim is to dynamically display the key fields of the table in a selection screen after entering a table name.
The mandate should not be shown.
Here are two examples:

Here all the three key fields (carrid, connid & date) of table sflight should be displayed.

At VBAK it only would be one key field (vbeln).
Does anyone has any idea on how i could implement this?
Thanks!
‎2021 Feb 09 12:28 PM
Ok, if you absolutely no idea why on earth you would have such a requirement, but I'll try and think along.
If the list of tables for which your program needs to work is known, and limited, I would create a dropdown for the table and separate selection blocks per table. That way you can show/hide those blocks depending on what table is chosen.
If this somehow has to work for all tables, then you have the option to generate a new report at runtime using the statement below.
INSERT REPORT <prog> FROM <program_table>.For documentation see here: abapdocu
If neither option is to your liking, I'd suggest you take a look at how a transaction like SE16n works. That way you don't have to reinvent the wheel, but it'll require some debugging of standard code..
Also, I found that you can create parameters dynamically according to the abap docu, but the same isn't mentionned for select-options.
‎2021 Feb 09 12:28 PM
Ok, if you absolutely no idea why on earth you would have such a requirement, but I'll try and think along.
If the list of tables for which your program needs to work is known, and limited, I would create a dropdown for the table and separate selection blocks per table. That way you can show/hide those blocks depending on what table is chosen.
If this somehow has to work for all tables, then you have the option to generate a new report at runtime using the statement below.
INSERT REPORT <prog> FROM <program_table>.For documentation see here: abapdocu
If neither option is to your liking, I'd suggest you take a look at how a transaction like SE16n works. That way you don't have to reinvent the wheel, but it'll require some debugging of standard code..
Also, I found that you can create parameters dynamically according to the abap docu, but the same isn't mentionned for select-options.
‎2021 Feb 09 12:30 PM
Hello Marlon,
You may try to use the Function modules FREE_SELECTIONS_INIT and FREE_SELECTIONS_DIALOG for this purpose.
Hope that helps.
Thanks,
Ahana
‎2021 Feb 09 12:35 PM
Hello lbldraw427
It's not possible to have the selection screen created dynamically. You either have to have a predefined set of parameters like pvnierop suggests, or use a function like ahana.sengupta suggests.
To have the selection screen dynamic you need to regenerate it every time a user selects a different table. This is also how SE16 works - it regenerates the program every time different selection criteria fields are selected.
Kind regards,
Mateusz