Dec27

Using BRFPlus

T-Code: BRFPlus

2021-12-27_13-46-09.jpg

*----------------------------------------------------------------------*
***INCLUDE SAPMZNEOLCL_FRM.
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_8000  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form USER_COMMAND_8000
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
FORM user_command_8000 .
  CASE OK_CODE.
    WHEN 'EXIT'.
      LEAVE PROGRAM.
    WHEN 'OK'.
      PERFORM GET_TITLE_BRFPLUS.
      GV_TITLE = GO_TITLE->GET_TITLE( ).
    WHEN OTHERS.
  ENDCASE.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form GET_TITLE_BRFPLUS
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
FORM get_title_brfplus .
  CONSTANTS:lv_function_id TYPE if_fdt_types=>id 
      VALUE '000C29473A601EEC99C3CB03DF2449F6'.
  DATA:lv_timestamp TYPE timestamp,
       lt_name_value TYPE abap_parmbind_tab,
       ls_name_value TYPE abap_parmbind,
       lr_data TYPE REF TO data,
       lx_fdt TYPE REF TO cx_fdt,
       la_age TYPE if_fdt_types=>element_number,
       la_type TYPE if_fdt_types=>element_text,
       la_sex TYPE if_fdt_types=>element_text,
       la_eyear TYPE if_fdt_types=>element_number,
       la_title TYPE if_fdt_types=>element_text,
       LV_RESULT TYPE CHAR15.
  FIELD-SYMBOLS <la_any> TYPE any.
  ls_name_value-name = 'AGE'.
  la_AGE = 30.
  GET REFERENCE OF la_AGE INTO lr_data.
  ls_name_value-value = lr_data.
  INSERT ls_name_value INTO TABLE lt_name_value.
  CLEAR ls_name_value.
*************************************************************************
  ls_name_value-name = 'TYPE'.
  la_TYPE = 'TEACHER'.
  GET REFERENCE OF la_TYPE INTO lr_data.
  ls_name_value-value = lr_data.
  INSERT ls_name_value INTO TABLE lt_name_value.
  CLEAR ls_name_value.
*********************************************************************
  ls_name_value-name = 'SEX'.
  la_SEX = 'MALE'.
  GET REFERENCE OF la_SEX INTO lr_data.
  ls_name_value-value = lr_data.
  INSERT ls_name_value INTO TABLE lt_name_value.
  CLEAR ls_name_value.
**********************************************************************
  ls_name_value-name = 'EYEAR'.
  GET REFERENCE OF la_EYEAR INTO lr_data.
  ls_name_value-value = lr_data.
  INSERT ls_name_value INTO TABLE lt_name_value.
  CLEAR ls_name_value.
**********************************************************************
  ls_name_value-name = 'TITLE'.
  GET REFERENCE OF la_TITLE INTO lr_data.
  ls_name_value-value = lr_data.
  INSERT ls_name_value INTO TABLE lt_name_value.
  CLEAR ls_name_value.
***********************************************************************
* Create the data to store the result value after processing the functi
* You can skip the following call, if you already have
* a variable for the result. Please replace also the parameter
* EA_RESULT in the method call CL_FDT_FUNCTION_PROCESS=>PROCESS
* with the desired variable.
***********************************************************************
  cl_fdt_function_process=>get_data_object_reference
    ( EXPORTING iv_function_id      = lv_function_id
                            iv_data_object      = '_V_RESULT'
                            iv_timestamp        = lv_timestamp
                            iv_trace_generation = abap_false
                  IMPORTING er_data             = lr_data ).
  ASSIGN lr_data->* TO <la_any>.
  TRY.
      cl_fdt_function_process=>process( 
      EXPORTING iv_function_id = lv_function_id
                          iv_timestamp   = lv_timestamp
                IMPORTING ea_result      = <la_any>
                CHANGING  ct_name_value  = lt_name_value ).
      LV_RESULT = <la_any>.
      GO_TITLE->SET_TITLE( LV_RESULT ).
      CATCH cx_fdt into lx_fdt.
  ENDTRY.
ENDFORM.


本篇文章已有0条评论