06-15-2007 10:12 AM
When i convert PR to PO using ME59N, i want to specify fixed vendor and PO type.furthormore, some PR items that fulfill user-defined condition can convert to PO, others can't do.
I want to know which BADI or Exit can perform it.
Thanks.
06-15-2007 10:18 AM
Hi,
I assume I can call a method on the IF_EX_ME_PROCESS_PO_CUST
interface of the ME_PROCESS_PO_CUST add-in to do this.
1. check out the enhancment
MEREQ001
2. In this, check out the FM Exits :
EXIT_SAPLMEREQ_008
EXIT_SAPLMEREQ_010
if you are working on BADI Then this is the code
First implement the BADI in SE19 and use the code
this is the same BADI I used for the same type of requirement
see the sample 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.
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.
ENDIF.
call method IM_ITEM->GET_ACCOUNTINGS
RECEIVING
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.
call method header-ACCOUNTING->GET_DATA
RECEIVING
re_data = re_data1.
**if the account assignment is K then check for GL account
**if its A then check for Asset number
if re_data-KNTTP eq 'K'.
if re_data1-SAKTO IS INITIAL.
MESSAGE ID 'ZM_MSG'
TYPE 'E' NUMBER '000' WITH 'Enter G/L account'.
ENDIF.
ELSEIF re_data-KNTTP eq 'A'.
if re_data1-ANLN1 IS INITIAL.
*
MESSAGE ID 'ZM_MSG' TYPE 'E' NUMBER '000' WITH 'Enter Asset Number'.
ENDIF.
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.
Checking PO quantity with PR Quantity
select single statu menge into (v_statu, v_menge) from eban
where banfn = re_data-banfn and
bnfpo = re_data-bnfpo.
*
if v_statu <> 'B'.
if re_data-menge gt v_menge.
message e000(zm_msg) with 'You cant create PO exceeding' 'the PR Quantity'.
endif.
else.
MESSAGE e000(ZM_MSG) WITH 'You cant create a PO with reference' 'to Completed PR'.
endif.
ENDMETHOD.
<b>Reward points</b>
Regards
06-17-2007 4:23 PM
06-17-2007 4:36 PM
Hi skk,
Would you tell me how to find out a correct BADI or EXIT according to customer's requirement.
Thanks.
regards
06-18-2007 4:34 AM
Hi
Find the available exits with the following program:::
&----
*& Report ZFINDUSEREXIT
*&
&----
*&
*&
&----
report zfinduserexit.
tables : tstc, tadir, modsapt, modact, trdir, tfdir, enlfdir.
tables : tstct.
data : jtab like tadir occurs 0 with header line.
data : field1(30).
data : v_devclass like tadir-devclass.
parameters : p_tcode like tstc-tcode obligatory.
select single * from tstc where tcode eq p_tcode.
if sy-subrc eq 0.
select single * from tadir where pgmid = 'R3TR'
and object = 'PROG'
and obj_name = tstc-pgmna.
move : tadir-devclass to v_devclass.
if sy-subrc ne 0.
select single * from trdir where name = tstc-pgmna.
if trdir-subc eq 'F'.
select single * from tfdir where pname = tstc-pgmna.
select single * from enlfdir where funcname =
tfdir-funcname.
select single * from tadir where pgmid = 'R3TR'
and object = 'FUGR'
and obj_name eq enlfdir-area.
move : tadir-devclass to v_devclass.
endif.
endif.
select * from tadir into table jtab
where pgmid = 'R3TR'
and object = 'SMOD'
and devclass = v_devclass.
select single * from tstct where sprsl eq sy-langu and
tcode eq p_tcode.
format color col_positive intensified off.
write:/(19) 'Transaction Code - ',
20(20) p_tcode,
45(50) tstct-ttext.
skip.
if not jtab[] is initial.
write:/(95) sy-uline.
format color col_heading intensified on.
write:/1 sy-vline,
2 'Exit Name',
21 sy-vline ,
22 'Description',
95 sy-vline.
write:/(95) sy-uline.
loop at jtab.
select single * from modsapt
where sprsl = sy-langu and
name = jtab-obj_name.
format color col_normal intensified off.
write:/1 sy-vline,
2 jtab-obj_name hotspot on,
21 sy-vline ,
22 modsapt-modtext,
95 sy-vline.
endloop.
write:/(95) sy-uline.
describe table jtab.
skip.
format color col_total intensified on.
write:/ 'No of Exits:' , sy-tfill.
else.
format color col_negative intensified on.
write:/(95) 'No User Exit exists'.
endif.
else.
format color col_negative intensified on.
write:/(95) 'Transaction Code Does Not Exist'.
endif.
at line-selection.
get cursor field field1.
check field1(4) eq 'JTAB'.
set parameter id 'MON' field sy-lisel+1(10).
If there are no available user exits you could go for badi's.
To search for a badi, go to se 24 display class cl_exithandler. double click on method get_instance, get a break point on case statement. execute and start the required transaction in new session. look for variable exit_name. It would show the available badi's.
<b>
Please do reward if useful</b>
Regards
Dinesh
06-18-2007 7:35 AM
Hi !
To find out what are all the BADI's ...
1. Goto SE93 (Maintain tcode).
2. Give ME59N and Display.
3. Double Click the Program corresponding to ME59N.
4. Here just search for BADI or Call function.
To find enhancements all we need to do is.
1. Goto SMOD
2. Press F4.
3. Give Package which is used in ME59N corresponding program.
- It will display all the enhancements used in that program then choose appropriate user exit for your application.
Wish you all the very best to you.
- Mohan
06-19-2007 3:39 AM
Hi,
I created implementation of ME_PROCESS_PO_CUST.
then, i wrote some code in PROCESS_ITEM.
i set a break-point in a line.
then, run ME59N, but system didn't stop in the break-point.
why.
thanks.
regards
06-19-2007 5:18 AM
Hai,
U can choose another one and put breakpoint in the include program for enhancement.
if it is badi then u can put break point in between module and end module.
how to fine out the badi and exits they give the procedure. follow that.
Thanks and Rgds,
P.Naganjana Reddy
06-19-2007 11:03 AM
run ME59N. if Item category of the PR line item is "L" and the material of PR line item has no BOM,
when covert PR to PO, assign the material itself to the line item as subcontrating BOM component and the quantity as 1.
would you tell me which BADI or EXIT to fulfill it.
Thanks,
regards.
06-21-2007 2:40 AM
Hi,
How about this question, it is urgent.
Thanks everyone. I need your help.