Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
jahnavi_venati
Explorer
0 Kudos

Hi Everyone,

  • Suppose if we require to display the expression name,GUID,last changed by,text of a Boolean expression in brf+ .

Let us take multiple Boolean expressions in BRF+ Application as shown below.

Here we have two Boolean expressions EXP_TEST_1 and EXP_TEST_2 in Z_BOL_TEST_w application.

  • Boolean expression (EXP_TEST_1)

To display the Boolean expression (EXP_TEST_1) details like Boolean expression name , Boolean expression GUID, Last changed by ,Text as shown in below screen shots.

  • Likewise for Boolean expression (EXP_TEST_2) we have following details shown in below screen shot.

  • Now we will use the following code to get Boolean expression details and upload those details in to Application server.
    *constants declarations

CONSTANTSgc_appl_id    TYPE if_fdt_types=>id  VALUE '005056C000081ED58ADDAB4AA60FF5F2',

  gc_semi_colon    TYPE char01 VALUE ';',

  gc_x                       TYPE char1     VALUE 'X',

  gc_csv                   TYPE string    VALUE 'csv'.

*types declarations

TYPES: BEGIN OF ty_id,

                   id TYPE if_fdt_types=>id,

               END OF ty_id,

              BEGIN OF ty_boolean,

                 name         TYPE if_fdt_types=>name,

                 id               TYPE if_fdt_types=>id,

                 last_user TYPE sy-uname,

                 text           TYPE if_fdt_types=>text,

             END OF ty_boolean,

              tt_id TYPE  STANDARD TABLE OF  ty_id,

              tt_boolean TYPE  STANDARD TABLE OF ty_boolean.

*variable declarations

DATA: lref_boolean                 TYPE REF TO    if_fdt_boolean,

             lref_factory                  TYPE REF TO if_fdt_factory,

             lv_bol_id            TYPE if_fdt_types=>id,

             it_id TYPE STANDARD TABLE OF  ty_id,

             wa_id TYPE   ty_id,

             it_boolean TYPE STANDARD TABLE OF ty_boolean,

             wa_boolean TYPE ty_boolean,

             lv_last_chged_user TYPE sy-uname,

             lv_text TYPE if_fdt_types=>text,

             lv_name  TYPE if_fdt_types=>name.

*selection screen

SELECTION-SCREEN BEGIN OF BLOCK b1.

               SELECT-OPTIONS:s_bol_id FOR  lv_bol_id.

                PARAMETERS:p_file TYPE string.

SELECTION-SCREEN END OF BLOCK b1.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

*for applicatin server file

   PERFORM get_appl_server_filepath_input CHANGING p_file.

START-OF-SELECTION.

*fill boolean ids from the select options

   LOOP AT s_bol_id WHERE option = 'EQ' AND sign ='I'.

                       wa_id-id  = s_bol_id-low.

                      APPEND wa_id TO it_id.

   ENDLOOP.

*generic factory instance

   lref_factory = cl_fdt_factory=>if_fdt_factory~get_instance( gc_appl_id ).

*generic factory instance

   lref_factory = cl_fdt_factory=>if_fdt_factory~get_instance( gc_appl_id ).

*get boolean details

   PERFORM boolean_details USING it_id

   CHANGING it_boolean .

* upload boolean details into application server file path

   PERFORM upload_boolean_data USING it_boolean

   p_file .

*f4 help for filepath

FORM get_appl_server_filepath_input

CHANGING p_ap_file TYPE string.

   DATA:l_title   TYPE  string.

   l_title = text-001.

   CALL METHOD cl_rsan_ut_files=>f4

     EXPORTING

       i_applserv       = gc_x

       i_title          = l_title

       i_gui_extension  = gc_csv

       i_gui_ext_filter = gc_csv

     CHANGING

       c_file_name      = p_ap_file

     EXCEPTIONS

       failed           = 1

       OTHERS           = 2.

ENDFORM.                          "get_appl_server_filepath_input

*&---------------------------------------------------------------------*

*&      Form  boolean_details

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*      -->PIT_IT       text

*      -->PIT_BOOLEAN  text

*----------------------------------------------------------------------*

FORM boolean_details USING  pit_it TYPE tt_id

CHANGING pit_boolean TYPE tt_boolean.

**processing the boolean expression for details

   LOOP AT pit_it INTO wa_id.

     lref_boolean ?= lref_factory->get_expression(

     iv_id wa_id-id ).

*get boolean name

     TRY.

         lref_boolean->if_fdt_admin_data~get_name(

         RECEIVING

         rv_name      lv_name

         ).

       CATCH cx_fdt_input .

         IF sy-subrc EQ 0.

           MESSAGE text-002 TYPE 'I'.

         ENDIF.

     ENDTRY.

* get last changed user

     TRY.

         lref_boolean->if_fdt_admin_data~get_change_info(

         IMPORTING

         ev_change_user        = lv_last_chged_user

         ).

       CATCH cx_fdt_input.

         IF sy-subrc EQ 0.

           MESSAGE text-003 TYPE 'I'.

         ENDIF.

     ENDTRY.

* get description

     lref_boolean->if_fdt_admin_data~get_texts(

     IMPORTING

     ev_text    =   lv_text

     ).

*Fill the boolean expression details

     wa_boolean-name = lv_name.

     wa_boolean-id   = wa_id-id.

     wa_boolean-last_user = lv_last_chged_user.

     wa_boolean-text    = lv_text.

     APPEND wa_boolean TO pit_boolean.

     CLEAR wa_boolean.

   ENDLOOP.

ENDFORM.                    "boolean_details

*&---------------------------------------------------------------------*

*&      Form  upload_boolean_data

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*      -->PIT_BOOLEAN   text

*      -->PIV_FILENAME  text

*----------------------------------------------------------------------*

FORM upload_boolean_data USING pit_boolean TYPE tt_boolean

piv_filename TYPE string.

   DATAwa_boolean_tmp TYPE ty_boolean,

   lv_var TYPE string.

   IF pit_boolean IS NOT INITIAL.

* open file

     OPEN DATASET piv_filename FOR OUTPUT IN TEXT MODE ENCODING  UTF-8 .

     IF sy-subrc EQ 0.

       LOOP AT pit_boolean INTO wa_boolean_tmp.

         CONCATENATE wa_boolean_tmp-name

         wa_boolean_tmp-id

         wa_boolean_tmp-last_user

         wa_boolean_tmp-text INTO lv_var SEPARATED BY gc_semi_colon.

         TRANSFER lv_var TO piv_filename.

       ENDLOOP.

       WRITE:'Data uploaded successfully in Application server'.

     ENDIF.

*close file

     CLOSE DATASET piv_filename.

     CLEAR piv_filename.

   ENDIF.

ENDFORM.                    "upload_boolean_data

  • Provide multiple Boolean GUID’S and Application server file path then click on AL11 Files as shown below.

  • Choose any of the directories as shown in below screen shot.

  • Select any file and Copy file name as shown below.

  • Then Click execute.

  • We get the Following output.

  • Now open Tcode AL11 and open the filepath for the boolean expression details. Double click on filename ABC.CSV

  • We get following the boolean expression details from EXP_TEST_1 and EXP_TEST_2 Booleans.

Labels in this area