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

Problem while using Field-Symbols

Former Member
0 Likes
1,842

Dear Gurus,

I am using Field-Symbols in my report progm. Though I am assigning the table type to the declared field-symbol, my program is going to dump saying tht "GETWA_NOT_ASSIGNED".

My Code is as below:

FIELD-SYMBOLS: <f_itab1> TYPE vbak,

<f_itab2> TYPE vbap.

.

.

.

.

.

.

LOOP AT it_vbak ASSIGNING <f_itab1>.

READ TABLE it_vbap ASSIGNING <f_itab2>

WITH KEY vbeln = <f_itab1>-ww206.

.

.

.

.

.

ENDLOOP.

In debugging mode I see <f_itab1> is assigned but <f_itab2> is not being assigned and getting an error msg as "ERROR: Field symbol <f_itab1>is not yet assigned".

Please help me in fixing the issue.

Regards,

Shano

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,676

Hi,

Use

FIELD-SYMBOLS: <f_itab1> TYPE any,

<f_itab2> TYPE any.

15 REPLIES 15
Read only

Former Member
0 Likes
1,676

hi

U ll be appending fieldnames of the internal table into fieldcatalog table rite....

Check if the field names are correct(as in output internal table), written in caps in both the field catalog tables......

If ur using sort table check dat also..

thanks

reply for give prob. again.

Read only

0 Likes
1,676

Hi Mukesh,

Thanks for the reply. Everything is fine with Field-Catalog.And before looping I am sorting both the tables.But I don't understand why <f_itab1> is getting assigned and it's not happening with <f_itab2>.

Read only

Former Member
0 Likes
1,676

Hi,

FIELD-SYMBOLS: <f_itab1> LIKE line of it_vbak,

<f_itab2> LIKE line of it_vbap.

This will solve the issue.

Regards,

Mohaiyuddin.

Read only

0 Likes
1,676

Hi Mohaiyuddin,

I tried in that way also but still it is the same problem. And one more thing I forgot to add is I am using ECC 6.0.

Regards,

Ravi

Read only

0 Likes
1,676

Hi,

Are you checking sy-subrc after READ TABLE ?

If READ TABLE fails and you are trying to access second field symbol <f_itab2> it will go to dump.

Regards,

Mohaiyuddin

Edited by: Mohaiyuddin Soniwala on Aug 13, 2008 4:51 PM

Read only

0 Likes
1,676

Hi Mohaiyuddin,

Offcourse I am checking Sy-subrc.

Read only

0 Likes
1,676

Sorry for the obvious, but thought worth mentioning.

It will be good if you can post complete code. (along with definition of IT_VBAK and IT_VBAP)..The segment you are posting seems correct.

Regards,

Mohaiyuddin

Read only

Former Member
0 Likes
1,677

Hi,

Use

FIELD-SYMBOLS: <f_itab1> TYPE any,

<f_itab2> TYPE any.

Read only

0 Likes
1,676

Hi Amit,

It is giving syntax error when I tried as you mentioned. I tried as below also:

FIELD-SYMBOLS: <f_itab1> TYPE ANY TABLE,

<f_itab2> TYPE ANY TABLE.

But still it <f_itab2> while using READ is getting assigned.

Regards,

Shano

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,676

Hello,

I have some doubts on this stmt

vbeln = <f_itab1>-ww206

Can you tell me whats WW206 field ??

May be ur READ TABLE is failing & so <f_itab2> is not getting assigned. If u try to use this FS, you will get a dump.

BR,

Suhas

Edited by: Suhas Saha on Aug 13, 2008 1:21 PM

Read only

0 Likes
1,676

Hi Suhas,

Sorry, it's actually vbeln. The code is as below.

FIELD-SYMBOLS: <f_itab1> TYPE vbak,

<f_itab2> TYPE vbap.

.

Select * from vbak into table it_vbak.

.

select * from vbap into table it_vbap.

.

.

LOOP AT it_vbak ASSIGNING <f_itab1>.

READ TABLE it_vbap ASSIGNING <f_itab2>

WITH KEY vbeln = <f_itab1>-vbeln.

.

.

.

.

.

ENDLOOP.

Regards,

Shano

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,676

Hello,

Please provide the definition of ITAB1 & ITAB2. I think ur READ TABLE is failing. Did you check SY-SUBRC, is ur READ TABLE OK?

BR,

Suhas

Read only

Former Member
0 Likes
1,676

Hi,

Syntavtically your program is correct. The way I see it you must have declared the field symbols wrongly . Send your detailed code

Ram

Read only

Former Member
0 Likes
1,676

HI Shano,

One more thing I want to share with you is, You need to UNASSIGN the field symbol after coming out of loop.

More or less its like a clear or refresh we use for our internal table and variables.

Warm regards,

Abhishek

Read only

benjamin_matten
Discoverer
0 Likes
1,676

Hi Shano,

you should try this:


loop....

  read table it_vbap assigning <f_itab2> with key vbeln = <f_itab1>-ww206.
  if <f_itab2> is assigned.
*  do your stuff here
  endif.
endloop.

if you want to react on a not present key in it_vbap

or


loop....

  read table it_vbap assigning <f_itab2> with key vbeln = <f_itab1>-ww206.
  check <f_itab2> is assigned.
* do your stuff here
endloop.

if you just want to skip a loop cycle if the key is not present in it_vbap.

Ah and don't forget to unassign <f_itab2> after doing your stuff. If you had it assigned in the cycle before and in the current it's not possible to assign it to a new line it keeps the old one and you overwrite the fields.

Regards,

Benny

Edited by: Benjamin Matten on Aug 13, 2008 2:24 PM