01-12-2018 7:22 AM
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.
01-12-2018 10:15 AM
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.
01-12-2018 10:23 AM
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.
01-12-2018 10:24 AM
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.
01-12-2018 10:38 AM
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.
01-12-2018 10:58 AM
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...
01-12-2018 12:06 PM
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.
01-12-2018 5:58 PM
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.
01-12-2018 11:08 PM
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.
01-12-2018 5:53 PM
Please edit your code by using the button CODE. It's difficult to read it. Thanks.
01-13-2018 8:36 AM
I think the answer has been given below, so I'm closing this question.