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: 

How to rectify this SLIN error as I got when performing EPC

Former Member
0 Kudos

Hi Friends,

The error I got when I run EPC for a function module is as below:

Constant C_MSGID may be overwritten as a result of the following call sequnce:

Include: LZU1CD_LOCALF01, Line: 22, Call: ERROR_RETURN, Argument: C_MSGID

Include: LZU1CD_LOCALF01, Line: 162, MSGID is at write position

(The message can be hidden with "#EC *)

If I double click it ,the particular error it is of is like this:

PERFORM ERROR_RETURN USING C_MSGID 'E' '000'.

RETURN.

I hide the error with "#EC * but how to rectify that..Any clues

Thanks and Regards,

Johny

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Whats the code at line 162?

4 REPLIES 4

Former Member
0 Kudos

Whats the code at line 162?

0 Kudos

Hi,

if error is like this

Program: SAPLZU1CD_INQUIRY Include: LZU1CD_INQUIRYF07 Row: 153

Constant '012' may be overwritten as a result of the following call sequnce:

Include: LZU1CD_INQUIRYF07, Line: 153, Call: ERROR_RETURN, Argument: '012'

Include: LZU1CD_INQUIRYF07, Line: 36, MSGNO is at write position

(The message can be hidden with "#EC *)

On double clicking that,

It shows that the error is at line 153

like this

PERFORM ERROR_RETURN USING 'ZU1CD_0003' 'E' '012'.

RETURN.

Inside the perform at line 36,msgno. is assigned a value like this:

FORM ERROR_RETURN USING MSGID TYPE SYMSGID

MSGTY TYPE SYMSGTY

MSGNO TYPE SYMSGNO.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

ID = msgid

LANG = SY-LANGU

NO = msgno

IMPORTING

MSG = wa_error_data-msgtext

EXCEPTIONS

NOT_FOUND = 1

OTHERS = 2.

IF SY-SUBRC <> 0.

CASE SY-SUBRC.

WHEN 1.

PERFORM ERROR_RETURN USING 'ZU1CD_0003' 'E' '019'. "Error message for Unknown exceptions

RETURN.

WHEN OTHERS.

msgid = text-016.

msgno = text-017.

msgty = text-018.

wa_error-msgtext = text-019.

ENDCASE.

ENDIF.

here the error appears at msgno It seems.

Could you please let me know..what needs to be done in this regard.

Thanks and Regards,

Lakshmi

matt
Active Contributor
0 Kudos
FORM error_return USING msgid TYPE symsgid
                        msgty TYPE symsgty
                        msgno TYPE symsgno.


  CALL FUNCTION 'FORMAT_MESSAGE'
    EXPORTING
      id        = msgid
      lang      = sy-langu
      no        = msgno
    IMPORTING
      msg       = wa_error_data-msgtext
    EXCEPTIONS
      not_found = 1
      OTHERS    = 2.

  IF sy-subrc EQ 0.

    CASE sy-subrc.
      WHEN 1.
        PERFORM error_return USING 'ZU1CD_0003' 'E' '019'. "Error message for Unknown exceptions
        RETURN.
      WHEN OTHERS.
        msgid = text-016.
        msgno = text-017.
        msgty = text-018.
        wa_error-msgtext = text-019.
    ENDCASE.
  ENDIF.
ENDFORM.

You call the form with a constant, but you've code there that could change the value of the parameter.

In fact, if the sy-subrc is zero, it will always change the value of the incoming parameter, the code is wrong - the "WHEN 1" block will never be executed. You're also changing GLOBAL data (wa) inside a form - this is very bad programming practice. It seems likely to me that instead of msgno = text-017, for example, you mean to have wa_error-msgno = text-017 But why on earth are you assigning a text element to msgid and msgno and msgty? It makes no sense.

Look at the code and try and think about what it will do.

I suspect that you want the code to look like this.

FORM error_return USING msgid TYPE symsgid
                        msgty TYPE symsgty
                        msgno TYPE symsgno.


  CALL FUNCTION 'FORMAT_MESSAGE'
    EXPORTING
      id        = msgid
      lang      = sy-langu
      no        = msgno
    IMPORTING
      msg       = wa_error_data-msgtext
    EXCEPTIONS
      not_found = 1
      OTHERS    = 2.

    CASE sy-subrc.
      WHEN 0. "  No problem
      WHEN 1.
        PERFORM error_return USING 'ZU1CD_0003' 'E' '019'. "Error message for Unknown exceptions
        RETURN.
      WHEN OTHERS.
        wa_error-msgid = text-016.
        wa_error-msgno = text-017.
        wa_error-msgty = text-018.
        wa_error-msgtext = text-019.
    ENDCASE.
ENDFORM.

But still, updating global wa_error inside the form is BAD. Oh, and learn to surround your code with tags - that will preserve indentation and make things a lot clearer.

Former Member
0 Kudos

Answered