Professional Documents
Culture Documents
Hom e Tra i ni ngs Qui z Ti ps Tutori a l s Functi ona l Ce rt Q's I nte rvi e w Q's Jobs Te sti m oni a l s Adve rti se Conta ct Us
Take
Control of
Your Life
SAP Virtual/Onsite
Trainings
Document Categories:
ABAPTM
Adobe Forms
ABAP-HR
ALE & IDocs
ALV
BAPI
BASIS
BSP
Business Objects
Business Workflow
CRM NEW
LSMW
SAP Script/Smart Forms
BI/BW
eXchange Infrastructure (XI)
Enterprise Portals (EP)
eCATT
Object Oriented Programming
SAP Query
Userexits/BADIs
WebDynpro for Java/ABAPTM
Others
Earn Your
Freedom w/
YouEconomy!
Learn More
Here.
Step by step guide on adding a new tab in ME21N using a BADI
By Krishna Chaitanya Gogineni, Deloitte Consulting
Like 13K people like this. Sign Up to see w hat your friends like.
Introduction:
The requirement is to add below screen fields in the ME21N, ME22N, ME23N (Header Section) New tab
called Other Data using a BADI.
What's New?
ABAP Test Cockpit HOT
SAP ABAP Pragmas
Understanding SE32 (ABAP
Text Element Maintenance)
Creating an IDoc File on SAP
Application Server
Understanding Advance with
dialog option of SAP Workflow
SAP Workflow Scenario:
pdfcrowd.com
Maintenance Notification
Approval
Enhancements to a standard
class
Working with Floating Field in
Adobe Forms
Inserting data from Internal
Table into the step Send Mail
Display GL Account long text
using enhancement
framework
Differences between
polymorphism in JAVA and
ABAP
Passing multiline parameters
from an ABAP Class event to a
Workflow container
Concept of Re-evaluate agents
for active work items in SAP
Workflow
Dynamic creation of
component usage in ABAP
WebDynpro
Adobe Forms: Display symbols
like copyright and others
Deactivate Hold functionality in
Purchase order (ME21N)
Quiz on OOABAP
Add fields in FBL5N using
BADIs
Tutorial on Wide casting
Defining a Range in Module
Pool Program
Copy fields from one
structure/table into another
structure/table
Side Panel Usage in NWBC
reflect in the new tab which we are going create in the ME21N screen.
Contribute?
Define a function group and take the main program and define it in ls_subscriber-program.
Also define a sub screen with the required fields and assign it to the parameter ls_subscriber-dynpro.
Sample Specs
What's Hot?
CASE <mapping>-fieldname.
WHEN 'ZZPAYMENT_AGRE'.
WHEN 'ZZPROJECT'.
ENDCASE.
<mapping>-metafield = mmmfd_cust_03.
<mapping>-metafield = mmmfd_cust_04.
ENDLOOP.
TRANSPORT_FROM_MODEL:
pdfcrowd.com
TRANSPORT_FROM_MODEL:
Email:
DATA:
Subscribe
Unsubscribe
GO
l_header
TYPE REF TO if_purchase_order_mm,
ls_mepoheader TYPE mepoheader,
ls_customer TYPE CI_EKKODB.
*--------------------------------------------------------------------*
* system asks to transport data from the business logic into the view
*--------------------------------------------------------------------*
CASE im_name.
WHEN subscreen1.
* is it an Header? im_model can be header or item.
mmpur_dynamic_cast l_header im_model.
CHECK NOT l_header IS INITIAL.
* transport standard fields
ls_mepoheader = l_header->get_data( ).
* store info for later use
MOVE-CORRESPONDING ls_mepoheader TO dynp_data_pbo.
WHEN OTHERS.
* ...
ENDCASE.
TRANSPORT_TO_DYNP:
Define a FM 'ZK_KAU86037_PUSH' to push the values.
CASE im_name.
WHEN subscreen1.
CALL FUNCTION 'ZK_KAU86037_PUSH'
EXPORTING
im_dynp_data = dynp_data_pbo.
WHEN OTHERS.
ENDCASE.
TRANSPORT_FROM_DYNP:
Define another FM 'ZK_KAU86037_POP'.
CASE im_name.
WHEN subscreen1.
CALL FUNCTION 'ZK_KAU86037_POP'
IMPORTING
ex_dynp_data = dynp_data_pai.
IF dynp_data_pai NE dynp_data_pbo.
* something has changed therefore we have to notify the framework
* to transport data to the model
re_changed = mmpur_yes.
ENDIF.
WHEN OTHERS.
pdfcrowd.com
ENDCASE.
TRANSPORT_TO_MODEL:
DATA: l_header
TYPE REF TO if_purchase_order_mm,
ls_mepoheader
TYPE mepoheader,
ls_customer
TYPE CI_EKKODB,
l_po_header_handle TYPE REF TO cl_po_header_handle_mm.
*--------------------------------------------------------------------*
* data have to be transported to business logic
*--------------------------------------------------------------------*
CASE im_name.
WHEN subscreen1.
* is it an item? im_model can be header or item.
mmpur_dynamic_cast l_header im_model.
CHECK NOT l_header IS INITIAL.
ls_mepoheader = l_header->get_data( ).
* standard fields changed?
IF dynp_data_pbo-zzpayment_agre NE dynp_data_pai-zzpayment_agre
OR dynp_data_pbo-zzproject
NE dynp_data_pai-zzproject.
* update standard fields
ls_mepoheader-zzpayment_agre = dynp_data_pai-zzpayment_agre.
ls_mepoheader-zzproject = dynp_data_pai-zzproject.
CALL METHOD l_header->set_data
EXPORTING
im_data = ls_mepoheader.
ENDIF.
WHEN OTHERS.
ENDCASE.
Then we have to implement one more BADI to display the tab and update the values.
Implement the BADI ME_PROCESS_PO_CUST. This cannot be used multiple times.
In this, we have methods (PROCESS_HEADER,PROCESS_ITEM).if we need to any validations for the
fields we can write the logic here in this methods. In my case I need to check for the document type which I
implemented in the method (PROCESS_HEADER).
FIELDSELECTION_HEADER: I have implemented this method as my requirement is to show the fields for
particular document types only.
Final output:
pdfcrowd.com
pdfcrowd.com