Depois de muito pesquisar enfim cheguei em uma "solução" para o desenvolvimento de uma RFC para Integração de Funcionário (Dados mestre HR), então venho aqui compartilhar a codificação para que talvez possa servir de auxílio para alguém:
FUNCTION ZHR_INTER_FUNC.
*"----------------------------------------------------------------------
*"*"Interface local:
*" IMPORTING
*" VALUE(FUNC) TYPE ZHRE_INTER_FUNC
*" TABLES
*" RETORNO STRUCTURE BAPIRETURN1
*"----------------------------------------------------------------------
DATA: v_dialog_mode TYPE c VALUE '0', "1 - Exibir tela com erro
it_return1 LIKE bapireturn1,
it_pv TYPE STANDARD TABLE OF pprop,
wa_pv LIKE LINE OF it_pv.
wa_pv-infty = '0002'.
wa_pv-fname = 'P0002-ANRED'.
wa_pv-fval = func-anred.
APPEND wa_pv TO it_pv.
wa_pv-fname = 'P0002-NACHN'.
wa_pv-fval = func-nachn.
APPEND wa_pv TO it_pv.
wa_pv-fname = 'P0002-VORNA'.
wa_pv-fval = func-vorna.
APPEND wa_pv TO it_pv.
wa_pv-fname = 'P0002-CNAME'.
wa_pv-fval = func-cname.
APPEND wa_pv TO it_pv.
wa_pv-fname = 'P0002-GBDAT'.
wa_pv-fval = func-gbdat.
APPEND wa_pv TO it_pv.
wa_pv-fname = 'P0002-GESCH'.
wa_pv-fval = func-gesch.
APPEND wa_pv TO it_pv.
wa_pv-fname = 'P0002-SPRSL'.
wa_pv-fval = func-sprsl.
APPEND wa_pv TO it_pv.
wa_pv-fname = 'P0002-NATIO'.
wa_pv-fval = func-natio.
APPEND wa_pv TO it_pv.
wa_pv-infty = '0001'.
wa_pv-fname = 'P0001-BTRTL'.
wa_pv-fval = func-btrtl.
APPEND wa_pv TO it_pv.
wa_pv-fname = 'P0001-KOSTL'.
wa_pv-fval = func-kostl.
* APPEND wa_pv TO it_pv.
wa_pv-fname = 'P0001-GSBER'.
wa_pv-fval = func-gsber.
* APPEND wa_pv TO it_pv.
wa_pv-fname = 'P0001-ABKRS'.
wa_pv-fval = func-abkrs.
APPEND wa_pv TO it_pv.
wa_pv-fname = 'P0001-PLANS'.
wa_pv-fval = func-plans.
APPEND wa_pv TO it_pv.
wa_pv-fname = 'P0001-VDSK1'.
wa_pv-fval = func-vdsk1.
APPEND wa_pv TO it_pv.
wa_pv-infty = '0017'.
wa_pv-fname = 'P0017-ERKLA'.
wa_pv-fval = '1'.
APPEND wa_pv TO it_pv.
wa_pv-fname = 'P0017-ERGRU'.
wa_pv-fval = '1'.
APPEND wa_pv TO it_pv.
wa_pv-fname = 'P0017-SPEBE'.
wa_pv-fval = '1'.
APPEND wa_pv TO it_pv.
wa_pv-fname = 'P0017-PTZUO'.
wa_pv-fval = '1'.
APPEND wa_pv TO it_pv.
wa_pv-fname = 'P0017-PKWRG'.
wa_pv-fval = '1'.
APPEND wa_pv TO it_pv.
CALL FUNCTION 'HR_MAINTAIN_MASTERDATA'
EXPORTING
PERNR = func-pernr
MASSN = '56'
ACTIO = 'INS'
TCLAS = 'A'
BEGDA = func-begda
* ENDDA = '99991231'
* OBJPS =
* SEQNR =
* SPRPS =
* SUBTY = ' '
WERKS = func-werks
PERSG = func-persg
PERSK = func-persk
PLANS = func-plans
DIALOG_MODE = v_dialog_mode
LUW_MODE = '1'
NO_EXISTENCE_CHECK = 'X'
NO_ENQUEUE = ' '
IMPORTING
* RETURN =
RETURN1 = it_return1
* HR_RETURN =
TABLES
PROPOSED_VALUES = it_pv.
* MODIFIED_KEYS =
IF it_return1-type NE 'E'.
CLEAR it_return1.
it_return1-type = 'S'.
it_return1-message = 'Funcionário integrado com sucesso!'.
ENDIF.
APPEND it_return1 TO retorno.
ENDFUNCTION.
Nenhum comentário:
Postar um comentário