Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to populate dynamic internal table fields with data??

RoySayak
Active Participant
0 Kudos

Hi Folks,

How to assign a particular internal table field to a dynamically assigned internal table?

I have an excel sheet, and i upload the excel sheet data into an internal IT_EXLOAD table using FM ALSM_EXCEL_TO_INTERNAL_TABLE

Now i created a dynamic internal table which has the same column as in my DB table.

I have to fill the dynamically created Internal table with the IT_EXLOAD data dynamically.

Suppose in future if i add some field in DB table and for that field if i add some column in excel sheet there is no need to change in the program.

Looking for reply...

Best Regards,

Sayak

3 REPLIES 3

satsrockford
Active Participant
0 Kudos

hi

Pls. check the below links.

/people/subramanian.venkateswaran2/blog/2004/11/19/dynamic-internal-table

http://www.sap-img.com/ab030.htm

Regards

Satish

Former Member
0 Kudos

hi,

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

EXPORTING

filename = p_path

i_begin_col = '1'

i_begin_row = '2'

i_end_col = '2'

i_end_row = '1000'

TABLES

intern = intern

EXCEPTIONS

inconsistent_parameters = 1

upload_ole = 2

OTHERS = 3.

*declare intern_tmp as internal table tb_data in wich you want the data

*and declare a field symbol <fs_123>

LOOP AT intern.

ASSIGN COMPONENT intern-col OF STRUCTURE

intern_tmp TO <fs_123>.

IF NOT <fs_123> IS ASSIGNED.

CLEAR intern.

CLEAR intern_tmp.

CONTINUE.

ENDIF.

<fs_123> = intern-value.

AT END OF row.

CLEAR tb_data.

MOVE-CORRESPONDING: intern_tmp TO tb_data.

APPEND tb_data.

CLEAR intern_tmp.

ENDAT.

CLEAR intern.

ENDLOOP.

**paste this code and you can see the data in ur tables dynamically.

Thanks

Nitin Sachdeva

former_member705122
Active Contributor
0 Kudos

Refer max bianchi reply in this thread