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: 

Field symbol is not getting assigned

0 Kudos

We have following code:

DATA: l_search_fields TYPE adsrchline,
im_t_search_fields TYPE TABLE OF adsrchline,
l_fieldname TYPE dynfnam.

**----------------------------------------------------------------------
** Field Symbols
**----------------------------------------------------------------------
FIELD-SYMBOLS: <fs_fieldname> TYPE ANY.

LOOP AT im_t_search_fields INTO l_search_fields.
CONCATENATE 'ex_match_struc-'
l_search_fields-fieldname
INTO l_fieldname.
ASSIGN (l_fieldname) TO <fs_fieldname>.
MOVE l_search_fields-content TO <fs_fieldname>.
ENDLOOP.

For 20 millions records above code worked fine but after that it gave dump 'GETWA_NOT_ASSIGNED' at MOVE command. Please help me to solve this as I am clueless why it worked earlier and now it is giving dump.

10 REPLIES 10

pokrakam
Active Contributor

Firstly, please use the code formatting ("CODE" button) when posting code. It makes code look like code and much easier to read.

The error is telling you that l_fieldname did not get assigned. Please review the contents of your other variables, they should be listed in the dump.

SimoneMilesi
Active Contributor
0 Kudos

It seems to me pretty easy: structure ex_match_struc- doesn't contain a certain field listed in the table im_t_search_fields.

Avoiding it's easy too: just check your assign has worked otherwise handle the error.

raymond_giuseppi
Active Contributor

Use a more 'solid' code like

LOOP AT im_t_search_fields INTO l_search_fields.
  ASSIGN COMPONENT l_search_fields-fieldname OF STRUCTURE ex_match_struc TO <fs_fieldname>.
  IF <fs> IS NOT ASSIGNED.
    MESSAGE e207(/bobf/conf) WITH l_search_fields-fieldname 'EX_MATCH_STRUC'.
    " Field &1 of value set is not part of structure of &2
  ELSE.
    MOVE l_search_fields-content TO <fs_fieldname>.
  ENDIF.
ENDLOOP.

then look for any recent change in program or ddic structure?

Hint: If the exported structure is actually dynamic use cl_abap_structdescr or similar class to provide more information, like ddic structure name.

0 Kudos

Thanks for the solution.

I tried with code provided by you but 'ex_match_struc-' is a string. So, when I am trying to write your code it is giving me error that ex_match_struc- not found.

It is like I have concatenated string with a variable and then trying to assign this concatenated value to field symbol.

Kindly guide me.

0 Kudos

If ex_match_struc is a type TYPE STRING then your code make no sense for me (no subfield) Also the text 'ex_match_struc-' doesn't appear in my snippet (trailing '-' and quotes ?)

Nevertheless, try to check the IS ASSIGNED status of the field symbol in your original program...

Check your code. Raymond wrote

...OF STRUCTURE ex_match_struc TO...

You appear to have written

...OF STRUCTURE ex_match_struc- TO...

It seems you do not really understand what your code does.

0 Kudos

To avoid handwriting errors, use the Copy and Paste functions. You may even use the keyboard shortcuts Ctrl+C and Ctrl+V to go faster.

0 Kudos

It's actually irrelevant in this case why this worked before and stopped working. It was poorly written code to begin with. We can't just say ASSIGN and not check if it actually happened ("assumption is mother of all screw-ups"), not to mention ASSIGN COMPONENT has been around for ages already.

Don't be like the person who wrote that code and read ABAP documentation. There are examples available of the proper use of ASSIGN. There are also many SCN blogs and Q&A on this subject, one recent blog example can be found in Google.

Sandra_Rossi
Active Contributor
0 Kudos

Please edit your code by using the button CODE. It's difficult to read it. Thanks.

matt
Active Contributor
0 Kudos

I think the answer has been given below, so I'm closing this question.