Advertisement
Guest User

Untitled

a guest
May 20th, 2021
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ABAP 3.71 KB | None | 0 0
  1. FUNCTION ZCALL_BRF_FUNCTION.
  2. *"----------------------------------------------------------------------
  3. *"*"Local Interface:
  4. *"  IMPORTING
  5. *"     REFERENCE(LV_PERNR) TYPE  HR_PERNR
  6. *"  EXPORTING
  7. *"     REFERENCE(LS_OUTPUT) TYPE  ZSTR_RESULT_TABLE_BRF
  8. *"----------------------------------------------------------------------
  9.  
  10.   CONSTANTS:lv_function_id TYPE if_fdt_types=>id VALUE '7D38983183C51EDBADE77C7792487DB1'.
  11.   DATA:lv_timestamp TYPE timestamp,
  12.        lt_name_value TYPE abap_parmbind_tab,
  13.        ls_name_value TYPE abap_parmbind,
  14.        lr_data TYPE REF TO data,
  15.        lx_fdt TYPE REF TO cx_fdt,
  16.        la_de_pernr TYPE if_fdt_types=>element_text.
  17.   FIELD-SYMBOLS <la_any> TYPE any.
  18. ****************************************************************************************************
  19. * All method calls within one processing cycle calling the same function must use the same timestamp.
  20. * For subsequent calls of the same function, we recommend to use the same timestamp for all calls.
  21. * This is to improve the system performance.
  22. ****************************************************************************************************
  23. * If you are using structures or tables without DDIC binding, you have to declare the respective types
  24. * by yourself. Insert the according data type at the respective source code line.
  25. ****************************************************************************************************
  26.   GET TIME STAMP FIELD lv_timestamp.
  27. ****************************************************************************************************
  28. * Process a function without recording trace data, passing context data objects via a name/value table.
  29. ****************************************************************************************************
  30. * Prepare function processing:
  31. ****************************************************************************************************
  32.   ls_name_value-name = 'DE_PERNR'.
  33.   la_DE_PERNR = lv_pernr.
  34.   GET REFERENCE OF la_DE_PERNR INTO lr_data.
  35.   ls_name_value-value = lr_data.
  36.   INSERT ls_name_value INTO TABLE lt_name_value.
  37. ****************************************************************************************************
  38. * Create the data to store the result value after processing the function
  39. * You can skip the following call, if you already have
  40. * a variable for the result. Please replace also the parameter
  41. * EA_RESULT in the method call CL_FDT_FUNCTION_PROCESS=>PROCESS
  42. * with the desired variable.
  43. ****************************************************************************************************
  44.   cl_fdt_function_process=>get_data_object_reference( EXPORTING iv_function_id      = lv_function_id
  45.                                                                 iv_data_object      = '_V_RESULT'
  46.                                                                 iv_timestamp        = lv_timestamp
  47.                                                                iv_trace_generation = abap_false
  48.                                                        IMPORTING er_data             = lr_data ).
  49.   ASSIGN lr_data->* TO <la_any>.
  50.   TRY.
  51.       cl_fdt_function_process=>process( EXPORTING iv_function_id = lv_function_id
  52.                                                   iv_timestamp   = lv_timestamp
  53.                                         IMPORTING ea_result      = ls_output
  54.                                         CHANGING  ct_name_value  = lt_name_value ).
  55.       CATCH cx_fdt into lx_fdt.
  56. ****************************************************************************************************
  57. * You can check CX_FDT->MT_MESSAGE for error handling.
  58. ****************************************************************************************************
  59.   ENDTRY.
  60.  
  61. ENDFUNCTION.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement