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 ...
随机推荐
- Linux下安装Typora
系统:Ubuntu16.0 下载链接:https://www.typora.io/#linux 参考链接:https://www.cnblogs.com/wenkangzero/p/13202415. ...
- RPC及Dubbo和ZooKeeper的安装
RPC及Dubbo和ZooKeeper的安装 RPC 通信有两种方式:HTTP(无状态协议,通信协议),RPC(远程过程调用) 它两的本质没有区别,只是功能有点不一样 官方解释: RPC是指远程过程调 ...
- 安卓记账本开发学习day2
今天遇到了xml文件报错,Wrong orientation? No orientation specified, and the default is horizontal, yet this la ...
- Codeforces Round #707 (Div. 2)A.英语漏洞 + C.Going Home C题收获不小
A题英语漏洞 A题传送门: https://codeforces.com/contest/1501/problem/A 其实题目说的很明白, 只是我傻傻的会错了意, 话不多说, 开整. 前两行是说, ...
- 百度飞桨数据处理 API 数据格式 HWC CHW 和 PIL 图像处理之间的关系
使用百度飞桨 API 例如:Resize Normalize,处理数据的时候. Resize:如果输入的图像是 PIL 读取的图像这个数据格式是 HWC ,Resize 就需要 HWC 格式的数据. ...
- Python获取文件夹下的所有文件名
1 #获取文件夹内的图片 2 import os 3 def get_imlist(path): 4 return [os.path.join(path,f) for f in os.listdir( ...
- 《图解UE4渲染体系》Part 0 引擎基础
在介绍UE4渲染体系前,我们有必要来先看一下UE4是用什么样的方式来构建游戏场景数据的. 1 Object 在UE4中当我们说Object,通常是指代引擎代码中的UObject类,它是引擎里管理绝大部 ...
- 用浏览器快速开启Docker的体验之旅
互联网科技发展创造了很多奇迹,比如我今天要提到的 docker 技术就是其一.我很早就关注它(在2015年写过这方面的博客),那会儿还只是一个开源项目,现在已经是一个行业事实标准了,它推动了云原生的变 ...
- SSH 证书登录教程
开源Linux 专注分享开源技术知识 SSH 是服务器登录工具,提供密码登录和密钥登录. 但是,SSH 还有第三种登录方法,那就是证书登录.很多情况下,它是更合理.更安全的登录方法,本文就介绍这种登录 ...
- Blazor和Vue对比学习(基础1.2):模板语法和Razor语法
Vue使用模板语法,Blazor使用祖传的Razor语法,从逻辑和方向上看,两者极为相似,比如: 都基于HTML 都通过声明式地将组件实例的状态(数据/方法)绑定到呈现的DOM上 都通过指令实现更加丰 ...