Purchase Order BADI: ME_PROCESS_PO_CUST.
BAPI ME_PURCHDOC_POSTED:
METHOD if_ex_me_purchdoc_posted~posted.
TYPES : BEGIN OF tp_anla,
anln1 TYPE anln1,
anlkl TYPE anlkl,
menge TYPE am_menge,
END OF tp_anla.
DATA : it_anla TYPE STANDARD TABLE OF tp_anla,
wa_anla TYPE tp_anla,
wa_ekkn TYPE ekkn,
wa_ekpo TYPE ekpo,
l_qty TYPE ktmng.
CONSTANTS : c_5000 TYPE ktmng VALUE '5000',
c_anlkl TYPE anlkl VALUE '02100041'.
IF im_ekkn[] IS NOT INITIAL.
* SELECT *
SELECT anln1
anlkl
menge
FROM anla
INTO TABLE it_anla
FOR ALL ENTRIES IN im_ekkn
WHERE anln1 = im_ekkn-anln1.
IF sy-subrc = 0.
*If asset class is 02100041 then value per asset should be less then or equal to 5000
*Done to handle depreciation calculation as there are multiple asset classes for furnitures and fixtures
LOOP AT im_ekkn INTO wa_ekkn.
break aish.
READ TABLE it_anla INTO wa_anla WITH KEY anln1 = wa_ekkn-anln1.
IF sy-subrc = 0.
READ TABLE im_ekpo INTO wa_ekpo WITH KEY ebelp = wa_ekkn-ebelp.
IF sy-subrc = 0.
*value for asset class check start
METHOD if_ex_me_purchdoc_posted~posted.
TYPES : BEGIN OF tp_anla,
anln1 TYPE anln1,
anlkl TYPE anlkl,
menge TYPE am_menge,
END OF tp_anla.
DATA : it_anla TYPE STANDARD TABLE OF tp_anla,
wa_anla TYPE tp_anla,
wa_ekkn TYPE ekkn,
wa_ekpo TYPE ekpo,
l_qty TYPE ktmng.
CONSTANTS : c_5000 TYPE ktmng VALUE '5000',
c_anlkl TYPE anlkl VALUE '02100041'.
IF im_ekkn[] IS NOT INITIAL.
* SELECT *
SELECT anln1
anlkl
menge
FROM anla
INTO TABLE it_anla
FOR ALL ENTRIES IN im_ekkn
WHERE anln1 = im_ekkn-anln1.
IF sy-subrc = 0.
*If asset class is 02100041 then value per asset should be less then or equal to 5000
*Done to handle depreciation calculation as there are multiple asset classes for furnitures and fixtures
LOOP AT im_ekkn INTO wa_ekkn.
break aish.
READ TABLE it_anla INTO wa_anla WITH KEY anln1 = wa_ekkn-anln1.
IF sy-subrc = 0.
READ TABLE im_ekpo INTO wa_ekpo WITH KEY ebelp = wa_ekkn-ebelp.
IF sy-subrc = 0.
*value for asset class check start
No comments:
Post a Comment