cancel
Showing results for 
Search instead for 
Did you mean: 

Error in function module

Former Member
0 Kudos

Hi,

I am writing the code for generic extractor. In function module, I am writing

  • Check DataSource validity

CASE i_dsource.

WHEN 'Z_PRE_POST'.

WHEN OTHERS.

IF 1 = 2. MESSAGE e009(r3). ENDIF.

  • this is a typical log call. Please write every error message like this

log_write 'E' "message type

'R3' "message class

'009' "message number

i_dsource "message variable 1

' '. "message variable 2

raise error_passed_to_mess_handler

endcase.

While activating this function module, I am getting an error which is:-

The statement "LOG_WRITE" is not expected. A correct similar statement is "WRITE"...

I have used it in many codes but on different servers. This is a new system. Can anyone tell me why this is happening?

Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

LOG_WRITE is a macro defined in the include LRSALK01 (SE38);

Check that you have this include well activated in your system; otherwise implement it your own function module call or simply CALL FUNCTION 'RSAL_LOG_WRITE' with your messages...

here the standard code from SAP for this macro:

DEFINE LOG_WRITE.

RSAL_SAVE_SUBRC = SY-SUBRC.

RSAL_S_LOGPARMS-MSGTY = &1.

RSAL_S_LOGPARMS-MSGID = &2.

RSAL_S_LOGPARMS-MSGNO = &3.

RSAL_S_LOGPARMS-MSGV1 = &4.

RSAL_S_LOGPARMS-MSGV2 = &5.

CALL FUNCTION 'RSAL_LOG_WRITE'

EXPORTING

I_MSGTY = RSAL_S_LOGPARMS-MSGTY

I_MSGID = RSAL_S_LOGPARMS-MSGID

I_MSGNO = RSAL_S_LOGPARMS-MSGNO

I_MSGV1 = RSAL_S_LOGPARMS-MSGV1

I_MSGV2 = RSAL_S_LOGPARMS-MSGV2.

SY-SUBRC = RSAL_SAVE_SUBRC.

END-OF-DEFINITION.

this is weird anyway....

let us know

Olivier.

Answers (1)

Answers (1)

Former Member
0 Kudos

what did you do finally?

in which release are you?

thanks for your feedback!

Olivier.

Former Member
0 Kudos

I am in ECC 6.0.

Used following code...

DATA: v_subrc TYPE sy-subrc,

v_msgty TYPE sy-msgty,

v_msgid TYPE sy-msgid,

v_msgno TYPE sy-msgno,

v_msgv1 TYPE sy-msgv1,

v_msgv2 TYPE sy-msgv2.

DEFINE log_write.

v_subrc = sy-subrc.

v_msgty = &1.

v_msgid = &2.

v_msgno = &3.

v_msgv1 = &4.

v_msgv2 = &5.

call function 'RSAL_LOG_WRITE'

exporting

i_msgty = v_msgty

i_msgid = v_msgid

i_msgno = v_msgno

i_msgv1 = v_msgv1

i_msgv2 = v_msgv2.

sy-subrc = v_subrc.

END-OF-DEFINITION.

.

.

..

.

.

.

.

log_write 'E' "message type

'R3' "message class

'009' "message number

i_dsource "message variable 1

' '. "message variable 2

RAISE error_passed_to_mess_handler.