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 ...
随机推荐
- layui下拉框渲染问题,以及回显问题
最近实习公司给的新人练手项目用的layui,layui之前自己也接触过但是也就是用了用table组件,没有用过layer弹层这些东西,所以就了解了一下. 首先遇到的一个问题就是下拉框没有样式,然后加样 ...
- Warmup小记
什么是warmup 热身,在刚刚开始训练时以很小的学习率进行训练,使得网络熟悉数据,随着训练的进行学习率慢慢变大,到了一定程度,以设置的初始学习率进行训练,接着过了一些inter后,学习率再慢慢变小: ...
- 好用的表单验证工具 vuelidate
Vue validation(表单验证)--vuelidate 表单是用户那里收集的数据的工具.如果它没有收集到你需要的数据,或者收集到的数据不对,那么你的表单就没有达到它的目的.这就是为什么我们需要 ...
- Codeforces Round #706 (Div. 2)B. Max and Mex __ 思维, 模拟
传送门 https://codeforces.com/contest/1496/problem/B 题目 Example input 5 4 1 0 1 3 4 3 1 0 1 4 3 0 0 1 4 ...
- 手写一个bind
1 Function.prototype.bind1 = function(){ 2 // 将类数组转化成数组 3 let arr = Array.prototype.slice.call(argum ...
- 「Python实用秘技07」pandas中鲜为人知的隐藏排序技巧
本文完整示例代码及文件已上传至我的Github仓库https://github.com/CNFeffery/PythonPracticalSkills 这是我的系列文章「Python实用秘技」的第7期 ...
- [Vue]写一个简单的文件上传控件
这篇将介绍如何写一个简单的基于Vue+Element的文件上传控件. 控件将具有 1. 上传队列的列表,显示文件名称,大小等信息,可以显示上传进度实时刷新 2. 取消上传 使用Element的u ...
- python学习-Day20
目录 今日内容详细 作业讲解 re模块补充说明 findall的优先级查询 通过索引的方式单独获取分组内匹配到的数据 分组之后还可以给组起别名 split的优先级查询 collections模块 具名 ...
- ASP.NET Web 应用 Docker踩坑历程
听说Docker这玩意挺长时间了,新建Web应用的时候,也注意到有个启用Docker的选项. 前两天扫了一眼<[大话云原生]煮饺子与docker.kubernetes之间的关系>,觉得有点 ...
- 小白必看:零基础安装Linux系统(超级详细)
我们以最新发布的CentOS 8.1为例,学习下如何安装Linux系统 准备工作: 1.一台可以访问互联网的电脑 2.VMware Workstation安装包 3.CentOS8.1镜像(CentO ...