You are on page 1of 5

Search

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:

open in browser PRO version

Step by step procedure:


First, add the new fields required in the extension structure for EKKO table (CI_EKKODB). These fields will

Are you a developer? Try out the HTML to PDF API

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.

Now, Implement the BADI (ME_GUI_PO_CUST).


First method: SUBSCRIBE
DATA: ls_subscriber LIKE LINE OF re_subscribers.
* we want to add a customer subscreen on the Header tab
CHECK im_application = 'PO'.
CHECK im_element
= 'HEADER'.
* each line in re_subscribers generates a subscreen. We add one subscreen in this example
CLEAR re_subscribers[].
* the name is a unique identifier for the subscreen and defined in this class definition
ls_subscriber-name = subscreen1.
* the dynpro number to use
ls_subscriber-dynpro = '0001'.
* the program where the dynpro can be found
ls_subscriber-program = 'SAPLZKMMM_KAU86037'.
* each subscreen needs his own DDIC-Structure
ls_subscriber-struct_name = 'CI_EKKODB'.
* a label can be defined
ls_subscriber-label = text-001.
* the position within the tabstrib can be defined
ls_subscriber-position = 13.
* the height of the screen can be defined here. Currently we suport two screen sizes:
* value <= 7 a sevel line subscreen
* value > 7 a 16 line subscreen
ls_subscriber-height = 7.
APPEND ls_subscriber TO re_subscribers.
Here, parameter im_element is defined as HEADER as we are adding new tab in header section of PO.

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

Then method MAP_DYNPRO_FIELDS

What's Hot?

FIELD-SYMBOLS: <mapping> LIKE LINE OF ch_mapping.


LOOP AT ch_mapping ASSIGNING <mapping>.

Web Dynpro for ABAP Tutorials


Join the Mailing List
Enter name and email address below :
Name:

CASE <mapping>-fieldname.
WHEN 'ZZPAYMENT_AGRE'.
WHEN 'ZZPROJECT'.
ENDCASE.

<mapping>-metafield = mmmfd_cust_03.
<mapping>-metafield = mmmfd_cust_04.

ENDLOOP.
TRANSPORT_FROM_MODEL:

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

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.

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

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:

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

eCom for SAP


Business One
Open an SAP Business One
Web Store Affordable, Quick
& Easy to Deploy

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM


Home Contribute About Us Privacy Terms Of Use Disclaimer Safe Companies: Advertise on SAPTechnical.COM | Post Job Contact Us
2006-2007 SAPTec hnic al.COM. All rights reserved.
All produc t names are trademarks of their respective c ompanies. SAPTec hnic al.COM is in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver, and and any other SAP trademarks are registered trademarks of SAP AG in Germany and in several other c ountries.
Every effort is made to ensure content integrity. Use information on this site at your own risk.

Graphic Design by Round the Bend Wizards

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

You might also like