SAP SD BTE

From SapWiki

00503303 Maintain conditions: Transfers

Ejemplo crear BTE

  • Transacciones VK11 & VK12: realizamos validación de fechas y si no cumple requisito anulamos la operación(FCODE)
FUNCTION Z_SD_CALL_00503303_E.
*"--------------------------------------------------------------------
*"*"Interfase local
*"  IMPORTING
*"     REFERENCE(KOMG_OLD) TYPE  KOMG
*"     REFERENCE(KOMG_NEW) TYPE  KOMG
*"     REFERENCE(VAKE_OLD) TYPE  VAKE
*"     REFERENCE(VAKE_NEW) TYPE  VAKE
*"  EXPORTING
*"     REFERENCE(TRANSITION_FORBIDDEN) TYPE  XFELD
*"--------------------------------------------------------------------
  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.

  CHECK sy-tcode = 'VK11' or sy-tcode = 'VK12' or sy-tcode = 'VK13'.
  check sy-title(1) <> 'V'. "Visualisar
  check VAKE_NEW-KSCHL = 'ZAB1' or vake_new-KSCHL = 'ZAB2'
         or VAKE_NEW-KSCHL = 'ZAB0'
         or VAKE_NEW-KSCHL = 'ZAB3'
         or VAKE_NEW-KSCHL = 'ZAB4'
         or VAKE_NEW-KSCHL = 'ZAB5'.

  l_dlimit = c_dlimit.
  REPLACE '&' INTO l_m WITH l_dlimit.

  l_d = vake_new-datbi - vake_new-datab.

  if l_d > c_dlimit.

    lw_var = '(SAPMV13A)FCODE'.
    ASSIGN (lw_var) TO <fs>.
    IF sy-subrc = 0 AND <fs> IS ASSIGNED.
      <fs> = ''.
    endif.

    MESSAGE i000(0k) WITH 'Período de validez'
                       VAKE_NEW-datab
                       VAKE_NEW-datbi
                       l_m DISPLAY LIKE 'E'.

  endif.

ENDFUNCTION.