Search code examples
abapsap-erp

Runtime Error CONVT_NO_NUMBER in program SAPLMEPO (ME21n)


When I'm creating a purchase order that have 10 items (or above), a run time error occurred. Below is the error message.

Category:          ABAP Programming Error
Runtime Errors: CONVT_NO_NUMBER
ABAP Program: SAPLMEPO
Include              MM06EF0B_BUCHEN
Application Component MM-PUR

An exception occurred that is explained in detail below.

This exception cannot be caught in the context of the current statement. The reason for the exception is: An attempt was made to interpret value "*" as a number. As this value contravenes the rules for displaying numbers correctly, this was not possible.

Below is the code where an exception occurred:

DATA indx.
     indx = 1.
* Need to merge KNT and XEKKN
* algorithm is: if knt is old, use knt. Else use the equivalent from xekkn
     LOOP AT knt.
       IF knt-updkz EQ oldpos.
         MOVE-CORRESPONDING knt TO lt_ekkn.
       ELSE.
        READ TABLE xekkn INDEX indx.
         MOVE-CORRESPONDING xekkn to lt_ekkn.
         indx = indx + 1.
       ENDIF.
       APPEND lt_ekkn.
     ENDLOOP.                    "v 2068862

It seems that the data type of indx (char 1), but when PO item index = 9, then index = 10 (actual value is * in debug mode ), so exception is happened.

How should I solve this problem?

I also post this issue here: https://scn.sap.com/message/16146617


Solution

  • You are right in assuming that indx is a C(1) since you (or the author of the code) did not specify a type. Changing the line to

    DATA indx TYPE i.
    

    should solve the issue.