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 Retrieve MM90 logs in the report program

Former Member
0 Kudos

Hi all,

I am calling the BAPI-'BAPI_MATERIAL_MAINTAINDATA_RT'. If it successfully executes with no errors , then FM 'BAPI_Transaction_COMMIT' is executed and in MM90 the log can be seen. But, when the BAPI executes with errors, I need to show the exact error message in the program.  MM90 logs are not generated unless 'BAPI_TRANSACTION_COMMIT' is called.

  for eg :

      CALL 'BAPI_MATERIAL_MAINTAINDATA_RT'

          ........

      IMPORTING

         ls_return = ls_ret

       ........ .


   IF ls_ret-type NE 'E'.

      CALL 'BAPI_TRANSACTION_COMMIT'.

   ELSE.

      <????????>

    ENDIF.


Is there any FM to retrieve the MM90 logs and how to use them in the program, if any ?

Thanks

1 ACCEPTED SOLUTION

Chintu6august
Contributor
0 Kudos

Hi,

Try using FM : APPL_LOG_READ_DB.

hope this help!!

thanks!

10 REPLIES 10

Chintu6august
Contributor
0 Kudos

Hi,

Try using FM : APPL_LOG_READ_DB.

hope this help!!

thanks!

0 Kudos

These FM are there in 'Google Search'. Please share how to pass these values.!!

0 Kudos

did you find how to pass these values?? in 'Google Search'.

0 Kudos

No adi.. I didn't. This FM you mentioned requires quite a lot of Importing and exporting parameters.

0 Kudos

Hi adi,

The problem got solved by using the FM-APPL_LOG_READ_DB with the FORMAT- MESSAGE.

The point of concern is the table 'MESSAGES' in the FM APPL_LOG_READ_DB. From, this table, I just took the message number and ID and passed in FM - FOMAT_MESSAGE. and it worked.

Thanks to all....

0 Kudos

Hi,

please provide how passed the parameters in FM-APPL_LOG_READ_DB so others can also refer it.

thank you!!

former_member194965
Active Participant
0 Kudos

Hi,

In else condition call FORMATE_MESSAGE Function module to get the log (Success/Error)

   IF ls_ret-type NE 'E'.

      CALL 'BAPI_TRANSACTION_COMMIT'.

   ELSE.


  • 'FORMAT_MESSAGE'.EXPORTING        
      id   = it_return -id
      lang = sy-langu 
      no   = it_return -msgnr
      v1   = it_return -message_v1 
      v2   = it_return -message_v2
      v3   = it_return -message_v3     
      IMPORTING  
      msg  = lv_msg.


    ENDIF.


Finally Display this LV_MSG.

Regards,

E.Ananthachari.

0 Kudos

when the bapi fails, the exact cause of failure can be viewed in MM90 logs. The return message it throws gives a External message ID which is used in MM90. so,, this does not help.

Thanks...

raymond_giuseppi
Active Contributor
0 Kudos

So build yourself the log mapping data from RETURN with object MATU, use FM

  • BAL_LOG_CREATE
  • BAL_LOG_MSG_ADD
  • BAL_DB_SAVE

Ref:  Function Module Overview in Application Log (BC-SRV-BAL)

Regards,

Raymond

Former Member
0 Kudos

The mentioned problem is solved in following way :

DATA : lt_messages TYPE TABLE OF balm,

            lv_message  TYPE string,

            lv_log_no   TYPE balnrext.

*** For reading the logs

  CALL FUNCTION 'APPL_LOG_READ_DB'

    EXPORTING

      external_number  = lv_log_no

      date_from           = sy-datum

      date_to               = sy-datum

      log_class            = '4'

      program_name    = sy-cprog

      transaction_code = *******

      user_id               = sy-uname

    TABLES

      messages         = lt_messages

  LOOP AT lt_messages ASSIGNING FIELD-SYMBOL(<ls_messages>) WHERE msgty  = gc_e.

** formatting each error message

    CALL FUNCTION 'FORMAT_MESSAGE'

      EXPORTING

        id          = <ls_messages>-msgid

        lang      = sy-langu

        no        = <ls_messages>-msgno

        v1        = <ls_messages>-msgv1

      IMPORTING

        msg      = lv_message

      EXCEPTIONS

        not_found = 1

        OTHERS    = 2.

    IF sy-subrc EQ 0.

      *Append to your error table*/your message handling code.*

    ENDIF.

  ENDLOOP.