使用ABAP中的自定义消息引发异常 [英] Raise Exception with custom message in ABAP

查看:322
本文介绍了使用ABAP中的自定义消息引发异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要最简单的方法来在ABAP中用自定义消息引发异常。

I want the most simple way to raise an exception with a custom message in ABAP.

如果可以用尽可能少的字符完成操作,那将是很好的。

It would be great, if this could be done with few characters as possible. If possible on one line.

我希望这是为了调试,而不是运行生产代码。

I want this for debugging, not for running production code.

背景:过去,我使用Python编程语言。我喜欢在没有调试器的情况下进行调试。我在代码中加入了一些 assert 0,myvar 行并执行了代码。对我来说,这比传统调试器更快或更快进入代码行。我正在ABAP中搜索等效于 assert 0,mvar

Background: In the past I used the Python programming language. I like to debug without a debugger. I put some assert 0, myvar lines in to the code and execute the code. For me this feels faster then tradition debugger with stepping over or into code lines. I am searching for an equivalent to assert 0, mvar in ABAP.

引发异常只是我的策略现在我在想。欢迎使用其他达到总体目标的策略。

Raising an exception is just the strategy I have on my mind at the moment. Every other strategy to get to the overall goal is welcome.

我正在编写一个通过RFC调用的函数。

I am coding a function which gets called via RFC.

推荐答案

我发现这可行:

message my_string_var type 'E'.

我将消息类型 E仅添加到代码中。我从外部测试了我的ABAP代码(通过 PyRFC )。

I add the MESSAGE TYPE 'E' only temporary into the code. I test my ABAP code from outside (via PyRFC).

这篇关于使用ABAP中的自定义消息引发异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