Application Development and Automation 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: 
Read only

moving data from structure to internal table

Former Member
0 Likes
10,835

Hi friends,

I'm having data in one structure inside one function module .

I want to move that data to one internal table so i can retrieve it .

Plz tell me how to do it .??

Thanks in advance.

6 REPLIES 6
Read only

Former Member
0 Likes
4,551

Hi,

Your question is not very clear.

I the structure of workarea and internal table are same , then you can write

APPEND WA_DATA TO I_DATA.

Read only

0 Likes
4,551

data: location_data type temp

CALL FUNCTION funcname

EXPORTING

location_data = ls_location_data

I want to move this location_data to one internal table so i can fetch data .

Read only

Former Member
4,551

Hi,

You can write as:

append <str data> to <int table>.

Mention this internal table name in Tables tab in function module.

Read only

Former Member
0 Likes
4,551

If the resultant structure is not there as an exporting parameter from the function module. You can use field symbols.

first declare your internal table type structure with the same name as your FM structure.

delcare two fields symbols of the structure type.

After calling the FM, assign the FM structure to your field symbol1 <fs1>.you can do this by giving the main program name of FM as reference ie

ASSIGN ((SAP***)structurename) TO <fs1>.

assign local internal table type also in the same way. For this pgm name is not required, as this is in your local program. <fs2>

then swap this field symbol values

<fs2> = <fs1>

This much steps if you do, you can get the values in your local internal table type.

Read only

former_member195383
Active Contributor
4,551

U are using the structure inside the FM..means...u are importing it from some place..suppose ur structutre is s and internal table is itab..then declare a work area wa_itab of type same as itab.

then wa_itab1-field1 = s-field1 .

wa_itab1-field2 = s-field2 .

:

:

then append wa_itab1 to itab.

hope it works...reward if useful...

regards

Rudra

Read only

former_member156446
Active Contributor
0 Likes
4,551

if the structure of the FM is in the tables part of the FM

u can use


read table <table_name> into work_area sy-index = 1.
if sy-subrc eq 0.

append work_area to itab.

endif.