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: 

Function module to read error message provided message class and mssg no.

Former Member
0 Kudos

Hi experts,

I am trying to populate my database table with the error message.

The error message as comming form standard code in an ITAB.

I am getting the error class and message number.

Can any body please tell me any function module to read the error.

Or is there any way to populate the database table with the error message.

Regards,

Sandipan.

1 ACCEPTED SOLUTION

Former Member

Hi,

You can use the Function module mentioned below.

  

 call transaction 'VA42' using bdcdata  mode  w_mode
                                    update  w_synch
                                  messages into it_mesgtab.

    loop at it_mesgtab into wa_mesgtab where msgtyp ca 'EA'.
    endloop.
    if sy-subrc <> 0.
      read table it_mesgtab into wa_mesgtab index 1.
    endif.

    call function 'MESSAGE_TEXT_BUILD'
      exporting
        msgid               = wa_mesgtab-msgid          "Messg class
        msgnr               = wa_mesgtab-msgnr          "Messg No.
        msgv1               = wa_mesgtab-msgv1
        msgv2               = wa_mesgtab-msgv2
        msgv3               = wa_mesgtab-msgv3
        msgv4               = wa_mesgtab-msgv4
      importing
        message_text_output = it_err-sapmessage.

   Append it_err.

Regards,

Srinivas

6 REPLIES 6

vinod_vemuru2
Active Contributor
0 Kudos

HI,

You can use the FM MESSAGE_TEXT_BUILD. You need to pass the place holders also(msgv1/2/3/4 for getting complete text)

Alternatively you can use table T100 for reading the messages.

Thanks,

Vinod.

Former Member
0 Kudos

Hi,

Please search for basics before posting threads.

Here use the FM "BALW_BAPIRETURN_GET2"?

The import parameters for this FM are

TYPE - Message Type (can be error/success.info etc)

CL - Message Class

NUMBER - Message No

PAR1 - Message Place Holder1, if any exists

PAR2 - Message Place Holder2, if any exists

PAR3 - Message Place Holder3, if any exists

PAR4 - Message Place Holder4, if any exists

You will get the message text information directly from the export parameter RETURN-MESSAGE.

Regards,

Ganga

Former Member
0 Kudos

Hi Saneeepan,

If you just want to read the message then you can use

FM - BALW_BAPIRETURN_GET2

And pass the values - mes class and no and you will get message

CALL FUNCTION 'BALW_BAPIRETURN_GET2'

EXPORTING

type = LS_MESSTAB-MSGTYP

cl = LS_MESSTAB-MSGID

number = L_NUMBER

IMPORTING

return = EV_MESSAGE.

Regards,

Murali

former_member1245113
Active Contributor
0 Kudos

Hi

RPY_MESSAGE_COMPOSE

ESSAGE_PREPARE

Check these FMs

Former Member

Hi,

You can use the Function module mentioned below.

  

 call transaction 'VA42' using bdcdata  mode  w_mode
                                    update  w_synch
                                  messages into it_mesgtab.

    loop at it_mesgtab into wa_mesgtab where msgtyp ca 'EA'.
    endloop.
    if sy-subrc <> 0.
      read table it_mesgtab into wa_mesgtab index 1.
    endif.

    call function 'MESSAGE_TEXT_BUILD'
      exporting
        msgid               = wa_mesgtab-msgid          "Messg class
        msgnr               = wa_mesgtab-msgnr          "Messg No.
        msgv1               = wa_mesgtab-msgv1
        msgv2               = wa_mesgtab-msgv2
        msgv3               = wa_mesgtab-msgv3
        msgv4               = wa_mesgtab-msgv4
      importing
        message_text_output = it_err-sapmessage.

   Append it_err.

Regards,

Srinivas

SuhaSaha
Advisor
Advisor
0 Kudos

Gentlemen,

SAP has provided a statement to pass the message short text into a variable. (MESSAGE ... INTO ) who needs a FM to do the same ?

Please read this: [http://help.sap.com/abapdocu_70/en/ABAPMESSAGE_OPTIONS.htm#!ABAP_ADDITION_3@3@|http://help.sap.com/abapdocu_70/en/ABAPMESSAGE_OPTIONS.htm#!ABAP_ADDITION_3@3@]

BR,

Suhas