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: 

Need to replace all occurences of '&' in message class

Former Member
0 Kudos

if ls_orders-errors is initial.
 perform add_msg_log using 'W' 'Z_MAT' '002'.
 replace all occurrences of '&' in '' with lv_matnr_new.
 endif.


So I don't know how to do it.

I need to replace all occurences of & in the message class with the same type shown in the perform.

Basically in the perform I am just adding message logs with my message class .

Can anyone help me ?

1 REPLY 1

raymond_giuseppi
Active Contributor
0 Kudos

I don't think you want to change the message class (SE91....) but fill some variables during the call of the message?

What does your add_msg_log form do, If it's a call to a FM such as BAL_LOG_MSG_ADD to actually fill a log, just add and pass the variable to the form signature.

* Sample from a log built from RETURN parameter in a BAPI call
      ls_msg-msgty = bapiret2-type. " W in your sample
      ls_msg-msgid = bapiret2-id. " Z_MAT
      ls_msg-msgno = bapiret2-number. " 002
      ls_msg-msgv1 = bapiret2-message_v1. " lv_matnr_new
      ls_msg-msgv2 = bapiret2-message_v2.
      ls_msg-msgv3 = bapiret2-message_v3.
      ls_msg-msgv4 = bapiret2-message_v4.
      IF ls_msg-msgty = 'E'.
        ls_msg-probclass = '1'.
      ELSEIF ls_msg-msgty = 'W'.
        ls_msg-probclass = '2'.
      ELSE.
        ls_msg-probclass = '3'.
      ENDIF.
      CALL FUNCTION 'BAL_LOG_MSG_ADD'
        EXPORTING
          i_log_handle     = gs_handle
          i_s_msg          = ls_msg
        EXCEPTIONS
          log_not_found    = 1
          msg_inconsistent = 2
          log_is_full      = 3
          OTHERS           = 4.

or for simpliest case use a classic

MESSAGE w002(z_matf) with lv_matnr_new. " space space space