on 2008 Aug 04 10:57 AM
Hi Abappers,
i want BADI for PO in which the delivery date should be greater than the Document date.
In the TCode ME23n the delivery date should be greater than the document date.
i want to code for which BADI <removed_by_moderator>
<removed_by_moderator>
Regards,
sri.
Edited by: Julius Bussche on Aug 11, 2008 9:33 AM
Vani,
badi:ME_PROCESS_PO_CUST
method:PROCESS_HEADER
sampal code:
BAdI Name: ZCHECK_PO_LINE_ITEM (Implementation name) PO Account assignment
Definition Name: ME_PROCESS_PO_CUST
Interface Name : IF_EX_ME_PROCESS_PO_CUST
Implementing Class: ZCL_IM_BADIN_ACCOUNT_ASSGN
Method : PROCESS_HEADER
************************************************************************
METHOD if_ex_me_process_po_cust~process_header .
DATA : re_data TYPE mepoheader.
*get the item data
CALL METHOD im_header->get_data
RECEIVING
re_data = re_data.
re_header = re_data.
IF ( re_data-bsart NE 'ZOC' AND re_data-bsart NE 'ZPC' ).
IF ( re_data-bsart 'ZIC' AND re_data-bsart 'UB' ).
IF re_data-bukrs NE '1001'.
MESSAGE ID 'ZM_MSG' TYPE 'E' NUMBER '000' WITH 'Use only Sipchem Company'
'Code for External Procurement'.
ENDIF.
ENDIF.
ENDIF.
ENDMETHOD.
************************************************************************
Method : PROCESS_ITEM
************************************************************************
METHOD if_ex_me_process_po_cust~process_item .
DATA: v_menge TYPE bamng, " PR Quantity
v_statu. " PR Status
DATA : re_data TYPE mepoitem,
re_data1 TYPE mepoaccounting,
re_accountings TYPE purchase_order_accountings ,
header TYPE purchase_order_accounting.
*get the item data
CALL METHOD im_item->get_data
RECEIVING
re_data = re_data.
IF ( re_header-bsart NE 'ZOC' AND re_header-bsart NE 'ZPC' ).
IF re_header-bsart EQ 'ZRL'.
IF re_data-konnr EQ space.
MESSAGE ID 'ZM_MSG' TYPE 'E' NUMBER '000' WITH 'You cant create a Release order'
'without a reference to Outline Agreeement'.
ENDIF.
ENDIF.
u2022 IF ( re_header-bsart NE 'ZOC' AND re_header-bsart NE 'ZPC' ).
IF ( re_data-banfn EQ space AND re_data-anfnr EQ space ).
MESSAGE ID 'ZM_MSG' TYPE 'E' NUMBER '000' WITH 'You can create a Purchase order'
'only with reference to a PR or RFQ'.
ENDIF.
u2022 ENDIF.
u2022
o call method IM_ITEM->GET_ACCOUNTINGS
o RECEIVING
o RE_ACCOUNTINGS = RE_ACCOUNTINGS.
**get the accounting reference variable,this reference is needed to get
**the GL account *number and Asset number
*loop at RE_ACCOUNTINGS into header.
**get the accounting info.
u2022 call method header-ACCOUNTING->GET_DATA
u2022 RECEIVING
u2022 re_data = re_data1.
**if the account assignment is K then check for GL account
**if its A then check for Asset number
u2022 if re_data-KNTTP eq 'K'.
u2022 if re_data1-SAKTO IS INITIAL.
u2022 MESSAGE ID 'ZM_MSG'
u2022 TYPE 'E' NUMBER '000' WITH 'Enter G/L account'.
u2022 ENDIF.
u2022 ELSEIF re_data-KNTTP eq 'A'.
u2022 if re_data1-ANLN1 IS INITIAL.
*
u2022 MESSAGE ID 'ZM_MSG' TYPE 'E' NUMBER '000' WITH 'Enter Asset Number'.
u2022 ENDIF.
u2022 ENDIF.
*endloop.
IF re_data-knttp NE 'K' AND re_data-pstyp NE '9' .
IF syst-cprog EQ 'RM_MEPO_GUI'.
IF re_data-uebto IS NOT INITIAL OR
re_data-uebtk IS NOT INITIAL OR
re_data-untto IS NOT INITIAL.
MESSAGE ID 'ZM_MSG' TYPE 'E' NUMBER '000' WITH 'You cant change delivery settings'.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
u2022 Checking PO quantity with PR Quantity
u2022 select single statu menge into (v_statu, v_menge) from eban
u2022 where banfn = re_data-banfn and
u2022 bnfpo = re_data-bnfpo.
*
u2022 if v_statu 'B'.
u2022 if re_data-menge gt v_menge.
u2022 message e000(zm_msg) with 'You cant create PO exceeding' 'the PR Quantity'.
u2022 endif.
u2022 else.
u2022 MESSAGE e000(ZM_MSG) WITH 'You cant create a PO with reference' 'to Completed PR'.
u2022 endif.
ENDMETHOD.
Amit.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Amit,
The sample code by u is not working for me.My version is ECC 6.0. it is not working ya. i request u to send the code which is suitable for this version.i debug it but it is giving an
Exception error to me.
plz do needful,
Regards,
sri.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Check the BADI ME_PROCESS_PO
Thanks,
Phani Diwakar.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
77 | |
10 | |
10 | |
10 | |
10 | |
9 | |
8 | |
7 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.