zoukankan      html  css  js  c++  java
  • 进阶:案例三: Upload File using WebDynpro

    1、节点创建,其中DATASOURCE存放uploadfile名称

    2.layout布局

    3、upload事件代码:

    method ONACTIONUPLOAD .
      DATA: lo_Node type ref to If_Wd_Context_Node,
    lo_Elem type ref to If_Wd_Context_Element,
    lw_datasour type xstring,
    lw_string type string,
    lt_data type TABLE OF string,
    lt_field type TABLE OF string,
    lv_field TYPE string,
    ls_context type wd_this->Element_sflight,
    lt_context type wd_this->Elements_sflight .
    * get the datasource Xstring
    wd_context->get_attribute(
    EXPORTING name = 'DATASOURCE'
      IMPORTING value = lw_datasour ).
    * convert the XString ==> string
    * CALL FUNCTION 'ECATT_CONV_XSTRING_TO_STRING'
    * EXPORTING
    * IM_XSTRING = lw_datasour
    * IM_ENCODING = 'UNICODE'
    * IMPORTING
    * EX_STRING = lw_string.
    DATA: conv TYPE REF TO CL_ABAP_CONV_IN_CE.
    CALL METHOD CL_ABAP_CONV_IN_CE=>CREATE
    EXPORTING
      INPUT = lw_datasour
      ENCODING = 'UTF-8'
      REPLACEMENT = '?'
      IGNORE_CERR = ABAP_TRUE
      RECEIVING CONV = conv.
    conv->READ( importing data = lw_string ).
    * get the data of file
    split lw_string at cl_abap_char_utilities=>newline into TABLE lt_data.
    * delete the header
    DELETE lt_data INDEX 1.
    * get all the field name
    LOOP AT lt_data into lw_string.
      SPLIT lw_string at cl_abap_char_utilities=>horizontal_tab into table lt_field.
    ***get all the 3 fields of one line
      READ TABLE lt_field INTO lv_field INDEX 1.
      ls_context-carrid = lv_field.
      READ TABLE lt_field INTO lv_field INDEX 2.
      ls_context-connid = lv_field.
      READ TABLE lt_field INTO lv_field INDEX 3.
      ls_context-text = lv_field.
      append ls_context to lt_context.
      ENDLOOP.
    * bind table
    lo_node = wd_context->get_child_node( 'SFLIGHT' ).
    lo_node->bind_table( lt_context ).
    endmethod.
  • 相关阅读:
    别了,DjVu!
    DjVu转PDF
    我的电子书历程
    连续翻页浏览器面临的共同问题
    对超过2TB的硬盘进行分区需要使用parted
    DB2常用命令
    CentOS增加网卡
    mysql相关参数解读
    max_user_connections参数设置试验
    mysql最大连接数试验
  • 原文地址:https://www.cnblogs.com/caizjian/p/4365124.html
Copyright © 2011-2022 走看看