2020 May 04 8:28 PM
Hi Experts,
We have a problem on our system.
This piece of code generates a ST22 abap runtime error:
CATCH_ILLEGAL_STATE
this is the code:
DATA:
tdname_range TYPE RANGE OF tdname,
tdobject_range TYPE RANGE OF tdobname,
spras_range TYPE RANGE OF langu.
DATA: lt_svo TYPE zbpt_gwe_svo_id.
LOOP AT it_ids INTO DATA(ls_id).
APPEND INITIAL LINE TO tdname_range ASSIGNING FIELD-SYMBOL(<fs_object_name>).
<fs_object_name>-sign = 'I'.
<fs_object_name>-option = 'EQ'.
<fs_object_name>-low = ls_id-id.
ENDLOOP.
SELECT tdname, tdobject, tdid, tdspras FROM stxh INTO TABLE @DATA(lt_stxh) WHERE tdname IN @tdname_range AND tdid = 'Z001' AND tdobject = 'BUT000'.
LOOP AT lt_stxh INTO DATA(ls_stxh).
APPEND INITIAL LINE TO tdobject_range ASSIGNING FIELD-SYMBOL(<fs_object>).
<fs_object>-sign = 'I'.
<fs_object>-option = 'EQ'.
<fs_object>-low = ls_stxh-tdname.
ENDLOOP.
spras_range = VALUE #( ( sign = 'I' option = 'EQ' low = 'N') ( sign = 'I' option = 'EQ' low = 'E') ).
SELECT tdname, clustr, clustd
INTO TABLE @DATA(lt_stxl)
FROM stxl
WHERE relid = 'TX' "standard text
AND tdobject = 'BUT000'
AND tdname IN @tdobject_range
AND tdid = 'Z001'
AND tdspras IN @spras_range.
* compressed text data without text name
TYPES: BEGIN OF ty_stxl_raw,
clustr TYPE stxl-clustr,
clustd TYPE stxl-clustd,
END OF ty_stxl_raw.
DATA: t_stxl_raw TYPE STANDARD TABLE OF ty_stxl_raw.
DATA: w_stxl_raw TYPE ty_stxl_raw.
* decompressed text
DATA: t_tline TYPE STANDARD TABLE OF tline.
FIELD-SYMBOLS: <tline> TYPE tline.
DATA: w_stxh TYPE stxh.
LOOP AT lt_stxl ASSIGNING FIELD-SYMBOL(<stxl>).
* decompress text
CLEAR: t_stxl_raw[], t_tline[].
w_stxl_raw-clustr = <stxl>-clustr.
w_stxl_raw-clustd = <stxl>-clustd.
APPEND w_stxl_raw TO t_stxl_raw.
IMPORT tline = t_tline FROM INTERNAL TABLE t_stxl_raw.
* access text lines for further processing
LOOP AT t_tline ASSIGNING <tline>.
TRY .
IF <tline>-tdline CP iv_filter.
APPEND INITIAL LINE TO lt_svo ASSIGNING FIELD-SYMBOL(<fs_id>).
<fs_id>-id = CONV bu_partner( <stxl>-tdname ).
ENDIF.
* CATCH cx_sy_itab_line_not_found.
CATCH cx_root.
ENDTRY.
ENDLOOP.
ENDLOOP.
SORT lt_svo ASCENDING.
DELETE ADJACENT DUPLICATES FROM lt_svo COMPARING ALL FIELDS.
rt_ids = lt_svo.
This code filters a text based on the value of iv_filter.
It goes wrong in the last loop:

