cancel
Showing results for 
Search instead for 
Did you mean: 

how to generate dynamic selection-screen based on internal table and alv display

former_member565266
Participant
0 Kudos

Hi Experts,

Hope you are all doing good!

I have a internal table with all fields and data. Now I want to generate a selection screen dynamically. I want to create a select-option for every field of the table.

Please suggest me with the sample code. am new to this logic.

Could you please anyone help me on this ASAP.

Sandra_Rossi
Active Contributor

DATA struc TYPE zyourtable.

SELECT-OPTIONS p_field1 FOR struc-field1.

Repeat the last line for every field of ZYOURTABLE.

loyd_enochs3
Participant

If the itab is already defined, then the selection screen can be defined as Sandra describes above. Case closed (and ABAP 101 topic).

However, if the itab is being defined dynamically, than the selection screen will probably have to be defined in the screen painter using the same rules. I would imagine a data entry field for each possible data field would be created on the screen and then use the PBO code to set the non-desired fields to invisible or output only.

But if the itab is being defined dynamically, what drives THAT process? Those rules would seem to have an enormous impact on the dynamic creation of the selection screen.

Unfortunately, the answers to those questions come from the design specifications of the task, and those are not available for review here.

SimoneMilesi
Active Contributor

I think Satish wants to generate a selection screen based on ddic without declaring all the fields like per Sandra's suggestion.

It's possible, I remember a couple of transactions doing it (maybe /AIF/ERR ?), but i do not think it's worth of it.

Accepted Solutions (1)

Accepted Solutions (1)

DoanManhQuynh
Active Contributor

Well, from internal table I can think about 2 ways to dynamically generate selection screen:

1. Using program generation technical with key word: INSERT REPORT, INSERT TEXTPOOL...go and search about it, but it side-affect is poor performance so not really recomended.

2. Using Free Selection (orr Dynamic Selection): read more here:

https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abenfree_selection_abexa.htm

Answers (0)