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

generate dynamic column

Hi masters,

i am new in Abap devlopment.

i'hv a problem

three record is in the itab like

matnr bwart menge

m1 101 25

m1 312 12

m2 311 20

and i want to show like this

matnr 101 311 312

m1 25 0 12

m2 0 20 0

but bwart are not fix, so column would be dynamic.

please help me..

thanks in advance.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Oct 28, 2010 at 11:00 AM

    What is your requirement ?

    What do you want to do with this data exactly ?

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Amit,

      I think this can be achived by creating internal table dynamicaly,

      • May be on runtime you will come to know how many fields are there,

      So create a fieldcatalog of the fields to be display,

      then use Method cl_alv_table_create=>create_dynamic_table to create the internal table dynamically.

      wa_fcat-fieldname = 'MATNR'.
      append wa_fcat to t_fcat.
      loop at it_sizes.
      wa_fcat-fieldname = it_sizes-size.
      append wa_fcat to t_fcat.
      endloop.
      cl_alv_table_create=>create_dynamic_table
      EXPORTING
            it_fieldcatalog  = t_fcat
            i_length_in_byte = 'X'
       IMPORTING
            ep_table         = dy_table.
        ASSIGN dy_table->* TO <dyn_table>.
      

      I think this will help you.

      check the wiki for creating dynamic internal table

      [http://wiki.sdn.sap.com/wiki/display/ABAP/DynamicInternaltable]

      Thanks,

      Anmol.

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.