ABAP DynPro 中具有语法突出显示的文本区域

发布于 2024-12-22 18:46:36 字数 173 浏览 1 评论 0原文

有没有ABAP自定义控件可以实现语法高亮?我使用的是 DynPro,而不是 Web Dynpro。

我想显示一个突出显示 XML 代码的文本区域。如果我可以将光标移动到文本区域内以及代码内的某个位置,那就太好了。

我可以使用 cl_gui_textedit 来完成此操作吗?

Is there an ABAP custom control with which I can realize syntax highlightning? I am using DynPro and not Web Dynpro.

I want to display a textarea which highlights XML code. It would also be great if I could move the cursor to a certain position inside the textarea and therefore inside the code.

Can I do this with cl_gui_textedit?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

甜嗑 2024-12-29 18:46:36

您可以使用 cl_gui_html_viewer 类在 SAP GUI 中显示 XML 代码。该控件默认使用 Internet Explorer 显示 HTML 内容,并且还能够显示 XML 内容。
这里有一些快速入门的示例代码,可以帮助您入门。它是一个程序的一部分,该程序有一个屏幕 100,包含一个名为 XMLDEMO 的自定义控件(高度 27,宽度 120)。

报告 zxmldemo:

report zxmldemo.
include zxmldemo_status_0100o01.
start-of-selection.
  set screen '100'.

并包含 zxmldemo_status_0100o01:

module status_0100 output.
  data xmlstringtable type standard table of char255.
  append '<?xml version="1.0" encoding="ISO-8859-1"?>' to xmlstringtable.
  append '<note><to>Tove</to><from>Jani</from>' to xmlstringtable.
  append '<heading>Reminder</heading>' to xmlstringtable.
  append '<body>Don''t forget me this weekend!</body></note>' to xmlstringtable.
  data container type ref to cl_gui_custom_container.
  create object container
    exporting
      container_name = 'XMLDEMO'.
  data htmlviewer type ref to cl_gui_html_viewer.
  create object htmlviewer
    exporting
      parent = container.
  data url(1024) type c value 'test.xml'.
  htmlviewer->load_data( exporting url = url type = 'text' subtype = 'xml'
                         changing data_table = xmlstringtable ).
  htmlviewer->show_url( url ).
endmodule.

我认为不可能显示和移动光标。

You can use the cl_gui_html_viewer class to display XML code in the SAP GUI. This control uses Internet Explorer by default to display HTML content, and is also capable of showing XML content.
Here's some quick-and-dirty sample code to get you started. It's part of a program which has one screen 100, containing a custom control named XMLDEMO (height 27, width 120).

The report zxmldemo:

report zxmldemo.
include zxmldemo_status_0100o01.
start-of-selection.
  set screen '100'.

And the include zxmldemo_status_0100o01:

module status_0100 output.
  data xmlstringtable type standard table of char255.
  append '<?xml version="1.0" encoding="ISO-8859-1"?>' to xmlstringtable.
  append '<note><to>Tove</to><from>Jani</from>' to xmlstringtable.
  append '<heading>Reminder</heading>' to xmlstringtable.
  append '<body>Don''t forget me this weekend!</body></note>' to xmlstringtable.
  data container type ref to cl_gui_custom_container.
  create object container
    exporting
      container_name = 'XMLDEMO'.
  data htmlviewer type ref to cl_gui_html_viewer.
  create object htmlviewer
    exporting
      parent = container.
  data url(1024) type c value 'test.xml'.
  htmlviewer->load_data( exporting url = url type = 'text' subtype = 'xml'
                         changing data_table = xmlstringtable ).
  htmlviewer->show_url( url ).
endmodule.

I don't think it's possible to show and move the cursor.

心不设防 2024-12-29 18:46:36

您可以在客户端上使用任何 ActiveX 对象或支持 OLE 自动化的对象,并在 SAP GUI 屏幕的自定义控件内运行该对象。如果你谷歌一下,我想你可能会找到适合你需求的东西。然后,您可以在屏幕上建立自定义控制区域并在其中运行应用程序。

当然,这要求您预先知道相关应用程序已安装在客户端上,并且如果您无法从 ABAP 实例化它,则可以向用户发出错误。

You can use any ActiveX object or object that supports OLE automation on the client and run that inside a custom control in a SAP GUI screen. If you Google around, I think you may find something to suit your needs. Then, you can establish a custom control area on the screen and run the application inside there.

This requires of course that you know upfront that the application in question is installed on the client, and if you are not able to instantiate it from ABAP, you can give a an error to the user.

锦爱 2024-12-29 18:46:36

改进 René 的答案:如果您有 HTML 控件,您不妨加载一些基于 HTML 的编辑器,例如 EditArea 进入其中而不是源文档,并在该编辑器中显示和/或编辑 XML。

Improving on René`s answer: if you have an HTML control, you might as well load some HTML-based editor like EditArea into it instead of source document and show and/or edit XML in that editor.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文