cancel
Showing results for 
Search instead for 
Did you mean: 

RFC Exception Handling

Former Member
0 Kudos

Originally I posted this in the Scripting forum, but there were no replies. Hopefully this is the correct forum for such a question.

I'm using Excel to upload a file to a "Z" transaction. My problem is there were errors in the RFC and I couldn't trap them. Found and fixed the problem, however, I still want to include exception handling should something else to wrong.

Basically I doing the following;

ReturnCode = objRFC.call

If not ReturnCode = "True" then

Message = objRFC.imports("E_MESSAGE_ERROR")

msgbox Message

End if

This doesn't work. Can someone please point me in the correct direction.

Thanks,

Bob

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Bob,

Try out -

On Error GoTo Err_handler

'your code goes here

'..............................

'..............................

Err_handler:

msgbox "......"

Regards.

Former Member
0 Kudos

Thanks Jitesh, but I have error handling for the vba code as you suggest and it works fine.

What I need is error handling for the RFC that I can trap and display to the user

Former Member
0 Kudos

Hi Bob,

Can you please explain it in little detail ?

Are you talking about handling exception/error inside RFC?

As a general practise you can populate structre BAPIRET2 with Id and Message in RFC and can retrurn to the client application.

In the client application you can first check whether this table is empty and then only proceed with the execution.

Regards.

Former Member
0 Kudos

Hi again Jitesh,

I'm not an ABAPer, and do the .net side of things. Here is what I have in Excel now;

Set objRFC = objLogon.Add("ZRFC_CALL_TRANSACTION_USING")

'/Set the export parameters:

objRFC.exports("PATH") = DTAddress & "TAPSHEET.CSV"

retCode = objRFC.call '/get return code

'/If the return code is not True, then display a message

If Not retCode Then

'Message = objRFC.imports("E_MESSAGE_ERROR")

Message = "Error Encountered"

MsgBox Message & vbCr & "Please notify BIS", vbCritical, "RFC ERROR"

End If

We are uploading the .csv file to a "Z" transaction. It all works just fine now. However we encountered some problems while developing which occured in the RFC. So now I'm trying to provide some response to the user should a exception/error happen inside the RFC in the future.

Thanks for your help

Bob

Answers (0)