Description:

This blog describes about the creation of a BRF+ application dynamically using CL_FDT* classes collection.

Pre-requisites:

1. Basic knowledge on OO ABAP concepts

2. Basic knowledge on BRF+ framework

Requirement:

Creation of BRF+ Application through a Simple report.

Interfaces Used:

1.if_fdt_factory

2. if_fdt_application

Here is the code snippet.

Step-1: Paste the below in your report. Each step in the code is explained in detail through comments.

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_message          TYPE string,

       lv_boolean          TYPE abap_bool,

       lv_demo_appl_id     TYPE if_fdt_types=>id,

       lv_string           TYPE string.

PARAMETER: pv_lcl TYPE abap_bool RADIOBUTTON GROUP r00 DEFAULT ‘X’,

            pv_sys TYPE abap_bool RADIOBUTTON GROUP r00,

            pv_mstr TYPE abap_bool RADIOBUTTON GROUP r00.


* get a reference to the instance of the factory

lo_factory = cl_fdt_factory=>if_fdt_factory~get_instance( ).

* =============================================================

* definition of the new application:

* get an initial application object from the factory

lo_application = lo_factory->get_application( ).

lo_application->if_fdt_transaction~enqueue( ).


* set values for the application, especially the name is important

* You need to have a unique name for each application, here we use the

* FDT Service class method to get the unique name.

lo_application->set_application_component( ‘BC’ ).    “#EC NOTEXT

lo_application->set_software_component(‘SAP_BASIS’)“#EC NOTEXT

lo_application->set_development_package( ‘$TMP’ )“#EC NOTEXT


*If you want the system to generate a unique name for you application

*Uncomment the below three lines

*data lv_name type if_fdt_types=>name.

*lv_name = cl_fdt_services=>get_unique_name( ).

*lo_application->if_fdt_admin_data~set_name( lv_name ).


*Provide a user defined name to your application

lo_application->if_fdt_admin_data~set_name( Sample_app). “#EC NOTEXT   ——————————“Sample_app” is the application name.


* In FDT terms there are 3 different type of Applications, Local application,

* system pplication and MasterData Application. The following lines shows how you

* can create local Application, masterdata Application and system Application.

IF pv_lcl EQ abap_true.

   lo_application->create_local_application( ).

ELSEIF pv_sys EQ abap_true.

   lo_application->create_system_application( ).

ELSEIF pv_mstr eq abap_true.

   lo_application->CREATE_MASTERDATA_APPLICATION( ).

ENDIF.

*To activate the application and you can see the error messages in lt_message if any errors occurred during activation

lo_application->if_fdt_transaction~activate(

            IMPORTING et_message           = lt_message

                      ev_activation_failed = lv_boolean ).


IF lv_boolean EQ abap_true.

*     for some reason the activation failed -> individual handling needed

   lo_application->if_fdt_transaction~dequeue( ).

ELSE.

   lo_application->if_fdt_transaction~save( ).

   lo_application->if_fdt_transaction~dequeue( ).

*     usually it makes sense to store the id for later access to the application

   lv_demo_appl_id = lo_application->mv_id.

ENDIF.

WRITE: ‘The ID of the application created is: ‘, lv_demo_appl_id. “#EC NOTEXT


Step-2: Click on execute button.

Step-3: You can see the below selection screen. There are three types of applications in BRF+.

1. Customizing/Local Application

2. Master data Application

3. System Application

Selection screen.png

Step-4: Select the type of Application you want to create and Click on execute button.

Application ID.png

Step-5: Copy the generated Application ID.

Step-6: Goto BRF+ workbench.

BRF+ tcode.png

Step-7: You can see the below workbench logon page in your default browser. Provide the User credentials and Click on “Logon” button as shown below.

BRF+ workbench logon pad.png

Step-8: You can see the application created in the workbench with the properties provided in the report.

BRF+ Application.png

You are done with creation of a BRF+ application dynamically.

I will continue posting blogs for dynamic creation of Data Objects, Expressions, Rules and Rulesets very soon.

Thanks,

Sowjanya M





To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply