Hi All,
Can we add dynamic columns in a table control? The requirement is something like this. When the user clicks a button it should add a column to the table. Also is it possible for the same column to refer to different fields of the Internal Table of the Database table. Example. The first row in the table control must refer to MARA-MATNR and the second row must refer to MAKT-MAKTX.
Regards,
Sudhindra
This is much easier to do, using ALV approach. Let us know, if you have any particular reasons to choose Table Control over ALV.
<b>Your Requirements</b>:
a) <b>Add a column on pressing a button</b>
In the user command, make change the parameter NO_OUT to space, for that particular field in the field catalog.
b) <b>Same column to refer to different fields of Internal table of database table</b>
Change Row sequence in fieldcatalog
(In this case, what information you have given and the example you have quoted is no way related/I have not understood).
If you need to use table control, you might have to generate programs with dynpros. There are some Function Modules available, however, I feel that it things get just more complicated.
Regards,
Subramanian V.
Hello Sudhindra,
If you know all the columns that the table control will ever contain, then I suppose it is possible to add and delete the columns dynamically.
What cannot be dynamic, is the determination of which coulmn would be displayed in the table control.
To elaborate, In SE51, you have to define the table control with all the possible columns. In the program, during the PBO, you can choose to hide some of these columns. When the user performs certain action (PAI), you can determine which opf the hidden columns would be displayed in the table control after the next PBO.
Coming to your second requirement, I don't think it is directly possible in case of table conrols. You will have to do some manipulation to achieve it. But even if you can I think you should not. Because, It is not elegant from a good-UI design perspective. ANd during the course of the necessary manipulations, we might have to forgo some of the features like Automatic Field Validation, Automatic Input Help etc. You can use ALV for the same.
Please be judicious in deciding which approach to consider and if you run into some more problems, please do get back with some more details like how many columns you have, how many different row-types do you want, what are the features for the fields that you wish to provide (eg. F4 help) an so on...
Regards,
Anand Mandalika.
Add a comment