Skip to Content
author's profile photo Former Member
Former Member

Adding dynamic columns in Table Control

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2005 at 05:23 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      You can use ALV for input purpose as well. Check out OO ALV programs. SE38 -> BCAlVEDIT* , tons of programs available.

      a) Input from user - In ALV, this is possible

      b) F4 help - Possible with ALV

      Not sure why would you need material number and description in the same column and that too one below another. It is possible with lot of tweaking but still requirement is strange and you need to have at least two rows for the same MATNR, one with the number and other with description.

      Regards,

      Subramanian V.

  • author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2005 at 06:16 AM

    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
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Shehryar,

      That could be one of the solutions but the pain is that the component(Gross Premium, Outstanding Loss) are also dynamic. He can add componennts for the respective LOBs as well. So in that case again it becomes dynamic.

      Regards,

      Sudhi

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.