Chinaunix首页 | 论坛 | 博客
  • 博客访问: 481874
  • 博文数量: 199
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 1902
  • 用 户 组: 普通用户
  • 注册时间: 2020-05-14 13:25
个人简介

代码5S

文章分类

全部博文(199)

文章存档

2021年(5)

2020年(194)

我的朋友

分类: 其他平台

2020-10-14 15:39:50


点击(此处)折叠或打开

  1. REPORT zdemo16.

  2. DATA: gr_container TYPE REF TO cl_gui_container,
  3.       gr_control TYPE REF TO i_oi_container_control,
  4.       gr_document TYPE REF TO i_oi_document_proxy,
  5.       gr_spreadsheet TYPE REF TO i_oi_spreadsheet.

  6. DATA: gt_ranges TYPE soi_range_list,
  7.       gs_range TYPE soi_range_item,
  8.       gt_contents TYPE soi_generic_table,
  9.       gs_content TYPE soi_generic_item.

  10. PERFORM out_data.

  11. *&---------------------------------------------------------------------*
  12. *& Form get_container
  13. *&---------------------------------------------------------------------*
  14. * text
  15. *----------------------------------------------------------------------*
  16. FORM get_container.
  17.   gr_container = cl_gui_container=>screen0.
  18. ENDFORM. "get_container

  19. *&---------------------------------------------------------------------*
  20. *& Form create_container_control
  21. *&---------------------------------------------------------------------*
  22. * text
  23. *----------------------------------------------------------------------*
  24. FORM create_container_control.
  25. * create container control
  26.   CALL METHOD c_oi_container_control_creator=>get_container_control
  27.     IMPORTING
  28.       control = gr_control.

  29. * initialize control
  30.   CALL METHOD gr_control->init_control
  31.     EXPORTING
  32.       inplace_enabled = 'X '
  33.       inplace_scroll_documents = 'X'
  34.       register_on_close_event = 'X'
  35.       register_on_custom_event = 'X'
  36.       r3_application_name = 'DEMO'
  37.       parent = gr_container.
  38. ENDFORM. "create_container_control

  39. *&---------------------------------------------------------------------*
  40. *& Form create_excel_document
  41. *&---------------------------------------------------------------------*
  42. * text
  43. *----------------------------------------------------------------------*
  44. FORM create_excel_document.
  45.   CALL METHOD gr_control->get_document_proxy
  46.     EXPORTING
  47.       document_type = 'Excel.Sheet'
  48.       no_flush = 'X'
  49.     IMPORTING
  50.       document_proxy = gr_document.


  51.   CALL METHOD gr_document->create_document
  52.     EXPORTING
  53.       document_title = 'TEST TITLE'
  54.       no_flush = 'X '
  55.       open_inplace = 'X'.
  56. ENDFORM. "create_excel_document

  57. *&---------------------------------------------------------------------*
  58. *& Form main
  59. *&---------------------------------------------------------------------*
  60. * text
  61. *----------------------------------------------------------------------*
  62. FORM out_data.
  63. *skip 1 必须,否则创建不了屏幕
  64.   SKIP 1.

  65.   PERFORM get_container.
  66.   PERFORM create_container_control.
  67.   PERFORM create_excel_document.

  68.   CALL METHOD gr_document->get_spreadsheet_interface
  69.     EXPORTING
  70.       no_flush = 'X'
  71.     IMPORTING
  72.       sheet_interface = gr_spreadsheet.

  73.   CALL METHOD gr_spreadsheet->select_sheet
  74.     EXPORTING
  75.       name = 'Sheet1'
  76.       no_flush = 'X'.


  77.   CALL METHOD gr_spreadsheet->insert_range_dim
  78.     EXPORTING
  79.       name = 'cell'
  80.       no_flush = 'X'
  81.       top = 1
  82.       left = 1
  83.       rows = 2
  84.       columns = 2.

  85.   CLEAR gs_range.
  86.   CLEAR gt_ranges[].
  87.   gs_range-name = 'cell'.
  88.   gs_range-rows = 2.
  89.   gs_range-columns = 2.
  90.   gs_range-code = 4.
  91.   APPEND gs_range TO gt_ranges.

  92.   DEFINE write_content_cell.
  93.     gs_content-row = &1.
  94.     gs_content-column = &2.
  95.     gs_content-value = &3.
  96.     append gs_content to gt_contents.
  97.     clear gs_content.
  98.   END-OF-DEFINITION.

  99.   write_content_cell 1 1 'TEST11'.
  100.   write_content_cell 1 2 'TEST12'.

  101.   write_content_cell 2 1 'TEST21'.
  102.   write_content_cell 2 2 'TEST22'.

  103.   CALL METHOD gr_spreadsheet->set_ranges_data
  104.     EXPORTING
  105.       ranges = gt_ranges
  106.       contents = gt_contents
  107.       no_flush = 'X'.
  108. ENDFORM. "out_data

阅读(1700) | 评论(0) | 转发(0) |
0

上一篇:SE78 Download image

下一篇:ABAP EXTRACT

给主人留下些什么吧!~~