2013 Oct 31 5:58 AM
Hi All,
I am running a BDC for Transaction IM40 and IM48, which are used for Budget allocation and Budget Reversal. If there is a case where the Actually amount for eg is 100 and we are trying to reverse 150. In this case if we do the reversal manually it gives an error saying 'Budget Allocation for that respective order no is incorrect', In the same way if we run the BDC it gives us error in MESSTAB with msgnr as 101 and msgclass as BP. Using this if we refer se91, it simply tells us to refer the error LOG.
Please help in capturing that error msg witout refering that error LOG in the LOGIC.
Regards,
Uma
Hi All,
I am running a BDC for Transaction IM40 and IM48, which are used for Budget allocation and Budget Reversal. If there is a case where the Actually amount for eg is 100 and we are trying to reverse 150. In this case if we do the reversal manually it gives an error saying 'Budget Allocation for that respective order no is incorrect', In the same way if we run the BDC it gives us error in MESSTAB with msgnr as 101 and msgclass as BP. Using this if we refer se91, it simply tells us to refer the error LOG.
Please help in capturing that error msg witout refering that error LOG in the LOGIC.
Regards,
Uma
2013 Oct 31 7:14 AM
How many message you get in MESSTAB check in debugging.. You must be getting more than one
2013 Oct 31 7:21 AM
Hello Uma,
After the call transaction method, write the below code .
CALL TRANSACTION 'MM01' USING it_bdcdata
OPTIONS FROM options
MESSAGES INTO it_messages.
DATA v_message TYPE char100.
LOOP AT it_messages.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = it_messages-MSGID
LANG = it_messages-msgspra
NO = it_messages-MSGNR
V1 = it_messages-MSGV1
V2 = it_messages-MSGV2
V3 = it_messages-MSGV3
V4 = it_messages-MSGV4
IMPORTING
MSG = v_message
* 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_message.
ENDLOOP.
2013 Oct 31 7:28 AM
Use the Function Module : FORMAT_MESSAGE to get the details of Message.
Pass here MSGID,MSGNO and MSGV1,MSGV2,MSGV3,MSGV4 and Import the message using variable.(LV_MESSAGE TYPE CHAR200).
if anything else u need tell me , I will give u in details
Thanks
tarak
2013 Oct 31 7:34 AM
Hi-
Could you place a screen shot of your debugging screen showing entries in message_tab.
-Venkat
2013 Oct 31 8:53 AM
Hi all ,
My BDC logic is working correct. My only problm is to capture the msg.
Thanks for your prompt response. Actually i am getting MSG's into the Messtab but the problem is , if i am referring the MSGID in SE91 it is asking to refer error LOG, where i am able to get the correct Error MSG, but wen dis kind of error comes instead of referring the error log i want to capture that msg with a logic in the code..
and the screen shot is as follows..
2013 Oct 31 9:17 AM
Hi , use the below code to capture the error messages.
CALL TRANSACTION TCODE USING gt_bdcdata
MODE 'N'
UPDATE 'S'
MESSAGES INTO lt_messtab.
LOOP AT lt_messtab INTO ls_messtab WHERE msgtyp = 'E' .
*&-- get the message.
CALL FUNCTION 'MESSAGE_TEXT_BUILD'
EXPORTING
msgid = ls_messtab-msgid
msgnr = ls_messtab-msgnr
msgv1 = ls_messtab-msgv1
msgv2 = ls_messtab-msgv2
msgv3 = ls_messtab-msgv3
msgv4 = ls_messtab-msgv4
IMPORTING
message_text_output = ls_output-msg.
ls_output-status = 'E'.
APPEND ls_output TO gt_output.
ENDLOOP.
2013 Oct 31 9:34 AM
Hi,
Now i am getting the text " refer to error Log ", But this is not the needed msg, if we refer to the error log there will be correct msg I need this msg to be displayed.
Regards
Uma
2013 Oct 31 9:44 AM
Hi,
CALL TRANSACTION 'VA02' USING bdcdata MODE 'N' UPDATE 'S'
MESSAGES INTO messtab.
*Check if update was succesful
IF sy-subrc NE 0.
*Retrieve error messages displayed during BDC update
LOOP AT messtab WHERE msgtyp = 'E'.
*Builds actual message based on info returned from Call transaction
CALL FUNCTION 'MESSAGE_TEXT_BUILD'
EXPORTING
msgid = messtab-msgid
msgnr = messtab-msgnr
msgv1 = messtab-msgv1
msgv2 = messtab-msgv2
msgv3 = messtab-msgv3
msgv4 = messtab-msgv4
IMPORTING
message_text_output = w_textout.
ENDLOOP.
* Build error table ready for output
it_error-vbeln = it_final-vbeln.
it_error-mabnr = it_final-mabnr.
it_error-kunnr = it_final-kunnr.
it_error-guebg = it_final-guebg.
it_error-err_msg = w_textout.
APPEND it_error.
CLEAR it_error.
ENDIF.
* Clear bdc data table
CLEAR: bdcdata.
REFRESH: bdcdata.
ENDLOOP.
Note -it_error then can then be displayed in the ALV Report which conatin all error records
Cheers,
Vikas
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |