Difference between revisions of "SAP SD BTE"

From SapWiki
(Created page with "==00503303 Maintain conditions: Transfers== * ejemplo: validación en trn. VK11 VK12 FUNCTION Z_SD_CALL_00503303_E. *"-------------------------------------------------------...")
 
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
==00503303 Maintain conditions: Transfers==
 
==00503303 Maintain conditions: Transfers==
* ejemplo: validación en trn. VK11 VK12
+
[[SAP_FI_BAPI#SAP_Note_487722_-_Using_EXTENSION1_for_accounting_BAPIs|Ejemplo crear BTE]]
  FUNCTION Z_SD_CALL_00503303_E.
+
* Transacciones VK11 & VK12: realizamos validación de fechas y si no cumple requisito anulamos la operación(FCODE)
*"--------------------------------------------------------------------
+
  <nowiki>FUNCTION Z_SD_CALL_00503303_E.
*"*"Interfase local
+
*"--------------------------------------------------------------------
*"  IMPORTING
+
*"*"Interfase local
*"    REFERENCE(KOMG_OLD) TYPE  KOMG
+
*"  IMPORTING
*"    REFERENCE(KOMG_NEW) TYPE  KOMG
+
*"    REFERENCE(KOMG_OLD) TYPE  KOMG
*"    REFERENCE(VAKE_OLD) TYPE  VAKE
+
*"    REFERENCE(KOMG_NEW) TYPE  KOMG
*"    REFERENCE(VAKE_NEW) TYPE  VAKE
+
*"    REFERENCE(VAKE_OLD) TYPE  VAKE
*"  EXPORTING
+
*"    REFERENCE(VAKE_NEW) TYPE  VAKE
*"    REFERENCE(TRANSITION_FORBIDDEN) TYPE  XFELD
+
*"  EXPORTING
*"--------------------------------------------------------------------
+
*"    REFERENCE(TRANSITION_FORBIDDEN) TYPE  XFELD
  data ls_vake type VAKEVB.
+
*"--------------------------------------------------------------------
  data: c_dlimit type p value 60,
+
  data ls_vake type VAKEVB.
        l_dlimit(2) type n.
+
  data: c_dlimit type p value 60,
  data l_d type p.
+
        l_dlimit(2) type n.
  data l_m(50) type c VALUE 'p.planificación mayor a & días'.
+
  data l_d type p.
  FIELD-SYMBOLS: <fs_number> TYPE any table.
+
  data l_m(50) type c VALUE 'p.planificación mayor a & días'.
  FIELD-SYMBOLS <fs> type any.
+
  FIELD-SYMBOLS: <fs_number> TYPE any table.
  DATA: lw_var(40) TYPE c.
+
  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 sy-tcode = 'VK11' or sy-tcode = 'VK12' or sy-tcode = 'VK13'.
  check VAKE_NEW-KSCHL = 'ZAB1' or vake_new-KSCHL = 'ZAB2'
+
  check sy-title(1) <> 'V'. "Visualisar
          or VAKE_NEW-KSCHL = 'ZAB0'
+
  check VAKE_NEW-KSCHL = 'ZAB1' or vake_new-KSCHL = 'ZAB2'
          or VAKE_NEW-KSCHL = 'ZAB3'
+
        or VAKE_NEW-KSCHL = 'ZAB0'
          or VAKE_NEW-KSCHL = 'ZAB4'
+
        or VAKE_NEW-KSCHL = 'ZAB3'
          or VAKE_NEW-KSCHL = 'ZAB5'.
+
        or VAKE_NEW-KSCHL = 'ZAB4'
+
        or VAKE_NEW-KSCHL = 'ZAB5'.
  l_dlimit = c_dlimit.
+
 
  REPLACE '&' INTO l_m WITH l_dlimit.
+
  l_dlimit = c_dlimit.
+
  REPLACE '&' INTO l_m WITH l_dlimit.
  l_d = vake_new-datbi - vake_new-datab.
+
 
+
  l_d = vake_new-datbi - vake_new-datab.
  if l_d > c_dlimit.
+
 
+
  if l_d > c_dlimit.
    lw_var = '(SAPMV13A)FCODE'.
+
 
    ASSIGN (lw_var) TO <fs>.
+
    lw_var = '(SAPMV13A)FCODE'.
    IF sy-subrc = 0 AND <fs> IS ASSIGNED.
+
    ASSIGN (lw_var) TO <fs>.
      <fs> = ''.
+
    IF sy-subrc = 0 AND <fs> IS ASSIGNED.
    endif.
+
      <fs> = ''.
+
    endif.
    MESSAGE i000(0k) WITH 'Período de validez'
+
 
                        VAKE_NEW-datab
+
    MESSAGE i000(0k) WITH 'Período de validez'
                        VAKE_NEW-datbi
+
                      VAKE_NEW-datab
                        l_m DISPLAY LIKE 'E'.
+
                      VAKE_NEW-datbi
+
                      l_m DISPLAY LIKE 'E'.
  endif.
+
 
+
  endif.
ENDFUNCTION.
+
 
 +
ENDFUNCTION.</nowiki>

Latest revision as of 19:30, 12 April 2020

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.