cl_gui_html_viewer缓存,How to refresh HTML container from HTML button in CL_GUI_HTML_VIEWER?

博客内容涉及在HTML中通过按钮刷新容器的实现。作者遇到了一个无限循环的问题,当按下保存按钮时,代码进入了一个无限循环。尝试了do_refresh方法,但仅工作一次,然后再次进入循环。问题集中在如何清除已触发的事件标志。代码中展示了创建和注册事件、设置处理程序以及刷新HTML容器的相关逻辑。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Hello experts,

I want to refresh my HTML container from the button in HTML. I am having 2 methods 1 is to print HTML in container and another is ON_HTML_EVENT in which i call the first method to refresh the container.  As i press Save button of HTML it goes into infinite loop. i tried method do_refresh but this method works for the one time and then it again goes into the loop at RAISE SAPEVENT.  How should i clear the raised event flags ??

Please find the code below.   Thanks in advance.

CLASS lcl_class IMPLEMENTATION.

METHODmain.

IFmy_container ISINITIAL.

CREATEOBJECT my_container

EXPORTING

container_name ='HTML'

EXCEPTIONS

OTHERS=1.

ENDIF.

IFhtml_control ISINITIAL.

CREATEOBJECT html_control

EXPORTING

parent =my_container.

ENDIF.

DATAeventsTYPEcntl_simple_events.

DATAeventTYPEcntl_simple_event.

event-eventid =html_control->m_id_sapevent.

event-appl_event ='X'.

APPENDeventTOevents.

CALLMETHODhtml_control->set_registered_events

EXPORTING

events=events.

SETHANDLERme->on_html_event FORhtml_control.

CLEARe_data.

FREEts_data.

FREEhtml.

APPEND''

TOhtml.

APPEND'

'

.

.

.

.

.

.

.

.

.

.

TOhtml.

APPEND'

'"input type="submit" value="Submit"

TOhtml.

.

.

.

.

APPEND''

TOhtml.

APPEND''TOhtml.

CALLMETHODhtml_control->load_data

EXPORTING

type='text'

subtype              ='html'

IMPORTING

assigned_url         =w_url

CHANGING

data_table           =html

EXCEPTIONS

dp_invalid_parameter =1

dp_error_general     =2

cntl_error           =3

OTHERS=4.

IFsy-subrc <> 0.

ENDIF.

CALLMETHODhtml_control->show_url

EXPORTING

url                    =w_url

EXCEPTIONS

cntl_error             =1

cnht_error_not_allowed =2

cnht_error_parameter   =3

dp_error_general       =4

OTHERS=5.

IFsy-subrc <> 0.

ENDIF.

ENDMETHOD."main

METHODon_html_event.

DATA:l_string TYPEstring.

l_string =getdata.

DATA:lv_valid TYPExfeld,

lv_refresh TYPExfeld.

ifv_role =text-020or(wa_zctmm-STATUS =text-004

orwa_zctmm-STATUS =text-000orwa_zctmm-STATUS =text-001).

SPLITl_string AT'='INTOs1 s2.

SPLITs2 AT'&'INTOs3 s4.

SPLITs4 AT'='INTOs5 s6.

wa_av-att_name =s6.

wa_av-value=s3.

MODIFYit_av FROMwa_av TRANSPORTINGvalue

WHEREatt_name =wa_av-att_name.

CALLMETHODalv_grid2->check_changed_data

IMPORTING

e_valid   =lv_valid

CHANGING

c_refresh =lv_refresh.

" to refresh alv

CALLMETHODalv_grid2->refresh_table_display

EXCEPTIONS

finished =1

OTHERS=2.

flag1 =1.

PERFORMgen_long.

PERFORMgen_short.

DATA:lcl_oref TYPEREFTOlcl_class.

IFlcl_oref ISNOTBOUND.

CREATEOBJECT lcl_oref.

CALLMETHODlcl_oref->main.

ENDIF.

CALLMETHODhtml_control->DO_REFRESH.

ENDIF.

ENDMETHOD."on_html_event

ENDCLASS."lcl_class IMPLEMENTATION

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值