8 Eylül 2011 Perşembe

SAP/ABAP: BAPI_ASSET_REVERSAL_POST FM

DATA: LS_ORIGINDOCREFERENCE TYPE          BAPI6037_DOC_REF,
LS_ORIGINDOCUMENTKEY  TYPE          BAPI6037_DOC_KEY,
LS_REVERSALDATA       TYPE          BAPI6037_REV_DATA,

LS_DOCUMENTREFERENCE  TYPE          BAPI6037_DOC_REF,
LS_RETURN             TYPE          BAPIRET2,


LT_ORIGINDOCREFERENCE TYPE TABLE OF BAPI6037_DOC_REF,
LT_ORIGINDOCUMENTKEY  TYPE TABLE OF BAPI6037_DOC_KEY,
LT_REVERSALDATA       TYPE TABLE OF BAPI6037_REV_DATA,

LT_DOCUMENTREFERENCE  TYPE TABLE OF BAPI6037_DOC_REF,
LT_RETURN             TYPE TABLE OF BAPIRET2.


DATA: LS_ZAA_PROMOSYON_DV   TYPE          ZAA_PROMOSYON_DV,
LT_ZAA_PROMOSYON_DV   TYPE TABLE OF ZAA_PROMOSYON_DV.

DATA: LV_CURRM              LIKE          BKPF-MONAT,
LV_CURRY              LIKE          BKPF-GJAHR,
LV_PREVM              LIKE          BKPF-MONAT,
LV_PREVY              LIKE          BKPF-GJAHR.


PARAMETERS: P_TRANS TYPE ZAA_PROMOSYON_DV-TRANSFER_NO.

SELECT SINGLE *
FROM ZAA_PROMOSYON_DV
INTO LS_ZAA_PROMOSYON_DV
WHERE TRANSFER_NO EQ P_TRANS.

*ls_ORIGINDOCREFERENCE-OBJ_TYPE   ="AWTYP"
*ls_ORIGINDOCREFERENCE-REF_DOC    ="AWREF"
*ls_ORIGINDOCREFERENCE-REF_ORG_UN ="AWORG"

CALL FUNCTION 'GET_CURRENT_YEAR'
EXPORTING
BUKRS         = 'MEYI'
DATE          = LS_ZAA_PROMOSYON_DV-BLDAT
IMPORTING
CURRM         = LV_CURRM
CURRY         = LV_CURRY
*   PREVM         = LV_PREVM
*   PREVY         = LV_PREVY
.

LS_ORIGINDOCUMENTKEY-COMP_CODE   = LS_ZAA_PROMOSYON_DV-BUKRS.
LS_ORIGINDOCUMENTKEY-AC_DOC_NO   = LS_ZAA_PROMOSYON_DV-BELNR.
LS_ORIGINDOCUMENTKEY-FISC_YEAR   = LV_CURRY."LS_ZAA_PROMOSYON_DV-GJAHR."

LS_REVERSALDATA-FISC_YEAR        = LV_CURRY.
LS_REVERSALDATA-PSTNG_DATE       = LS_ZAA_PROMOSYON_DV-BLDAT."SY-DATUM."
LS_REVERSALDATA-FIS_PERIOD       = LV_CURRM.
LS_REVERSALDATA-REASON_REV       = '02'.


CALL FUNCTION 'BAPI_ASSET_REVERSAL_POST'
EXPORTING
ORIGINDOCREFERENCE = LS_ORIGINDOCREFERENCE
ORIGINDOCUMENTKEY  = LS_ORIGINDOCUMENTKEY
REVERSALDATA       = LS_REVERSALDATA
IMPORTING
DOCUMENTREFERENCE  = LS_DOCUMENTREFERENCE
RETURN             = LS_RETURN.


IF LS_RETURN-TYPE NE 'E'.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

ENDIF.

Hiç yorum yok:

Yorum Gönder

İnsdroid

Sabahtan beri çatada çutada çatada çutada… Bitmedi yine de… Neyse, yolumuz uzun, toparlıyorum çantamı, adaptörü falan tıkıştırıyorum bir şe...