zoukankan      html  css  js  c++  java
  • ABAP-Dynamic-Internal table

    data:
          lr_any_t  type ref to data,
          lr_any_s  type ref to data.
        data:
          lr_dref   type ref to data,
          lr_stru   type ref to cl_abap_structdescr,
          lr_table  type ref to cl_abap_tabledescr,
          lr_elem   type ref to cl_abap_elemdescr,
          lt_para   type cl_abap_structdescr=>component_table,
          lt_comp   type cl_abap_structdescr=>component_table.
        field-symbols:
          <fs_tab>  type any,
          <ft_tab>  type standard table.
    
        try.
    
          lr_stru ?= cl_abap_tabledescr=>describe_by_data( it_any ).
    
          loop at lr_stru->components[] into data(ls_comps).
            if ls_comps-type_kind = 'P'
            or ls_comps-type_kind = 'X'.
            else.
              ls_comps-length = ls_comps-length / 2.
            endif.
    
            append initial line to lt_comp assigning field-symbol(<fs_comp>).
            <fs_comp>-name  =   ls_comps-name.
            <fs_comp>-type  ?=  cl_abap_elemdescr=>get_by_kind(
                                p_type_kind = ls_comps-type_kind
                                p_length = ls_comps-length
                                p_decimals = ls_comps-decimals ).
            unassign <fs_comp>.
          endloop.
    
          if lt_comp[] is not initial.
            clear:lr_stru,lr_table.
            lr_stru   =   cl_abap_structdescr=>create( lt_comp ).
            lr_table  =   cl_abap_tabledescr=>create( lr_stru ).
    
            create data lr_any_s type handle lr_stru.
            assign lr_any_s->* to <fs_tab>.
    
            create data lr_any_t type handle lr_table.
            assign lr_any_t->* to <ft_tab>.
          endif.
    
          move-corresponding it_any to <ft_tab>[].
    
          catch cx_root into data(lr_rt).
          data(lv_txt) = lr_rt->get_text( ).
          raise exception type zcx_root
            exporting
              textid = value #(
                         msgid = '00'
                         msgno = '001'
                         attr1 = lv_txt
                         ).
        endtry.
    View Code
  • 相关阅读:
    [转]WebService 之 WSDL文件 讲解
    WebService代理类的详解
    Net 多语言
    Net缓存使用
    分布式缓存的一些想法
    关于webdriver中弹出框的定位
    关于Autoit上传文件的问题
    webdriver中定位元素,报无法找到元素的问题
    java.net.SocketException: Software caused connection abort: socket write error
    接口测试之soupui&groovy
  • 原文地址:https://www.cnblogs.com/datie/p/14955388.html
Copyright © 2011-2022 走看看