I think, the problem is causedby this line of code:
IMPORT tline = t_tline FROM INTERNAL TABLE t_stxl_raw.
Can somebody tell what the problem is?
2020 May 05 12:16 PM
vincentbloem, took me a little bit, but with the following code, you should be able to read the partner in the ST22 dump. Its not 'pretty' but it will work, as SAP captures system variables for ST22 dumps; but not all program variables, those are 'magically' selected, on which the system seems important (and your partner, aka <stxl>-tdname, obviously has not deemed worthy so far).
DATA: l_cp TYPE tcp00-cpcodepage.
" This way, you get the 'PARTNER' into the system variables for the dump in variable SY-MSGV1
sy-msgv1 = <stxl>-tdname.
IMPORT tline = t_tline FROM INTERNAL TABLE t_stxl_raw
ACCEPTING TRUNCATION " also try out these additions to the IMPORT statement
CODE PAGE INTO l_cp " as this is how the standard FM READ_MULTIPLE_TEXTS calls it
IGNORING CONVERSION ERRORS. " otherwise, you might give the FM a try, like Sandra already proposed
Hi Experts,
We have a problem on our system.
This piece of code generates a ST22 abap runtime error:
CATCH_ILLEGAL_STATE
this is the code:
DATA:
tdname_range TYPE RANGE OF tdname,
tdobject_range TYPE RANGE OF tdobname,
spras_range TYPE RANGE OF langu.
DATA: lt_svo TYPE zbpt_gwe_svo_id.
LOOP AT it_ids INTO DATA(ls_id).
APPEND INITIAL LINE TO tdname_range ASSIGNING FIELD-SYMBOL(<fs_object_name>).
<fs_object_name>-sign = 'I'.
<fs_object_name>-option = 'EQ'.
<fs_object_name>-low = ls_id-id.
ENDLOOP.
SELECT tdname, tdobject, tdid, tdspras FROM stxh INTO TABLE @DATA(lt_stxh) WHERE tdname IN @tdname_range AND tdid = 'Z001' AND tdobject = 'BUT000'.
LOOP AT lt_stxh INTO DATA(ls_stxh).
APPEND INITIAL LINE TO tdobject_range ASSIGNING FIELD-SYMBOL(<fs_object>).
<fs_object>-sign = 'I'.
<fs_object>-option = 'EQ'.
<fs_object>-low = ls_stxh-tdname.
ENDLOOP.
spras_range = VALUE #( ( sign = 'I' option = 'EQ' low = 'N') ( sign = 'I' option = 'EQ' low = 'E') ).
SELECT tdname, clustr, clustd
INTO TABLE @DATA(lt_stxl)
FROM stxl
WHERE relid = 'TX' "standard text
AND tdobject = 'BUT000'
AND tdname IN @tdobject_range
AND tdid = 'Z001'
AND tdspras IN @spras_range.
* compressed text data without text name
TYPES: BEGIN OF ty_stxl_raw,
clustr TYPE stxl-clustr,
clustd TYPE stxl-clustd,
END OF ty_stxl_raw.
DATA: t_stxl_raw TYPE STANDARD TABLE OF ty_stxl_raw.
DATA: w_stxl_raw TYPE ty_stxl_raw.
* decompressed text
DATA: t_tline TYPE STANDARD TABLE OF tline.
FIELD-SYMBOLS: <tline> TYPE tline.
DATA: w_stxh TYPE stxh.
LOOP AT lt_stxl ASSIGNING FIELD-SYMBOL(<stxl>).
* decompress text
CLEAR: t_stxl_raw[], t_tline[].
w_stxl_raw-clustr = <stxl>-clustr.
w_stxl_raw-clustd = <stxl>-clustd.
APPEND w_stxl_raw TO t_stxl_raw.
IMPORT tline = t_tline FROM INTERNAL TABLE t_stxl_raw.
* access text lines for further processing
LOOP AT t_tline ASSIGNING <tline>.
TRY .
IF <tline>-tdline CP iv_filter.
APPEND INITIAL LINE TO lt_svo ASSIGNING FIELD-SYMBOL(<fs_id>).
<fs_id>-id = CONV bu_partner( <stxl>-tdname ).
ENDIF.
* CATCH cx_sy_itab_line_not_found.
CATCH cx_root.
ENDTRY.
ENDLOOP.
ENDLOOP.
SORT lt_svo ASCENDING.
DELETE ADJACENT DUPLICATES FROM lt_svo COMPARING ALL FIELDS.
rt_ids = lt_svo.
This code filters a text based on the value of iv_filter.
It goes wrong in the last loop:

