Difference between revisions of "SAP SD BTE"

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