06-16-2009 10:05 AM
Hi abapers,
There is a FM 'L_TO_CREATE_DN' which is used in inbound idoc creation program .
Just after running this FM in the code , the idoc gives an error message.
I am checking through WE19.
I need to change the error message ,so I need to catch this message .
But as soon as I do a F6 on the FM the program gets executed and the output error message popsup.
How can I catch this message.
Please help.
Thanks,
Suchi.
06-16-2009 10:11 AM
Hi,
Check the Tables parameter of the FM.you'll find a parameter named T_WMGRP_MSG.
Check the Associated Type and you will find that the corresponding messages returned by this BAPI are getting stored here :
MSGNO
MSGID
MSGTY
MSGTX
From here you can catch the required message.
Reply back if need any further help on this.
Regards
06-16-2009 10:17 AM
Hi,
Fill the below fields and pass the values to T_WMGRP_MSG table of parameter :
MATNR :
MSGNO :
MSGID :
MSGTY :
MSGTX :
This way you can capture the message and pass your message .
06-16-2009 10:35 AM
The problem is as soon as I give F6 on the function module , the program gets executed giving the message.
So I am not able to see what does the table T_WMGRP_MSG return.
Please suggest.
06-16-2009 10:48 AM
put a break point at the FM source code and then debug to see what it returns.
06-16-2009 10:50 AM
Hi,
Please put some sy-subrc check after FM.
I have checked and break-point is stopping after execution(F6) of FM.
Below is the code for your reference.
DATA lt_msg TYPE TABLE OF wmgrp_msg.
CALL FUNCTION 'L_TO_CREATE_DN'
EXPORTING
i_lgnum = 'EX1'
i_vbeln = '80109392'
* I_REFNR = ' '
* I_SQUIT = ' '
* I_NIDRU = ' '
* I_DRUKZ = ' '
* I_LDEST = ' '
* I_KOMIM = ' '
* I_EINLM = ' '
* I_EINTA = ' '
* I_NOSPL = ' '
* I_UPDATE_TASK = ' '
* I_COMMIT_WORK = 'X'
* I_BNAME = SY-UNAME
* I_TEILK = ' '
* I_SOLEX = 0
* I_PERNR = 0
* IT_DELIT =
* IMPORTING
* E_TANUM =
* E_TEILK =
TABLES
* T_LTAK =
* T_LTAP_VB =
T_WMGRP_MSG = lt_msg
EXCEPTIONS
FOREIGN_LOCK = 1
DN_COMPLETED = 2
PARTIAL_DELIVERY_FORBIDDEN = 3
XFELD_WRONG = 4
LDEST_WRONG = 5
DRUKZ_WRONG = 6
DN_WRONG = 7
SQUIT_FORBIDDEN = 8
NO_TO_CREATED = 9
TEILK_WRONG = 10
UPDATE_WITHOUT_COMMIT = 11
NO_AUTHORITY = 12
NO_PICKING_ALLOWED = 13
DN_HU_NOT_CHOOSABLE = 14
INPUT_ERROR = 15
OTHERS = 16
.
IF sy-subrc <> 0. <- Cursor is stopped at this position After F6 at FM.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
WRITE 'A'.
06-16-2009 11:01 AM
Hi,
Call the RFC FM as follows:-
CALL FUNCTION 'L_TO_CREATE_DN' destination 'NONE'
EXPORTING
i_lgnum =
i_vbeln =
IMPORTING
E_TANUM =
E_TEILK =
TABLES
T_LTAK =
T_LTAP_VB =
T_WMGRP_MSG =
EXCEPTIONS
system_failure = 35
communication_failure = 36
error_message = 99
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
See the exceptions as called.
In this case you will not get the error message directly but it will be trapped and passed as an exception as in a normal FM.
Regards,
Ankur Parab
06-16-2009 12:53 PM
The error message that comes up is actually a standard message coming from a standard program SAPMV50A when the FM L_TO_CREATE_DN is triggered.(message class VL message no:198 )
Also X is passed to the I_COMMIT_WORK export parameter.
Is this the reason that by doing F6 the report directly executes?
Please suggest.
06-16-2009 7:15 PM
Hi,
The error comes directly becuase the exception has not been handled by using the RAISE statement.
Regards,
Ankur Parab