9/3/24, 7:22 PM Badi:Not allowing creating PO(specific document ty...
- SAP Community
m
m
Products and Technology Groups Partners Topics Events What's New Get Star
u
ni
t
y
SAP Community Products and Technology Enterprise Resource Planning ERP Blogs by Members
Badi:Not allowing creating PO(specific document ty...
Enterprise Resource Planning Blogs by Members
Gain new perspectives and knowledge about enterprise resource planning in blog posts from community
members. Share your own comments and ERP insights today!
Blog What are you looking for today?
Badi:Not allowing creating PO(specific document type) without PR
jaheer_hussain
Active Contributor
06-17-2015 1:46 PM
1 Kudo 2,454
SAP Managed Tags: MM (Materials Management)
JAHEER HUSSAIN,CRISTAL.
______________________________________________________________________
________________________________________________________
Hi,
Objective:
Recently I have implemeted Badi(ME_PROCESS_PO_CUST) for 'Not allowing
create PO(with dcoument type NBPJ and CRPJ) without PR.
https://community.sap.com/t5/enterprise-resource-planning-blogs-by-members/badi-not-allowing-creating-po-specific-document-type-without-pr/ba-p/… 1/12
9/3/24, 7:22 PM Badi:Not allowing creating PO(specific document ty... - SAP Community
If user tries to create PO(PO document type PJCR or NBPJ) with out PR,then system will
throw error message.The Error message is "There is NO Purchase Requisition for this PO
!".
How to do this?
You can use transaction SE18 to Implement it.
1.Go to transaction SE18.
2.Press 'Display'.
3.From the menu Implementation->Create
4.Give your implemenation name as below(starts with Z..) Here I have given as
zme_process_po_cust.
https://community.sap.com/t5/enterprise-resource-planning-blogs-by-members/badi-not-allowing-creating-po-specific-document-type-without-pr/ba-p/… 2/12
9/3/24, 7:22 PM Badi:Not allowing creating PO(specific document ty... - SAP Community
5.Then give implementation short text as you like.
6. Then click 'Interface ' tab and select method 'PROCESS ITEM' (BY DOUBLE
CLICKING)
7.In this method,please add the following coding.
method if_ex_me_process_po_cust~process_item.
https://community.sap.com/t5/enterprise-resource-planning-blogs-by-members/badi-not-allowing-creating-po-specific-document-type-without-pr/ba-p/… 3/12
9/3/24, 7:22 PM Badi:Not allowing creating PO(specific document ty... - SAP Community
include mm_messages_mac . "useful macros for message handling
CALL FUNCTION 'MEPO_DOC_HEADER_GET'
IMPORTING
EX_EKKO = LS_MEPOHEADER.
IF ( LS_MEPOHEADER-BSART = 'NBPJ' OR LS_MEPOHEADER-BSART = 'PJCR' ) .
"here I am checking my document type
CALL METHOD IM_ITEM->GET_DATA
RECEIVING
RE_DATA = LS_MEPOITEM.
IF LS_MEPOITEM-BANFN IS INITIAL.
https://community.sap.com/t5/enterprise-resource-planning-blogs-by-members/badi-not-allowing-creating-po-specific-document-type-without-pr/ba-p/… 4/12
9/3/24, 7:22 PM Badi:Not allowing creating PO(specific document ty... - SAP Community
MESSAGE E025(ZQ).
ENDIF.
ENDIF.
endmethod.
--------------------------------------------------------------------------
How to create error message?
Here my error message is E025 with message class ZQ.You can use transction code
SE91,you can create your own message.
8.Finally 'SAVE' and 'ACTIVATE'.
9.Now try to create PO with your own PO document type without PR,then you will get
error message and without rcreating PR,you can not complete your PO..However you can
'HOLD' your PO.
https://community.sap.com/t5/enterprise-resource-planning-blogs-by-members/badi-not-allowing-creating-po-specific-document-type-without-pr/ba-p/… 5/12
9/3/24, 7:22 PM Badi:Not allowing creating PO(specific document ty... - SAP Community
I welcome your suggestion,please.Thank you.
4 Comments
Former Member
06-18-2015 12:40 PM
0 Kudos
Dangerous code, the documentation says use method invalidate for error mmessages.
Please correct your code.
jaheer_hussain
Active Contributor
06-18-2015 1:04 PM
0 Kudos
what dangerous code? Can you check sample code of Process_item? Here you can find
error syntax for message.
https://community.sap.com/t5/enterprise-resource-planning-blogs-by-members/badi-not-allowing-creating-po-specific-document-type-without-pr/ba-p/… 6/12
9/3/24, 7:22 PM Badi:Not allowing creating PO(specific document ty... - SAP Community
JL23
Active Contributor
06-18-2015 1:36 PM
0 Kudos
Your code only works because it is an error message, it would not work if you issue
warnings.In any case it is not the supposed to deal with messages in this BADI.
see KBA 1709562 - Messages ignored in BAdIs ME_PROCESS_REQ_CUST and
ME_PROCESS_PO_CUST
jaheer_hussain
Active Contributor
06-18-2015 1:45 PM
0 Kudos
Thank you Jurgen.That is correct.
"The same source code works for an error message (E) but does not work for
W, S or I messages ".
However I need to restrict creating PO,so I need only Error message for my
nrequirement.It does not mean that it is dangerous code.
You must be a registered user to add a comment. If you've already registered,
sign in. Otherwise, register and sign in.
Comment
https://community.sap.com/t5/enterprise-resource-planning-blogs-by-members/badi-not-allowing-creating-po-specific-document-type-without-pr/ba-p/… 7/12
9/3/24, 7:22 PM Badi:Not allowing creating PO(specific document ty... - SAP Community
Labels In This Area
"mm02" 1 $session in CDS 1 A_PurchaseOrderItem additional fields 1 ABAP 5
abap cds 1 ABAP CDS VIEW 2 ABAP CDS Views 2
ABAP CDS Views - BW Extraction 1 ABAP CDS Views - CDC (Change Data Capture) 2
ABAP DDIC CDS view 1 ABAP Development 2 ABAP Extensibility 1
ABAP Programming 1 abapGit 1 ACCOSTRATE 1 ACDOCP 1
Adding your country in SPRO - Project Administration 1 Adobe form binding 1
Adobe forms 1 Adobe Printing 1 Advance Return Management 1
Advanced Intercompany Sales (5D2) 1 Advanced SAP Techniques 1
Advanced Variant Configuration 1 AI and RPA in SAP Upgrades 1
API and Integration 1 Application Development for SAP HANA Cloud 1
Approval Workflows 1 Ariba 1 ARM 1 Artificial Intelligence (AI) 1 ASN 1
ASSET MANAGEMENT 1 Assigned budget 1 Associations in CDS 1
Associations in CDS Views 2 auditlog 1 authorization 1 Auto PO from GR 1
Availability date 1 Azure Center for SAP Solutions 1 AzureSentinel 2 BADI 1
Bank 1 BAPI_SALESORDER_CREATEFROMDAT2 1 Billing 1 BRF+ 1
BRFPLUS 1 Budget for PRs 1 Bundled Cloud Services 1 business participation 1
Business Partner Master Data 1 Business Processes 1 Business Trends 1
Business Trends1 Capacity Planning 1 CAPM 1 Carbon 1 CDS Annotations 2
CDS View with Parameter 2 Cental Finance 1 Central finance 1 CFIN 2
CFIN Document Splitting 1 Charge calculation 1 Cloud ALM 1 Cloud Integration 1
COGS SPLIT 1 Commitment Cost 1 Commitments by Cost Center 1
condition contract management 1 Condition Records 1 Condition technique 1
Connection - The default connection string cannot be used. 1
Consignment Process using MRP Area 1 Controlling 1 COPA 1 Copy Control 1
Copy Inspection Results 1 cost distribution TM 1 Cost plan 1 CPI 1
Custom Table Creation 1 Customer Screen in Production Order 1 Customizing 1
https://community.sap.com/t5/enterprise-resource-planning-blogs-by-members/badi-not-allowing-creating-po-specific-document-type-without-pr/ba-p/… 8/12
9/3/24, 7:22 PM Badi:Not allowing creating PO(specific document ty... - SAP Community
Data Analytics 1 Data Analytics & AI 1 Data Quality Management 1 Date required 1
Decisions 1 desafios4hana 1 Developing with SAP Integration Suite 3
Direct Outbound Delivery 1 DMEEX 1 DMOVE2S4 1 DMS 1
DMS attachment Service SAP Object Link Tables 1 DTW 1 EAM 1 ECTR 1
Related Content
System Behavior
in Enterprise Resource Planning Q&A 5 hours ago
Current number range exhausted. Shall we overwrite the same interval range in each
client or create
in Enterprise Resource Planning Q&A 5 hours ago
Questions regarding balance in reports
in Enterprise Resource Planning Q&A yesterday
How to find delivery documents and stock movement information in the Warehouse
Monitor APP?
in Enterprise Resource Planning Q&A yesterday
Email and Fiori launchpad Notifications in Purchase Order Flexible Workflow
in Enterprise Resource Planning Blogs by SAP yesterday
Popular Blog Posts
https://community.sap.com/t5/enterprise-resource-planning-blogs-by-members/badi-not-allowing-creating-po-specific-document-type-without-pr/ba-p/… 9/12
9/3/24, 7:22 PM Badi:Not allowing creating PO(specific document ty... - SAP Community
IDoc Basics For Functional Consultants
former_member213836
Active Participant
1030239 319 664
LSMW for Functional Consultants in simple step-by-step way
former_member182098
Active Contributor
https://community.sap.com/t5/enterprise-resource-planning-blogs-by-members/badi-not-allowing-creating-po-specific-document-type-without-pr/ba-… 10/12
9/3/24, 7:22 PM Badi:Not allowing creating PO(specific document ty... - SAP Community
607050 294 388
Pricing procedure Steps and Details in SAP MM
former_member183424
Active Contributor
734927 161 324
Top Kudoed Authors
Ruthvik_Chowdary 4
LIngeswar_1437 2
intan1997 2
JL23 2
https://community.sap.com/t5/enterprise-resource-planning-blogs-by-members/badi-not-allowing-creating-po-specific-document-type-without-pr/ba-… 11/12
9/3/24, 7:22 PM Badi:Not allowing creating PO(specific document ty... - SAP Community
Marssel700 2
mohamedhasanrifaie_m 2
M_Kalyabin 2
kumarsanjeev 2
baidharsha 1
srihan01 1
View all
https://community.sap.com/t5/enterprise-resource-planning-blogs-by-members/badi-not-allowing-creating-po-specific-document-type-without-pr/ba-… 12/12