SAP SD BADI
From SapWiki
BADI SD_COND_SAVE_A
VK11 - VK12 : Badi para manipular datos antes de grabar. No es útil para validación de datos
method IF_EX_SD_COND_SAVE_A~CONDITION_SAVE_EXIT. data ls_vake type VAKEVB. data: c_dlimit type p value 60, l_dlimit(2) type n. data l_d type p. data l_m(50) type c VALUE 'p.planificación mayor a & días'. FIELD-SYMBOLS: <fs_number> TYPE any table. FIELD-SYMBOLS <fs> type any. DATA: lw_var(40) TYPE c. l_dlimit = c_dlimit. REPLACE '&' INTO l_m WITH l_dlimit. loop at CT_VAKE into ls_vake. l_d = ls_vake-datbi - ls_vake-datab. if l_d > c_dlimit. * CALL FUNCTION 'MESSAGES_INITIALIZE'. "clear the buffer messages * CALL FUNCTION 'MESSAGE_STORE' "add your message * EXPORTING * arbgb = '0K' "Message class * msgty = 'E' "Message type * MSGV1 = 'Período de validez' * MSGV2 = ls_vake-datab * MSGV3 = ls_vake-datbi * MSGV4 = l_m * txtnr = '000'. "Message number * * IF SY-SUBRC <> 0. ** Implement suitable error handling here * ENDIF. * * CALL FUNCTION 'MESSAGES_SHOW'. * * CALL FUNCTION 'MESSAGES_INITIALIZE'. * clear sy-ucomm. * MESSAGE ' ' TYPE 'E' . * EXIT. * lw_var = '(SAPMV13A)NUMBER_CHANGE[]'. * ASSIGN (lw_var) TO <fs_number>. * IF sy-subrc = 0 AND <fs_number> IS ASSIGNED. * clear <fs_number>[]. * endif. lw_var = '(SAPMV13A)FCODE'. ASSIGN (lw_var) TO <fs>. IF sy-subrc = 0 AND <fs> IS ASSIGNED. <fs> = 'ENT1'. endif. * MESSAGE E000(0k) WITH 'Período de validez' * ls_vake-datab * ls_vake-datbi * l_m. endif. endloop. endmethod.