11-16-2007 9:40 AM
Hi All,
Can anybody please give me an example for BDC where write_message and format_message function modules are used.
Thanks in Advance
11-16-2007 9:46 AM
y cant u search in the forum, u come across many threads related to ur query
thanks
friend
11-16-2007 9:46 AM
Hi Ranjit,
When you use CALL TRANSACTION..... MESSAGES in GIT_MESSAGES, so messages will be transfered to GIT_MESSAGES table.
DESCRIBE TABLE git_messages LINES lv_lines.
READ TABLE git_messages INTO wa_messages INDEX lv_lines.
IF sy-subrc EQ 0.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = wa_messtab-msgid
lang = wa_messtab-msgspra
no = wa_messtab-msgnr
v1 = wa_messtab-msgv1
v2 = wa_messtab-msgv2
v3 = wa_messtab-msgv3
v4 = wa_messtab-msgv4
IMPORTING
msg = lv_msg
EXCEPTIONS
not_found = 1
OTHERS = 2.
ENDIF.
Reward if it helps,
Satish
11-27-2007 9:51 AM
hi,
see the next link:
<a href="http://www.iconet-ltd.co.uk/sample_entry.php?id=9">http://www.iconet-ltd.co.uk/sample_entry.php?id=9</a>
cordial greetings.
11-27-2007 11:27 AM
Hi Ranjith,
try this one,
DATA : BDCMSGCOLL TYPE TABLE OF BDCMSGCOLL WITH HEADER LINE,
BDCDATA TYPE TABLE OF BDCDATA WITH HEADER LINE.
CALL TRANSACTION 'MM01' USING BDCDATA MODE N UPDATE S MESSAGES INTO BDCMSGCOLL.
IF SY-SUBRC <> 0.
PERFORM ERR.
CLEAR I_MSG.
REFRESH I_MSG.
ENDIF.
&----
*& Form ERR
&----
text
----
--> p1 text
<-- p2 text
----
form ERR .
DATA V_MSG(255) TYPE C.
READ TABLE I_MSG WITH KEY MSGTYP = 'E'.
IF SY-SUBRC = 0.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = I_MSG-MSGID
LANG = 'E'
NO = I_MSG-MSGNR
V1 = I_MSG-MSGV1
V2 = I_MSG-MSGV2
V3 = I_MSG-MSGV3
V4 = I_MSG-MSGV4
IMPORTING
MSG = V_MSG
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.
WRITE V_MSG. " Error Message Displayed Here.
CLEAR V_MSG.
ENDIF.
endform. " ERR
Regards,
Vijay