‎2007 Jun 04 10:42 AM
Hi Gurus,
Please help me.
I am having a function module BDC_OPEN_GROUP.
In this we are having 11 exceptions.
I have to catch these exceptions and display an error message if sy-subrc ne 0.
Promise to reward points
Mac
‎2007 Jun 04 10:48 AM
Hi ,
You can use Catch .. End Catch syntax .
Please look in that .
‎2007 Jun 04 10:45 AM
Use the statement Raise
Just like this
if sy-subrc ne 0.
Raise <exception name>.
endif.
Thanks
‎2007 Jun 04 10:48 AM
Hi ,
You can use Catch .. End Catch syntax .
Please look in that .
‎2007 Jun 04 10:57 AM
Hi Mohan,
In the driver program u want to catch the exception right?
use like this.
if sy-subrc <> 0
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO.
endif.
If the given solution is not suitable means tell me your problem clearly
Thanks,
Suma.
‎2007 Jun 04 10:59 AM
if sy-subrc ne 0.
message message-id wiht ' all the variables of the exception can be put here',
endif.
‎2007 Jun 04 11:38 AM
Hi Mac,
In the calling program you code should look something like this:
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING " -->> If required
CLIENT = SY-MANDT
DEST = FILLER8
GROUP = FILLER12
HOLDDATE = FILLER8
KEEP = FILLER1
USER = FILLER12
RECORD = FILLER1
PROG = SY-CPROG
IMPORTING "-- >> If required
QID =
EXCEPTIONS
CLIENT_INVALID = 1
DESTINATION_INVALID = 2
GROUP_INVALID = 3
GROUP_IS_LOCKED = 4
HOLDDATE_INVALID = 5
INTERNAL_ERROR = 6
QUEUE_ERROR = 7
RUNNING = 8
SYSTEM_LOCK_ERROR = 9
USER_INVALID = 10
OTHERS = 11
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
This will definitely work.
Reward points if helpful.
Regards,
Renuka.
‎2007 Jun 04 11:59 AM
Hi Mohan,
If you've noticed, each of the 11 exceptions have a number assosciated with it. The significance of this number is, when a particular exception occur, the SY-SUBRC would take the number corresponding to that particular exception. Thus, you just to check for these numbers and handle the exceptions accordingly.
Hope this helps.
Regards
Anil Madhavan