0% found this document useful (0 votes)
133 views7 pages

BRFPlus

This document discusses calling a BRF+ function from ABAP code. It provides an example of getting the BRF+ function object, setting input parameters, calling the process method, and getting the return value. It then splits the return value and checks it against table values, generating error messages if not valid.

Uploaded by

marianalarab
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
133 views7 pages

BRFPlus

This document discusses calling a BRF+ function from ABAP code. It provides an example of getting the BRF+ function object, setting input parameters, calling the process method, and getting the return value. It then splits the return value and checks it against table values, generating error messages if not valid.

Uploaded by

marianalarab
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Transaçã o: BRFPLUS ou BRF+

Vai abrir um webdynpro

Cria-se uma aplicação com regras e uma função a ser chamada

Para abrir uma já existente


Regra
Funçã o: Para ser chamada no có digo abap

Simulando a funçã o
Chamando a BRF num có digo ABAP

TYPES: BEGIN OF yl_knttp,
         knttp TYPE eban-knttp,
       END OF yl_knttp.

DATA: lo_brf_function TYPE REF TO if_fdt_function,
      lo_brf_context  TYPE REF TO if_fdt_context,
      lo_brf_result   TYPE REF TO if_fdt_result.

DATA: lx_brf_fdt TYPE REF TO cx_fdt.

DATA: lv_id_brf     TYPE fdt_admn_0000-id,
      lv_class_cont TYPE string.

DATA: el_msg  TYPE bapiret2,
      el_eban LIKE LINE OF im_t_eban.

DATA: tl_knttp TYPE TABLE OF yl_knttp,
      tl_eban  TYPE mereq_t_eban.

* Find BRF+ Name Function
SELECT id
  UP TO 1 ROWS
  FROM fdt_admn_0000
  INTO lv_id_brf
  WHERE name      EQ 'ZMM_FUN_BRF_VAL_RC'
  AND object_type EQ 'FU'
  AND deleted     EQ space.
ENDSELECT.

IF sy-subrc NE 0.
  MESSAGE i077(/aif/mes) WITH 'ZMM_FUN_BRF_VAL_RC' INTO el_msg-message.
  el_msg-type = 'I'.
  el_msg-id = '/AIF/MES'.
  el_msg-number = '077'.
  el_msg-message_v1 = 'ZMM_FUN_BRF_VAL_RC'.

  APPEND el_msg TO ex_messages.
  CLEAR el_msg.

  EXIT.
ENDIF.

tl_eban[] = im_t_eban[].

CLEAR el_eban.
READ TABLE tl_eban INTO el_eban INDEX 1.
CHECK sy-subrc EQ 0.

* Implement BRF Function
lo_brf_function ?= cl_fdt_factory=>if_fdt_factory~get_instance(
                                   )->get_function(
                                         iv_id = lv_id_brf ).
TRY.
    lo_brf_context = lo_brf_function->get_process_context( ).
    lo_brf_context->set_value(
                       iv_name  = 'BBSRT' “Nome do parâmetro
                       ia_value = el_eban-bsart ). “Valor do param
    lo_brf_function->process(
                       EXPORTING io_context = lo_brf_context
                       IMPORTING eo_result  = lo_brf_result ).
    lo_brf_result->get_value(
                     IMPORTING ea_value = lv_class_cont ). “Retorno

  CATCH cx_fdt INTO lx_brf_fdt.
ENDTRY.

CHECK NOT lv_class_cont IS INITIAL.

SPLIT lv_class_cont AT ';' INTO TABLE tl_knttp.

CLEAR el_eban.
LOOP AT tl_eban INTO el_eban.
  CHECK el_eban-loekz IS INITIAL AND el_eban-knttp IS NOT INITIAL.
  READ TABLE tl_knttp TRANSPORTING NO FIELDS WITH KEY knttp = el_eban-knttp BI
NARY SEARCH.
  IF sy-subrc NE 0.
    "Item & NÃO POSSUI classificação contábil permitida para requisição &
    MESSAGE e024(zmm) WITH el_eban-bnfpo el_eban-bsart INTO el_msg-message.
    el_msg-type = 'E'.
    el_msg-id = 'ZMM'.
    el_msg-number = '024'.
    el_msg-message_v1 = el_eban-bnfpo.
    el_msg-message_v2 = el_eban-bsart.

    APPEND el_msg TO ex_messages.
    CLEAR el_msg.

    EXIT.
  ENDIF.
ENDLOOP.

OBS: O select acima é para obter um GUID.. já que cada mandatante gera o seu
SELECT id
  UP TO 1 ROWS
  FROM fdt_admn_0000
  INTO lv_id_brf
  WHERE name      EQ 'ZMM_FUN_BRF_VAL_RC'
  AND object_type EQ 'FU'
  AND deleted     EQ space.
ENDSELECT.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy