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

Insert values into dynamically created internal table

Hi Gurus,

Kindly help,

I have created a dynamic internal table using:

CALL METHOD cl_alv_table_create=>create_dynamic_table

Now I want to insert values into the dynamic internal table. How Do I insert values into corresponding columns of the dynamic internal table.

I have searched for many codes on net but I could not find appropriate one.

For example:

vendor_101_xyz_international HY01 HY02 HY03 HY04 Total

article description fergy mash kenyi yaya

101 saffron 04 06 09 01 20

I created dynamic internal tabel with columns:

vendor_101_xyz_international HY01 HY02 HY03 HY04 Total

And now I wanto add values:

101 saffron 04 06 09 01 20

Here coulumns HY01 HY02 HY03 HY04 can change to one or two or any number.

Regards,

Dep

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on May 23, 2011 at 09:12 AM

    Hi,

    If you are able to create a dynamic internal table then why are you not able to create a dynamic line type.

    field:symbols:<fs> type any.
    data:wf_ref type ref to data.
    
    create data wf_ref like line of <fs_tab>.  "<fs_tab> is your dynamic internal table
    if wf_ref is bound.
    assign wf_ref->* to <fs>.
    endif.
    

    Now you can use <fs> as your work area.

    Search for more details in SCN regarding this.

    kesav

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 23, 2011 at 09:58 AM

    Hi,

    I'm not sure about your requirement but you can try to append an initial line and then loop at the dynamic table like this:

    field-symbols: <fs_data> type standard table,
                   <fs_wa>   type any,
                   <fs_val>  type any.
    
    assign dynamic_table->* to <fs_data>. "your dynamic internal table
    append initial line to <fs_data>.
    
    loop at <fs_data> assigning <fs_wa>.
    
        assign component 'HY01' of structure <fs_wa> to <fs_val>.
        <fs_val> = 'saffron'. "value to be inserted
        
        assign component 'HY02' of structure <fs_wa> to <fs_val>.
        <fs_val> = '04'.
        
        "and so on..
    
    endloop.
    

    Hope this helps.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 24, 2011 at 05:16 AM

    Thank You All.

    Add a comment
    10|10000 characters needed characters exceeded

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.