![使用Pattern调用自建的模板 使用Pattern调用自建的模板](https://i-blog.csdnimg.cn/blog_migrate/a4c26d1e5885305701be709a3d33442f.gif)
效果:
利用的是表:TSE05
可以自己进入该表查看相关信息
上例实例代码:
REPORT ZLM_TEST_MOBAN
.
*&---------------------------------------------------------------------*
*&变量定义
*&---------------------------------------------------------------------*
DATA : wa_tse05 TYPE tse05 ,
it_tse05 TYPE TABLE OF tse05 .
*&---------------------------------------------------------------------*
*&变量定义
*&---------------------------------------------------------------------*
wa_tse05 -app_obj = 'ABAP' .
wa_tse05 -keyword = 'REPORT1' . "key
wa_tse05 - position = 1 . "第一行
wa_tse05 - line = '*&---------------------------------------------------------------------*' .
APPEND wa_tse05 TO it_tse05 .
wa_tse05 -app_obj = 'ABAP' .
wa_tse05 -keyword = 'REPORT1' .
wa_tse05 - position = 2 . "第二行
wa_tse05 - line = '*& 程序名 :' .
APPEND wa_tse05 TO it_tse05 .
wa_tse05 -app_obj = 'ABAP' .
wa_tse05 -keyword = 'REPORT1' .
wa_tse05 - position = 3 . "第三行
wa_tse05 - line = '*& 功能说明:' .
APPEND wa_tse05 TO it_tse05 .
wa_tse05 -app_obj = 'ABAP' .
wa_tse05 -keyword = 'REPORT1' .
wa_tse05 - position = 4 .
wa_tse05 - line = '**& 创建人 :' .
APPEND wa_tse05 TO it_tse05 .
wa_tse05 -app_obj = 'ABAP' .
wa_tse05 -keyword = 'REPORT1' .
wa_tse05 - position = 5 .
wa_tse05 - line = '*& 创建时间:' .
APPEND wa_tse05 TO it_tse05 .
wa_tse05 -app_obj = 'ABAP' .
wa_tse05 -keyword = 'REPORT1' .
wa_tse05 - position = 6 .
wa_tse05 - line = '*& 修改记录:' .
APPEND wa_tse05 TO it_tse05 .
wa_tse05 -app_obj = 'ABAP' .
wa_tse05 -keyword = 'REPORT1' .
wa_tse05 - position = 7 .
wa_tse05 - line = '*& 请求号|修改人|修改时间' .
APPEND wa_tse05 TO it_tse05 .
wa_tse05 -app_obj = 'ABAP' .
wa_tse05 -keyword = 'REPORT1' .
wa_tse05 - position = 8 .
wa_tse05 - line = '*&---------------------------------------------------------------------*' .
APPEND wa_tse05 TO it_tse05 .
MODIFY tse05 FROM TABLE it_tse05 .
*&变量定义
*&---------------------------------------------------------------------*
DATA : wa_tse05 TYPE tse05 ,
it_tse05 TYPE TABLE OF tse05 .
*&---------------------------------------------------------------------*
*&变量定义
*&---------------------------------------------------------------------*
wa_tse05 -app_obj = 'ABAP' .
wa_tse05 -keyword = 'REPORT1' . "key
wa_tse05 - position = 1 . "第一行
wa_tse05 - line = '*&---------------------------------------------------------------------*' .
APPEND wa_tse05 TO it_tse05 .
wa_tse05 -app_obj = 'ABAP' .
wa_tse05 -keyword = 'REPORT1' .
wa_tse05 - position = 2 . "第二行
wa_tse05 - line = '*& 程序名 :' .
APPEND wa_tse05 TO it_tse05 .
wa_tse05 -app_obj = 'ABAP' .
wa_tse05 -keyword = 'REPORT1' .
wa_tse05 - position = 3 . "第三行
wa_tse05 - line = '*& 功能说明:' .
APPEND wa_tse05 TO it_tse05 .
wa_tse05 -app_obj = 'ABAP' .
wa_tse05 -keyword = 'REPORT1' .
wa_tse05 - position = 4 .
wa_tse05 - line = '**& 创建人 :' .
APPEND wa_tse05 TO it_tse05 .
wa_tse05 -app_obj = 'ABAP' .
wa_tse05 -keyword = 'REPORT1' .
wa_tse05 - position = 5 .
wa_tse05 - line = '*& 创建时间:' .
APPEND wa_tse05 TO it_tse05 .
wa_tse05 -app_obj = 'ABAP' .
wa_tse05 -keyword = 'REPORT1' .
wa_tse05 - position = 6 .
wa_tse05 - line = '*& 修改记录:' .
APPEND wa_tse05 TO it_tse05 .
wa_tse05 -app_obj = 'ABAP' .
wa_tse05 -keyword = 'REPORT1' .
wa_tse05 - position = 7 .
wa_tse05 - line = '*& 请求号|修改人|修改时间' .
APPEND wa_tse05 TO it_tse05 .
wa_tse05 -app_obj = 'ABAP' .
wa_tse05 -keyword = 'REPORT1' .
wa_tse05 - position = 8 .
wa_tse05 - line = '*&---------------------------------------------------------------------*' .
APPEND wa_tse05 TO it_tse05 .
MODIFY tse05 FROM TABLE it_tse05 .
这段代码执行完后,就没用了.