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

BDC: Diffrence between Format_message and Write_message

hi abapers can u please explain format_message and write_message.

if i use call transaction syntax like

call transaction 'mk01' using bdctab mode 'N' update 's' messages into bdc_msg.

shall i take format_message or write_message and wht parametrs we should pass in that.

if i put mode 'E' error screen mode wht should i do.

please guide me.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 10, 2007 at 04:50 PM

    when the messages are stored in bdc_msg it has various paramaeters like message type/message no/ message...

    U can use directly to write this message or else u can do a formatting to the message using format_message and use it.

    it depends on ur requirement.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 10, 2007 at 05:47 PM

    I understand that u r trying to collect errors from call transaction. u dont actually require BDCMSGCOLL to collect errors . Just FORMAT_MESSAGE will give u the error text.

    Follow the code below.

    call transaction 'mk01' using bdctab mode 'N' update 's' .

    If sy-subrc ne 0 . " Incase of error on BDC.

    data : lv_msgtext(250).

    clear lv_msgtext.

    CALL FUNCTION 'FORMAT_MESSAGE'

    EXPORTING

    ID = SY-MSGID

    LANG = sy-langu

    NO = SY-MSGNO

    V1 = SY-MSGV1

    V2 = SY-MSGV2

    V3 = SY-MSGV3

    V4 = SY-MSGV4

    IMPORTING

    MSG = lv_msgtext

    EXCEPTIONS

    NOT_FOUND = 1

    OTHERS = 2

    .

    IF sy-subrc <> 0.

    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    • Now this variable lv_msgtxt will hold the error text for that particular run. just

    • write code below to move this error text to error internal table .

    ENDIF.

    hope this will help. Reward points if it helps.

    regards,

    Barath.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 10, 2007 at 05:54 PM

    HI,

    Format_message Takes a message id and number, and puts it into a variable. Works better than WRITE_MESSAGE, since some messages use $ as a place holder, and WRITE_MESSAGE does not accommadate that, it only replaces the ampersands (&) in the message.

    Regards

    Sudheer

    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.