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: 

SLIN: get explanation (~long text) on warning (Message Code UNR 3204)

joachimrees1
Active Contributor

Hi,

when SLIN gives me a warning saying something is wrong, where can I get more Info about that check (e.g. why and under what circumstances is that a problem, how to do it better..)

This is a general question, but of course I also have a example at hand:

"Do not modify table rows in tables with control level processing."

(I get this on a NW7.50 system).

I guess I should be able to look up the Message Code "UNR 3204" somewhere, but how?

9 REPLIES 9

Former Member

Hello Joachim,

in case the warning is less than obvious and needs an explanation, an info button is displayed. In this case, however, the warning appears pretty obvious. When using control level processing (Statements AT FIRST/NEW/LAST inside LOOP) the table must not be modified within the loop. Otherwise, the results are unpredictable. See the ABAP online documentation for "AT - itab".

Regards, Hagen

joachimrees1
Active Contributor

Hi Hagen, thanks for your answers!

So for the general part: so if there is no info button, the message seemed obvius enought to the author of the test, ok.

But why is the message code provided, if theres no place to look it up? (More general: What's the message code about?).

For my example with the AT NEW:

I have some coding like this:

  LOOP AT big_table ASSIGNING <data>.
    AT NEW matnr.
      lv_index = 0.
    ENDAT.
    lv_index = lv_index + 1.
    IF lv_index > 5.
	<data>-delete_flag = ABAP_TRUE
    ENDIF.
  ENDLOOP.


"delte the lines we marked as "not interesting"
delete big_tale wherer delete_flag = abap_true. 

So you're saying that causes unpredictable behavior? (delete_flag is the last column).

I looked up the help for "at new", all I see there is: - The internal table cannot be modified within the LOOP loop. --> well, it can be, at least in my system - is that a bug?

While I agree that deleting or adding lines in such a loop or fiddling around with the first few columns is not a good idea, I have the "feeling" that changing the last column like above should be fine. How would you re-write the above coding?

best

Joachim

0 Kudos

I have exactly the same example in code I've just written. Seems totally logical to me what you have illustrated. Did you ever find an answer?

Hey stephenl , no I never found an answer on " where to look up the SLING Message Codes, like "UNR 3204" ? "

As for my code, I think I just accepted/ignored the SLIN-warning.

Also thanks a lot for your code suggestion, I like it!

stephenl

Include SLINI_DESC

See the method class_constructor of class CL_SLIN_DRIVER for the details.

0 Kudos

NB: fixed syntax for the code given above in the answer (SAP ECC 6.0):

DATA big_table TYPE TABLE OF vlcactdata_subitem_s.
DATA(lv_index) = 0.
LOOP AT big_table ASSIGNING FIELD-SYMBOL(<data>)
    WHERE aufnr IS NOT INITIAL.
  AT NEW matnr.
    lv_index = 0.
  ENDAT.
  lv_index = lv_index + 1.
  IF lv_index > 5.
    <data>-delete_flag = abap_true.
  ENDIF.
ENDLOOP.

"delte the lines we marked as "not interesting"
DELETE big_table WHERE delete_flag = abap_true.

stephenl1
Participant

The answer is as follows

DATA: lt_big_table like big_table.

LOOP AT big_table into data(ls_big_table).

   AT NEW matnr.
      lv_index = 0.
    ENDAT.

    lv_index = lv_index + 1.

    IF lv_index > 5.
	Continue.
    ENDIF.

    APPEND ls_big_table TO lt_big_table.

ENDLOOP.

CLEAR big_table.
big_table = lt_big_table.

+1 just to thank you to think about future visitors, by proposing a code corresponding to the code given by the post author!

Sandra_Rossi
Active Contributor

First of all, SLIN is obsolete. Better use ATC which returns best and complete diagnosis information (below screenshot).

You still need to have a good ABAP knowledge to understand why exactly it's a problem. The ABAP documentation is a must read.

If you still want to use SLIN, and understand why exactly a message is sent, you must debug. You may run this program based on CL_SLIN_DRIVER which shows which class pool/local class to debug (usually, it will be the class pool CL_SLIN and one of its many local classes).

REPORT.
DATA: BEGIN OF select_options_for, id TYPE slin_desc-id, code_nr TYPE slin_desc-code_nr, END OF select_options_for. SELECT-OPTIONS s_id FOR select_options_for-id. SELECT-OPTIONS s_codenr FOR select_options_for-code_nr. DATA(tid) = 'TID'. DATA(desc) = 'DESC'. DATA(class_pool) = 'Class pool'. DATA(local_class) = 'Local class'. WRITE: / tid, desc, class_pool, local_class. LOOP AT cl_slin_driver=>test_checker_association_pool REFERENCE INTO DATA(test_check) WHERE testkey-tid IN s_id AND testkey-desc IN s_codenr. WRITE: / test_check->testkey-tid UNDER tid, test_check->testkey-desc UNDER desc, test_check->checkerkey-src UNDER class_pool, test_check->checkerkey-plug UNDER local_class. ENDLOOP.

Result for S_ID = 'UNR' and S_CODENR = '3204':

TID	DESC	Class pool	Local class
UNR	3204	CL_SLIN	  	TESTLOOPWITHAT

(note that the local classes of CL_SLIN are defined inside includes, the implementation of TESTLOOPWITHAT is in the include SLIN_TEST_UNR_IMPL)

All these local classes inherit from CL_SLIN_CHECKER and the method EVAL is the starting point for debugging it.

Via SE80, you can access directly the local class:

NB: this is the code (compiles in 7.40) which is shown in the first screenshot and makes SLIN produce the message UNR 3204:

DATA big_table TYPE TABLE OF vlcactdata_subitem_s.
DATA(lv_index) = 0.
LOOP AT big_table ASSIGNING FIELD-SYMBOL(<data>)
    WHERE aufnr IS NOT INITIAL.
  AT NEW matnr.
    lv_index = 0.
  ENDAT.
  lv_index = lv_index + 1.
  IF lv_index > 5.
    <data>-delete_flag = abap_true.
  ENDIF.
ENDLOOP.

"delte the lines we marked as "not interesting"
DELETE big_table WHERE delete_flag = abap_true.