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

Assign FS for Loop Table

Former Member
0 Likes
869

Hello All,

I have a requirement

internal Table 1 has

Field1     field 2

internal Table 2 has

Field 2 Field 3

I need to join these two tables into one table.

I did following

1) create  3 internal table with all 3 required fields.

Loop at IT_tab1 assigning <ittab_1>

Read table it_tab2 assigning <ittab_2> with key field2 = <ittab_1>-field2.

if sy-subrc = 0.

<ittab_3>- field1 = <ittab_1>-field1.

<ittab_3>- field2 = <ittab_2>-field2.

<ittab_3>- field3 = <ittab_2>-field3.

Append <ittab_3> to ittab_3.

endif.

endloop

I am getting error (ST22)

ABAP Programming Error

GETWA_NOT_ASSIGNED

and it shows the line

<ittab_3>- field2 = <ittab_2>-field2.

Please help

Hoa

1 ACCEPTED SOLUTION
Read only

manuelhildemaro_ramossanc
Active Participant
0 Likes
763

Hi Hoa,

Instead of

if sy-subrc = 0.

<ittab_3>- field1 = <ittab_1>-field1.

<ittab_3>- field2 = <ittab_2>-field2.

<ittab_3>- field3 = <ittab_2>-field3.

Append <ittab_3> to ittab_3.

endif.

endloop

Try with this

append initial line to ittab_3 assigning <ittab_3>.

<ittab_3>- field1 = <ittab_1>-field1.

<ittab_3>- field2 = <ittab_2>-field2.

<ittab_3>- field3 = <ittab_2>-field3.

Regards,

Manuel H.


5 REPLIES 5
Read only

Former Member
0 Likes
763

hello,

GETWA_NOT_ASSIGNED is usually faced when there is a null value assignment. Why don't you use loop at internal table into a work area instead of the FS ?

best regards,

swanand

Read only

manuelhildemaro_ramossanc
Active Participant
0 Likes
764

Hi Hoa,

Instead of

if sy-subrc = 0.

<ittab_3>- field1 = <ittab_1>-field1.

<ittab_3>- field2 = <ittab_2>-field2.

<ittab_3>- field3 = <ittab_2>-field3.

Append <ittab_3> to ittab_3.

endif.

endloop

Try with this

append initial line to ittab_3 assigning <ittab_3>.

<ittab_3>- field1 = <ittab_1>-field1.

<ittab_3>- field2 = <ittab_2>-field2.

<ittab_3>- field3 = <ittab_2>-field3.

Regards,

Manuel H.


Read only

Former Member
0 Likes
763

dear hoa,

Please check the below link.

http://scn.sap.com/thread/1920472

regards

goudham

Read only

Former Member
0 Likes
763

Hi,

You should not use <ittab_3> Field symbol why because till now you didnt assign that field symbol to any internal table thats why you are getting dump.

Please try the below code

Loop at IT_tab1 assigning <ittab_1>

Read table it_tab2 assigning <ittab_2> with key field2 = <ittab_1>-field2.

if sy-subrc = 0.

wa3- field1 = <ittab_1>-field1.

wa3- field2 = <ittab_2>-field2.

wa3- field3 = <ittab_2>-field3.

Append wa3 to ittab_3.

clear wa3.

endif.

endloop

Thanks

Mani

Read only

Former Member
0 Likes
763

Hi,

For this requirement why you are going for <FS> , directly you can write code with out <FS>.

If you are getting data in dynamic tables , problem for that programming error is assigning null value.

Thanks,

Sivaji.