• Simple ALV with custom table


      REPORT  ZTESTFORGG_OOALV_NO_CONTAINER.
    tables sflight.
    data: begin of test,
          f1(10) type C,
          f2(10) type C,
        end of test.
    data: it_out like standard table of test,
          wa_out like line of it_out.
    data: f_cat type lvc_t_fcat,
          wa_f_cat type lvc_s_fcat.
    data: it_sflight type standard table of sflight.
    start-of-selection.
    select from sflight into table it_sflight up to 100 rows.
    wa_out-f1 = 'gaivn'.
    wa_out-f2 = 'test'.
    append wa_out to it_out.
    wa_out-f1 = 'gaivn2'.
    wa_out-f2 = 'test2'.
    append wa_out to it_out.
      wa_f_cat-FIELDNAME = 'F1'.
      wa_f_cat-SCRTEXT_L = 'Type'.
      wa_f_cat-SCRTEXT_M = 'Type'.
      wa_f_cat-SCRTEXT_S = 'Type'.
      append wa_f_cat to f_cat.
      wa_f_cat-FIELDNAME = 'F2'.
      wa_f_cat-SCRTEXT_L = 'Message'.
      wa_f_cat-SCRTEXT_M = 'Message'.
      wa_f_cat-SCRTEXT_S = 'Message'.
      append wa_f_cat to f_cat.

    data: l_alv type ref to cl_gui_alv_grid.
    create object l_alv
    exporting
      i_parent = cl_gui_container=>screen0.
    call method l_alv->set_table_for_first_display
    exporting
      i_structure_name = 'test'
    changing
      it_fieldcatalog = f_cat
      it_outtab = it_out.
    write: ''.

    结尾的write很重要,没有的话不会显示。

  • 相关阅读:
    usaco-ariprog1-pass
    usaco-crypt1-pass
    usaco-barn-repair-pass-KISS
    usaco-mixing milk-pass
    面试HR
    LCS求最长公共子序列(DP)
    毕业随想(转载)
    0-1背包问题(DP)
    排序算法
    二叉搜索树的实现 java
  • 原文地址:https://www.cnblogs.com/yanluckly/p/1783738.html
Copyright © 2020-2023  润新知