Difference between revisions of "SAP HCM BADI"
From SapWiki
(Created page with "==ejemplo de BADI HRPAD00INFTY método IN_UPDATE (Tarea actualiz./Actualiz.infotipo)== * enviar datos a sistema externo al crear, modificar o borrar registros de IT2001 y IT2...") |
|||
Line 1: | Line 1: | ||
− | ==ejemplo de | + | ==BADI <nowiki>HRPAD00INFTY</nowiki>== |
+ | ===ejemplo de IN_UPDATE (Tarea actualiz./Actualiz.infotipo)=== | ||
* enviar datos a sistema externo al crear, modificar o borrar registros de IT2001 y IT2002 | * enviar datos a sistema externo al crear, modificar o borrar registros de IT2001 y IT2002 |
Revision as of 17:29, 26 March 2020
BADI HRPAD00INFTY
ejemplo de IN_UPDATE (Tarea actualiz./Actualiz.infotipo)
- enviar datos a sistema externo al crear, modificar o borrar registros de IT2001 y IT2002
METHOD if_ex_hrpad00infty~in_update. DATA: lt_p0001 TYPE TABLE OF p0001, ls_p0001 TYPE p0001. DATA: lt_oper TYPE TABLE OF psoper, ls_oper TYPE psoper, ls_prel TYPE prelp, ls_prel_old TYPE prelp. DATA: ls_t503 TYPE t503, ls_t001p TYPE t001p. DATA l_f(1). CHECK ipspar-infty = '2001' OR ipspar-infty = '2002'. CLEAR: ls_oper. LOOP AT new_image INTO ls_oper WHERE infty = '2001' or infty = '2002'. APPEND ls_oper TO lt_oper. ENDLOOP. sort lt_oper by opera. "primero borrar 'D' => después insertar 'I' CLEAR: ls_oper. LOOP AT old_image INTO ls_oper WHERE infty = '2001' or infty = '2002'. MOVE-CORRESPONDING ls_oper TO ls_prel_old. EXIT. ENDLOOP. CALL FUNCTION 'HR_READ_INFOTYPE' EXPORTING pernr = ipspar-pernr infty = '0001' TABLES infty_tab = lt_p0001 EXCEPTIONS infty_not_found = 1 OTHERS = 2. IF sy-subrc <> 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. LOOP AT lt_p0001 INTO ls_p0001 WHERE begda <= ipspar-endda AND endda >= ipspar-begda. ENDLOOP. SELECT SINGLE * INTO ls_t503 FROM t503 WHERE persg = ls_p0001-persg AND persk = ls_p0001-persk. SELECT SINGLE * INTO ls_t001p FROM t001p WHERE werks = ls_p0001-werks AND btrtl = ls_p0001-btrtl. LOOP AT lt_oper INTO ls_oper. MOVE-CORRESPONDING ls_oper TO ls_prel. CALL FUNCTION 'Z_HCM_ENVIA_DATA' EXPORTING tclas = ipspar-tclas innnn = ls_prel i001p = ls_t001p i_opera = ls_oper-opera EXCEPTIONS error_occured = 1 OTHERS = 2 . IF sy-subrc <> 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. ENDLOOP. ENDMETHOD.