how to create BRF application via code

简介: 使用如下代码自动创建新的BRF application:

使用如下代码自动创建新的BRF application:


REPORT zceate_application.

DEFINE write_errors.

 IF &1 IS NOT INITIAL.

 LOOP AT &1 ASSIGNING .

 WRITE: -text.

 ENDLOOP.

 RETURN.

 ENDIF.

END-OF-DEFINITION.

START-OF-SELECTION.

 DATA: lo_factory     TYPE REF TO if_fdt_factory,

       lo_application TYPE REF TO if_fdt_application,

       lt_message     TYPE if_fdt_types=>t_message,

       lv_boolean     TYPE abap_bool.

 FIELD-SYMBOLS:  TYPE if_fdt_types=>s_message.

 lo_factory = cl_fdt_factory=>if_fdt_factory~get_instance( ).

 lo_application = lo_factory->get_application( ).

 lo_application->if_fdt_transaction~enqueue( ).

 lo_application->set_development_package( '$TMP' ).

 lo_application->if_fdt_admin_data~set_name( 'PRICING' ).

 lo_application->if_fdt_admin_data~set_texts(

 iv_short_text = 'Pricing' ).

 lo_application->if_fdt_transaction~activate(

     IMPORTING et_message           = lt_message

               ev_activation_failed = lv_boolean ).

 write_errors lt_message.

 lo_application->if_fdt_transaction~save( ).

 lo_application->if_fdt_transaction~dequeue( ).

 lo_factory = cl_fdt_factory=>if_fdt_factory~get_instance(

 iv_application_id = lo_application->mv_id ).

 BREAK-POINT.

 WRITE:/ lo_application->mv_id.

记下输出的application id: FA163E8EAB031EE48B80D14409724BFF


使用BRF+ tcode打开BRF work bench:


利用如下搜索条件查找刚刚创建好的application:


image.png

找到匹配的application. 点击expand button查看header信息:

image.png



ID和report里输出一致,证明这就是report里刚刚创建的application:


image.png


相关文章
|
1月前
|
存储 供应链 搜索推荐
Spartacus product variant configuration sample data
Spartacus product variant configuration sample data
|
11月前
|
JSON 数据格式
UE4 structure and JSON conversion - DTBPJson plugin description
UE4 structure and JSON conversion - DTBPJson plugin description
65 0
SAP RETAIL MP30为物料Execute Forecast,报错- Status Forecast not defined –
SAP RETAIL MP30为物料Execute Forecast,报错- Status Forecast not defined –
SAP RETAIL MP30为物料Execute Forecast,报错- Status Forecast not defined –
SAP Fiori Elements - smart control demo1 currency field - how is manifest.json loaded
SAP Fiori Elements - smart control demo1 currency field - how is manifest.json loaded
115 0
SAP Fiori Elements - smart control demo1 currency field - how is manifest.json loaded
Cannot add product to Opportunity in Fiori - RFC error
Cannot add product to Opportunity in Fiori - RFC error
101 0
Cannot add product to Opportunity in Fiori - RFC error
|
XML 数据格式
SAP Fiori Elements - object detail batch roundtrip triggered by binding property in embedded xml vie
SAP Fiori Elements - object detail batch roundtrip triggered by binding property in embedded xml vie
93 0
SAP Fiori Elements - object detail batch roundtrip triggered by binding property in embedded xml vie
SAP Fiori application do filtering will real delete note in DB
SAP Fiori application do filtering will real delete note in DB
108 0
SAP Fiori application do filtering will real delete note in DB