Skip to Content
author's profile photo Former Member
Former Member

Message not triggered


Hi Experts,

I'm trying to trigger a error message. I have debugged the code and ofcourse the respective message class is called with type of error.

But the error message is not triggering. Am I missing some thing. Please help me.

FUNCTION ZFM_ZFE_0057_REQ4_RK.

*"----------------------------------------------------------------------

*"*"Local Interface:

*" IMPORTING

*" REFERENCE(DATEFROM) TYPE CATSFIELDS-DATEFROM

*" REFERENCE(DATETO) TYPE CATSFIELDS-DATETO

*" TABLES

*" CHECK_TABLE STRUCTURE CATS_COMM

*" I_MESSAGES STRUCTURE CATS_MESG

DATA: lt_CHECK_TABLE TYPE TABLE OF CATS_COMM ,
lw_CHECK_TABLE type cats_comm,
lt_msg TYPE STANDARD TABLE OF CATS_MESG,
lw_msg TYPE CATS_MESG,
lt_ztable TYPE STANDARD TABLE OF ZTABLE_RK,
lw_ztable TYPE ZTABLE_RK,
lv_land1 TYPE land1,
lv_max_hr_day TYPE catshours.

CONSTANTS: lv_msgid TYPE MSGID value 'ZCHECK_MSG_RK',
lv_msgno TYPE msgno VALUE '005',
lv_msgtye TYPE MSGTY VALUE 'E'.

CLEAR: lv_land1,
lv_max_hr_day.

LOOP AT CHECK_TABLE INTO lw_CHECK_TABLE.

SELECT SINGLE land1
INTO lv_land1
FROM T001
WHERE bukrs = 'DE10' . "lw_CHECK_TABLE-bukrs

* IF sy-subrc = 0.

SELECT SINGLE MAX_HR_DAY
INTO lv_max_hr_day
FROM ZTABLE_RK
WHERE LAND1 = lv_land1. " land1 = lv_land1.

IF sy-subrc = 0.
IF lw_CHECK_TABLE-catshours gt lv_max_hr_day.

lw_msg-MSGID = lv_msgid.
lw_msg-MSGNO = lv_msgno.
lw_msg-MSGTY = lv_msgtyE.
lw_msg-MSGV1 = lv_max_hr_day.
lw_msg-MSGV2 = lw_CHECK_TABLE-catshours.

APPEND lw_msg to lt_msg.


ENDIF. "End of catshours_day check
ENDIF. "End of ztable
ENDIF. "End of T001
ENDLOOP. "End of lw_CHECK_TABLE
ENDFUNCTION.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    Posted on Jan 04, 2014 at 11:53 AM

    Just replace your (local) lt_msg with interface parameter I_MESSAGES.

    That was it.

    Regards

    Clemens

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 04, 2014 at 10:43 AM

    Hi dilip,

    Your messages are stored in internal table it_msg.

    You can display message using function module.

    Arivazhagan S

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Kiran,

      I'm using UserExit - CATS0006.

      If I call the message as " MESSAGE e005(ZCHECK_MSG_RK) WITH lv_max_hr_day lw_CHECK_TABLE-CATSHOURS lw_CHECK_TABLE-WORKDATE.", error message is displaying in CATS transaction.

      But if I follows the above said logic, am not getting the errror message in CATS transaction. But anyways my error message should be of declared message structure.

  • Posted on Jan 04, 2014 at 11:10 AM

    Hi Dilip,

    as you have got your messages in it_msg,

    so you use its work area as you have declared in lw_msg

    to show error messages. You can declare a variable of type string

    and use LOOP AT it_msg INTO lw_msg, and populate the error messages

    in that variable.

    Then you show the output as that variable, containing error messages.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      You need append all the messages to the internal table " I_MESSAGES" which is specified as table in the function module.

      Check the below code which I have used for CATS0006 user exit.

      IF wa_pdpsp-ftkla NE '3'.

      ls_cats_mesg-msgid = 'ZHR_XSS'.

      ls_cats_mesg-msgty = 'E'.

      ls_cats_mesg-msgno = '035'.

      ls_cats_mesg-pernr = ls_check_table-pernr.

      ls_cats_mesg-catsdate = ls_check_table-workdate.

      APPEND ls_cats_mesg TO i_messages.

      ENDIF.

      Regards,

      Jyothi

  • Posted on Jan 04, 2014 at 12:09 PM

    hi,

    Create exceptions in the FM like E1,E2,E3.... (Raising exceptions inside FM)

    add this code where the error want to throw...

    MESSAGE 'MINIMUM HALF/FULL DAY IS REQUIRED' TYPE 'E' RAISING E1.


    or


    message 'Your Work Area ' type 'E' raising E2.


    Hope it solve ur problem...


    Rgds,

    Vijay SR

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.