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: 

Passing message text from external RFC server into SAP EXCEPTION parameter

former_member202002
Active Participant
0 Kudos

In function module CREDIT_CARD_SETTLEMENT the following DYNAMIC function module call exists:

  • ------ Send items for settlement to a RFC function -------------------

CALL FUNCTION l_fnset

DESTINATION l_rfcset

EXPORTING i_ccseth = i_ccseth

TABLES t_settab = t_settab

t_setexd_h = t_setexd_h

t_setexd_i = t_setexd_i

EXCEPTIONS system_failure = 01 MESSAGE rfc_msg_text

communication_failure = 02 MESSAGE rfc_msg_text

call_function_not_found = 03.

This is the code which calls an external credit card application server. I'm trying to figure out how, on the server side, I can return a message into the rfc_msg_text variable on the system_failure or communication_failure EXCEPTIONS.

I’ve found several examples of this construct in ABAP code in the SAP side – but I can’t for the life of me find anything that shows how to set this up in our external server.

There are several SAP function modules like RFC_PING that have similar constructs – but I can’t see the compiled C code to tell what command to use to fill in that text. I can raise the exception, just not fill in the text.

Any ideas?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Eric,

I do not quite understand the problem.

Is there an external NON-SAP system, that needs to do the call?

Within any external SAP system (inside the RFC Function Module) you can raise exceptions in the following manner:

MESSAGE e398(00) WITH par1 par2 par3 par4 RAISING exception_1.

Message 398 in class 00 contains only & & & & as text.

Each & is replaced by par1 through par4.

Suppose par1='Order' par2='1234' par3='invalid' par4=''.

Then a message would be build like: Order 1234 invalid.

This all would reside in the remote called function module.

When you call this module and after any exception in the call the addition MESSAGE rfc_msg_txt was put, then the variable rfc_msg_txt='Order 1234 invalid'.

But as already stated before, i'm not quite sure what the problem is. Shed some light to it.

Greetz,

Rob.

5 REPLIES 5

Former Member
0 Kudos

Hi Eric,

I do not quite understand the problem.

Is there an external NON-SAP system, that needs to do the call?

Within any external SAP system (inside the RFC Function Module) you can raise exceptions in the following manner:

MESSAGE e398(00) WITH par1 par2 par3 par4 RAISING exception_1.

Message 398 in class 00 contains only & & & & as text.

Each & is replaced by par1 through par4.

Suppose par1='Order' par2='1234' par3='invalid' par4=''.

Then a message would be build like: Order 1234 invalid.

This all would reside in the remote called function module.

When you call this module and after any exception in the call the addition MESSAGE rfc_msg_txt was put, then the variable rfc_msg_txt='Order 1234 invalid'.

But as already stated before, i'm not quite sure what the problem is. Shed some light to it.

Greetz,

Rob.

Former Member
0 Kudos

Hello Eric,

If I have understood your requirement correctly, then you want to populate the RFC_MSG_TEXT variable yourself. I'm afraid that is not possible.

Obviously, if that were to be possible, then the code has to go into the function module that gets called, as Rob has mentioned. But as you have already observed, the call to the Function Module is <i>dynamic</i>, ie., you do not know which function module will be called. So there's no way you can get to have your own messages in RFC_MSG_TEXT.

But if you can do some kind of configuration where in you always know which FM will be called and if it is a custom FM, then you could think about doing it.

Regards,

Anand Mandalika.

0 Kudos

Let me clarify - the function module code I posted is used to call out of SAP to an EXTERNAL server.

In parameter l_fnset we would put a known function module on our EXTERNAL server. In parameter l_rfcset would be a destination from transaction SM59.

What I'd like to know is what RFC command can be used to send a text from our EXTERNAL server into the text RFC_MSG_TEXT.

I know this is possible, if I try to perform a single test in transaction SM59 for a destination that is NOT connected then the variable receives a text message.

I'm guessing it's something like SAPRFC_ERROR or similar, but I have yet to find a good example.

Does that clear up my question?

0 Kudos

Hello Eric,

Are you saying that you are not able to achieve getting any result into the RFC_MSG_TEXT variable for the function call?

Or are you asking for how you can have your own messages in the RFC_MSG_TEXT variable?

Regards,

Anand Mandalika.

0 Kudos

Anand,

I'm saying both really. I can get the proper EXCEPTION to be called so that the SY-SUBRC value is set to '1' for the SYSTEM_FAILURE exception or '2' for the COMMUNICATION_FAILURE exception.

However, in both cases I'm not able to get a text string into the RFC_MSG_TEXT variable.

That's what I'm trying to figure out.

Thanks!

Eric