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

build field catalog/ internal table based with another internal tab conten

Hi All,

I am working on how to build a field catalog or internal table with the strcuture from the content of an another internal table. Let me put it with an example.

********************************************************************

begin of itab occurs 10,

matno type matnr,

end of itab.

select matnr from mara into table itab upto 10 rows.

*********************************************************************

Now ltab has contents with ten material numbers. For example

C1010

C1011

C1012

C1013

C1014

-


Now i want to build internal table or field catalog with the content of itab which will have the same structure as of the content.

let say internqal table

begin of jtab occurs 10,

c1010

C1011

C1012

---

-


end of jtab.

Is it possible to build any of them?

Thanks

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Dec 04, 2007 at 09:40 PM

    Check the link Dynamic table

    It might be helpful.

    Its about using class cl_alv_table_create to build dynamic internal table

    Add a comment
    10|10000 characters needed characters exceeded

    • Why not...

      Dynamic tables exists since we don't know the structure, otherwise we can use static tables... 😉

      However, try doing like this:

      LOOP AT contents.
        l_fcat-name  = contents-field.
      * // From here simply fill a fieldcatalog just like you do for display an ALV Grid
        DESCRIBE FIELD contents-field TYPE l_fcat-inttype.
        DESCRIBE FIELD contents-field LENGTH l_fcat-outputlen.
      * // Etc...
      ENDLOOP.
      

      Use Function 'ALV_TABLE_CREATE' passing the fieldcatalog just created, a callback program and a callback routine.

      Note that you need to create the routine in your program with a parameter TABLE.

      This form will be called inside the function module to let you work with the new table.

      Hope this helps,

      R.

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.