ITPub博客

首页 > 应用开发 > IT综合 > ABAP解析HTML文件-工行电子回单

ABAP解析HTML文件-工行电子回单

原创 IT综合 作者:zhaoshuhong 时间:2022-05-31 16:03:51 0 删除 编辑

*&---------------------------------------------------------------------*
*& Report Z2GCR_TEST_JAVASCRIPT,有违禁词,不费劲找了,删除部分内容
*&---------------------------------------------------------------------*
*&SAP工商银行网上电子回单,HTML部分从工行下载一个电子回单,然后查看源代码,copy即可
*&---------------------------------------------------------------------*
report z2gcr_test_javascript .

   data a  TYPE  c LENGTH  255 .

class lcl_class  definition .
   public  section .
     methods : main , on_html_event  for  event sapevent  of cl_gui_html_viewer
     importing action  frame getdata .
   protected  section .
   private  section .
     data ob_ref  type   ref  to cl_gui_html_viewer .
endclass .
class lcl_class  implementation .
   method main .

     data ob_lcl  type  ref  to lcl_class .
     data html  type w3htmltab .
     data url  type  c length  255 .
     create object ob_ref
       exporting
        parent  = cl_gui_container =>screen0 .
     data  events  type cntl_simple_events .
     data  event  type cntl_simple_event .
     event -eventid  = ob_ref ->m_id_sapevent .
     event -appl_event  =  'X' .
     append  event  to  events .
     call  method ob_ref ->set_registered_events
       exporting
         events  =  events .

     set  handler me ->on_html_event  for ob_ref .
     append  '<html>'  to html .
     append  '<meta charset="UTF-8">'  to html .
     append  '<table width="642">'  to html .
     append  '<tr>'  to html .
     append  '<td align="center" colspan="2"><font face="黑体" size="5">中国工商银行</font>&nbsp;&nbsp;&nbsp;网上银行电子回单'  to html .
    ......................
     append  '<tr>'  to html .
     append  '</html>'  to html .

    ob_ref ->load_data (  importing assigned_url  = url  changing data_table  = html  ) .
    ob_ref ->show_url ( url  = url  ) .
   endmethod .

   method on_html_event .
     data : l_string  type string .
    l_string  = getdata .
     message i001 ( 00 )  with l_string .
   endmethod .
endclass .

parameters : p_dummy  type  c length  1 .

data b  type  c LENGTH  255 .

at  selection-screen  output .

get  PARAMETER  ID  'WL_QTEXT'  FIELD a .

   data : lcl_oref  type  ref  to lcl_class .
   if lcl_oref  is  not  bound .
     create object lcl_oref .
     call  method lcl_oref ->main .
   endif .

   set  PARAMETER  ID  'WL_QTEXT'  FIELD  '' .

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/9859323/viewspace-2898190/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2009-09-27

  • 博文量
    42
  • 访问量
    117063