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: 

Problem in BDC: Catching error messages (Urgent)

Former Member
0 Kudos

Hello Experts,

I want to catch the error message coming in the form of popup using Call Transaction in background mode.

I have used the following statement.

CALL TRANSACTION 'FBZ5' USING bdcdata MODE 'N' messages into bdcmsg.

But this statement catches only the messages which are displayed in the task bar. It doesn't catch the error message in the form of popup.

Please suggest any solution to this.

Thanks.

Radhika

7 REPLIES 7

former_member188829
Active Contributor
0 Kudos

Hi,

Use The FM: FORMAT_MESSAGE

0 Kudos

Hi Vishnu i known this funcation module , could u plz tell me how to used this function module in program .

Regards,

Nihar.

0 Kudos

Hi,

am giving rough logic...

DATA:v_msg(40).

USE This FM in LOOP and ENDLOOP After Call Transaction 'tcode'...Statement...

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

ID = SY-MSGID

LANG = 'E'

NO = SY-MASGNO

V1 = SY-MSG1

V2 = SY-MSG2

V3 = SY-MSG3

IMPORTING

MSG = V_MSG

Exceptions

....

Read Table it_bdcmsgcoll index 1.

if it_bdcmasgcoll-msgtyp = 'E'.

Move...

Append..

endif.

Write:/ V_MSG,IT_BDCMSGCOLL-MSGTYP.

ReFRESH IT_BDCMSGCOLL>

0 Kudos

Hi Vishnu,

I have already used this FM.

It gives the message text for only those messages which are captured in table it_bdcmsgcoll. The popup messages are not captured in this table.

Former Member
0 Kudos

Hi Radhika ,

try this one,

DATA : BDCMSGCOLL TYPE TABLE OF BDCMSGCOLL WITH HEADER LINE,

BDCDATA TYPE TABLE OF BDCDATA WITH HEADER LINE.

<b>CALL TRANSACTION 'MM01' USING BDCDATA MODE N UPDATE S MESSAGES INTO BDCMSGCOLL.</b>

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.

Former Member
0 Kudos

Radhika,

The messages which are populating in the POP, are information messages. As per your coding, it should pick all the messages, irrespective of error on Task bar, as well as Pop Window. First, try with changing the mode to A. Debug and check the errors. All the errors will be captured in Structure, BDCmsg. Check while debugging. <b>Instead of BDCMSG, use an internal table</b>.......It will capture all the Errors........

<b>DATA: Begin of tbl_bdcmsg occurs0.

include struture bdcmsgcoll.

DATA:End of tbl_bdcmsg.

CALL TRANSACTION 'FBZ5' USING bdcdata MODE 'N' messages into tbl_bdcmsg.

</b>

Thanks

Manju

Former Member
0 Kudos

Hi,

Warning and information messages are automatically ignored in BDC.

so u cant catch that into int table