I think, the problem is causedby this line of code:
IMPORT tline = t_tline FROM INTERNAL TABLE t_stxl_raw.
Can somebody tell what the problem is?
2020 May 04 9:42 PM
Yes, you are right IMPORT is an issue. Please check syntax and semantics of the IMPORT statement.IMPORT ... FROM INTERNAL TABLE itab
Looks like you have to change the first field of ty_stxl_raw. "Internal table in particular cannot be empty"
* compressed text data without text name
TYPES: BEGIN OF ty_stxl_raw,
clustr TYPE stxl-clustr, <==== Change this to 'clustr TYPE 'I'
clustd TYPE stxl-clustd,
END OF ty_stxl_raw.
2020 May 05 4:10 AM
mukeshjadhav, that is most likely not the problem, based on ABAP documentation: "The first column of itab must have the data type s or i and the second column must have the type x." This is the case with stxl-custr (2-byte integer). Otherwise, I would also expect a general error, and not just in the "last loop".
2020 May 05 4:54 AM
The error CATCH_ILLEGAL_STATE happens for instance with the IMPORT FROM INTERNAL TABLE statement, when either your fields CLUSTR or CLUSTD are empty/initial or when they contain corrupted information, that does not lead to a valid extraction of data from the data cluster.
LOOP AT lt_stxl ASSIGNING FIELD-SYMBOL(<stxl>).
CHECK: <stxl>-clustr IS NOT INITIAL, " at least check that these are not initial
<stxl>-clustd IS NOT INITIAL.
CLEAR: t_stxl_raw[], t_tline[].
w_stxl_raw-clustr = <stxl>-clustr.
w_stxl_raw-clustd = <stxl>-clustd.
APPEND w_stxl_raw TO t_stxl_raw.
IMPORT tline = t_tline FROM INTERNAL TABLE t_stxl_raw.
LOOP ... .
" ...
ENDLOOP.
ENDLOOP.
2020 May 05 10:45 AM
Hi Michael,
I Changed the code like you said but still the same error occured:

Can you modify the code to identify the partner when the dump occures?
2020 May 06 10:40 PM
Hi Michael,
I did the code change like you said and it worked! 🙂
We found the BP that was causing the runtime error.
The problem was in the data of the BP, the text was 1748 page long ! and full of strange characters.... So we cleaned the data and now it doesn't dump anymore.
Thanks for the help!
KR,
Vincent
2020 May 05 5:00 AM
Can't you use the standard function module READ_MULTIPLE_TEXTS? (added by note 2261311)
2020 May 05 12:16 PM
vincentbloem, took me a little bit, but with the following code, you should be able to read the partner in the ST22 dump. Its not 'pretty' but it will work, as SAP captures system variables for ST22 dumps; but not all program variables, those are 'magically' selected, on which the system seems important (and your partner, aka <stxl>-tdname, obviously has not deemed worthy so far).
DATA: l_cp TYPE tcp00-cpcodepage.
" This way, you get the 'PARTNER' into the system variables for the dump in variable SY-MSGV1
sy-msgv1 = <stxl>-tdname.
IMPORT tline = t_tline FROM INTERNAL TABLE t_stxl_raw
ACCEPTING TRUNCATION " also try out these additions to the IMPORT statement
CODE PAGE INTO l_cp " as this is how the standard FM READ_MULTIPLE_TEXTS calls it
IGNORING CONVERSION ERRORS. " otherwise, you might give the FM a try, like Sandra already proposed
2020 May 07 5:34 AM
2020 May 13 9:05 AM
vincentbloem, please follow up on your open question.
2020 May 05 1:54 PM
vincentbloem Again, don't you want to simplify your code with READ_MULTIPLE_TEXTS?
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |