SAP 实例 6 HTML input
REPORT demo_html_input. CLASS demo DEFINITION.
PUBLIC SECTION.
CLASS-METHODS main.
PRIVATE SECTION.
CLASS-METHODS handle_sapevent
FOR EVENT sapevent
OF cl_abap_browser
IMPORTING action
query_table.
ENDCLASS. CLASS demo IMPLEMENTATION.
METHOD main.
DATA error_list TYPE cl_abap_browser=>html_table. SET HANDLER handle_sapevent. DATA(html_str) =
`<html>`
&& ` <head>`
&& ` <meta http-equiv="content-type" `
&& ` content="text/html; `
&& ` charset=utf-8">`
&& ` <script language="JavaScript">`
&& ` function sendInput(form) `
&& ` { fname=form.name; `
&& ` document[fname].submit();} `
&& ` function InputKeyDown(form) {`
&& ` if(event.keyCode == 13) {`
&& ` fname=form.name;`
&& ` document[fname].submit();} }`
&& ` </script>`
&& ` </head>`
&& ` <body>`
&& ` <form name="INPUT" accept-charset="utf-8" `
&& ` method="post" action="SAPEVENT:INPUT"> `
&& ` <input type="text" id="in1" name="field1" `
&& ` size=30 maxlength=30 title="" value="aaa" `
&& ` onKeyDown="InputKeyDown(this.form);"><br>`
&& ` <input type="text" id="in2" name="field2" `
&& ` size=30 maxlength=30 title="" value="bbb" `
&& ` onKeyDown="InputKeyDown(this.form);"><br>`
&& ` <input type="text" id="in3" name="field3" `
&& ` size=30 maxlength=30 title="" value="ccc" `
&& ` onKeyDown="InputKeyDown(this.form);"><br><br>`
&& ` <button id="enterButton" type="button" `
&& ` title="Enter" onClick="sendInput(INPUT);" `
&& ` onKeypress="if(event.keycode=13) `
&& ` sendInput(INPUT);">`
&& ` Enter</button>`
&& ` </form>`
&& ` </body>`
&& `</html>`. cl_abap_browser=>show_html(
EXPORTING
html_string = html_str
title = 'Input Demo'
IMPORTING
html_errors = error_list ). IF error_list IS NOT INITIAL.
MESSAGE 'Error in HTML' TYPE 'I' DISPLAY LIKE 'E'.
ENDIF.
ENDMETHOD.
METHOD handle_sapevent.
DATA(out) = cl_demo_output_stream=>open( ).
SET HANDLER cl_demo_output_html=>handle_output FOR out.
out->write_data( iv_name = 'ACTION' ia_value = action ).
out->write_data( iv_name = 'QUERY_TABLE' ia_value = query_table ).
out->close( ).
ENDMETHOD.
ENDCLASS. START-OF-SELECTION.
demo=>main( ).
Description
This example creates a HTML file containing multiple input fields, a pushbutton, and JavaScript functions for handling the input. The form INPUT uses method="post" to send the input data. The HTML control in CFW uses the parameter QUERY_TABLE of the event SAPEVENT to pass this data to its handler. The class CL_ABAP_BROWSER (a wrapper for the class CL_GUI_HTML_VIEWER also passes this parameter and the user input can be used in the ABAP program.
Also see the corresponding example for ICF.

SAP 实例 6 HTML input的更多相关文章
- SAP 实例 10 List Box with value list from input help
*&---------------------------------------------------------------------* *& Report DEMO_DROP ...
- SAP 实例 4 CFW
*&---------------------------------------------------------------------* *& Report demo_cfw ...
- Vue实例:演示input 和 textarea 元素中使用 v-model 实现双向数据绑定
最终效果: 主要代码: <template> <div> <p>input 元素:</p> <input v-model="messag ...
- SAP 实例- 下拉框
效果图 源代码 REPORT rsdemo_dropdown_listbox . DATA init. TABLES scarr. TABLES spfli. TABLES sflight. TABL ...
- SAP 实例- 页签tabsrip
屏幕页签:项目上有一需求,对标准TCODE 一个屏幕增加一个页签.于是做了个例子. 下面屏幕有两个页签. 我们来看一下屏幕结构.100屏幕是主屏幕,101,102是子屏幕,对应页签test1,test ...
- SAP 实例 12 List Box with Value List from PBO Module
REPORT demo_dynpro_dropdown_listbox. DATA: name TYPE vrm_id, list TYPE vrm_values, value LIKE LINE O ...
- SAP 实例 8 HTML from the MIME Repository
REPORT demo_html_from_mime. CLASS mime_demo DEFINITION. PUBLIC SECTION. CLASS-METHODS main. PRIVATE ...
- SAP 实例 5 CFW Events
REPORT demo_custom_control . * Declarations ***************************************************** CL ...
- SAP 实例 3 Context Menus
REPORT demo_dynpro_context_menu. DATA: field1 TYPE i VALUE 10, field2 TYPE p DECIMALS 4. DATA: prog ...
随机推荐
- 7-19(排序) 寻找大富翁 (25 分)(归并排序)(C语言实现)
7-19(排序) 寻找大富翁 (25 分) 胡润研究院的调查显示,截至2017年底,中国个人资产超过1亿元的高净值人群达15万人.假设给出N个人的个人资产值,请快速找出资产排前M位的大富翁. 输入格式 ...
- html 移动端与PC端之间的转换
href 里面写路径 if ((navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackB ...
- css 进阶实战项目
1. html 结构 <!DOCTYPE html> <html lang="en"> <head> <meta charset=&quo ...
- 别像弱智一样提问 Stop-Ask-Questions-The-Stupid-Ways
https://github.com/xcr1234/Stop-Ask-Questions-The-Stupid-Ways 你真的准备好了吗? 感谢群友 for you 提供 避免 xy-proble ...
- CoAP调试工具Mozi.IoT.CoAP应用详解
前言 CoAP是一种类HTTP协议的物联网专用协议,其数据包为人类不可阅读的字节流形式,在开发相关应用的时候往往不能准确的了解数据包的内容.故需要专用的调试工具对数据和通讯进行调试.这篇文章是为了让开 ...
- Python 中删除列表元素的三种方法
列表基本上是 Python 中最常用的数据结构之一了,并且删除操作也是经常使用的. 那到底有哪些方法可以删除列表中的元素呢?这篇文章就来总结一下. 一共有三种方法,分别是 remove,pop 和 d ...
- Java 15 新特性:文本块
大家好,我是DD,今天继续来学点Java的新特性! 假设有这样一个场景,我们需要做一个工具.用来自动生成项目文档,文档可以通过浏览器查看,所以最后产出物肯定是一堆html文件.为了让这些html文件更 ...
- C++进阶-3-5-set/multiset容器
C++进阶-3-5-set/multiset容器 1 #include<iostream> 2 #include<set> 3 using namespace std; 4 5 ...
- idea maven 依赖还原不上的问题 method <init>()V not found
问题 还原项目依赖的时候报错: java.lang.RuntimeException: org.codehaus.plexus.component.repository.exception.Compo ...
- sa-token 配置 CORS
return new SaServletFilter() ... .setBeforeAuth(r -> { // 前置函数,在认证函数每次执行前执行 // 设置一些安全响应头之类的玩意 SaH ...