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 ...
随机推荐
- 【面试普通人VS高手系列】CPU飙高系统反应慢怎么排查?
面试过程中,场景类的问题更容易检测出一个开发人员的基本能力. 这不,一个小伙伴去阿里面试,第一面就遇到了关于"CPU飙高系统反应慢怎么排查"的问题? 对于这个问题,我们来看看普通人 ...
- Codeforces Round #719 (Div. 3) C. Not Adjacent Matrix
地址 Problem - C - Codeforces 题意 每个格子,该格子和相邻的格子的值不能相同 题解 思维题, 先从1~n输出奇数,再输出偶数 代码 #include <iostream ...
- 论文解读(BGRL)《Bootstrapped Representation Learning on Graphs》
论文信息 论文标题:Bootstrapped Representation Learning on Graphs论文作者:Shantanu Thakoor, Corentin Tallec, Moha ...
- 元素滚动 scroll 系列
定义 : scroll翻译过来就是滚动的,我们使用scroll系列的相关属性可以动态的得到该元素的大小.滚动距离等. 常用属性 : 需要用到页面滚动事件scroll因为是页面滚动,所以事件源是docu ...
- selenium模块跳过用户名密码验证码输入,加载浏览器标签和cookie,进行翻页爬虫多页动态加载的数据(js)
能解决登陆一次后,之后不需要二次登陆的动态加载数据,网页保存的cookie和标签,加入到selenium自动化测试浏览器中 1 from selenium import webdriver 2 imp ...
- 03. 树莓派初始配置——安装vim编辑器
安装vim编辑器 树莓派系统默认是不带vim编辑器的,默认安装的vi编辑器在编辑文档的时候用得特别不舒服,对人体的血压和树莓派的寿命影响较大. 解决办法:一行命令 1. 安装vim编辑器 sudo a ...
- Spring Ioc源码分析系列--Ioc的基础知识准备
Spring Ioc源码分析系列--Ioc的基础知识准备 本系列文章代码基于Spring Framework 5.2.x Ioc的概念 在Spring里,Ioc的定义为The IoC Containe ...
- windows 10 21H1 顶部任务栏点击音量或其他图标不出弹框
右键任务栏,按照图片中描述操作
- 69. Sqrt(x) - LeetCode
Question 69. Sqrt(x) Solution 题目大意: 求一个数的平方根 思路: 二分查找 Python实现: def sqrt(x): l = 0 r = x + 1 while l ...
- git提交时写message的规范
message规范 angular示例 commit message(提交说明) git commit -m "写一行提交说明" # 跳出文本编辑器,写多行 git commit ...