SAP Enhancement Instructions

Source: Internet
Author: User

Transfer from http://blog.csdn.net/lyb_yt/article/details/8177974

(a) What is enhancement (enhancement)?

To put it simply, the enhancement is the export of the standard program in the ERP system, in which the user writes the custom logic code according to the actual needs of the enterprise. Enhancement is the ERP system design, taking into account that the actual process of the enterprise may be different from the system default standard process, in the standard process framework dedicated to the interface, each interface corresponding to a custom function, these export functions have standard handlers passed in parameters and output parameters, The user can write the logic suitable for the enterprise process according to the system input parameters, and then transmit it back through the output parameters.

(ii) User-enhanced classification

User enhancements for SAP typically include the following 3 classes.

1. Class E : Enhancement exits, commonly called user exit (User_exit)

The user exit is also called function exit.

Use Tcode:se37 search exit*, found the function is to do the system reserved exit function, said before, the user exit is standard program to leave the user interface, standard program usually does not allow the user arbitrary modification, if the modification needs to apply for access Key, and modifying standard programs can cause errors that ERP companies are usually not responsible for. In SAP, custom programs usually start with the reserved word y or Z, so the Exit function contains a program that starts with a Z.

2.C class : GUI interface (GUI codes)

3.S class : Screen Exit

For example, when establishing purchase orders, work orders, and fixed asset master data, the System Reserves screen enhancements, which means allowing the user to customize the user input interface and write the appropriate input and output handlers.

In various enhancements, users may also define their own structures or tables, and the system corresponds to the type T class . such as enhanced mm06e005

Allows users to build two structures Ci_ekkodb and Ci_ekpodb.

Next, we will focus on the application of function exits.

(iii) Organization of user enhancement

Related Enhancement tables:

MODSAP: Enhanced Tables

tfdir: All function tables including exit functions (class E)

cuatexts: Modify GVI Interface: Menu text is customer (class C)
tsdir: Dynamic program Area call CUSTOMER Subscreen (S Class)

for exit functions that begin with exit, a Tfdir-mand value of C indicates that this exit function is activated.

Correlation enhancement Check Function:

Modx_function_active_check: Check if Class E user exits are activated.

Modx_menuentry_active_check: Check class C Enhanced activation status

Modx_subscreen_active_check: Checking S class for enhanced activation status

You may find that the standard procedures for any one transaction code (TCODE) of each module in SAP leave a large number of user exits, which is why SAP's flexible configuration capabilities and strong user exports make it possible for its products to easily respond to complex requirements, The system is also effectively organized to quickly find and activate these enhancements, which are documented in table and provide relevant check functions to make it easier for business users.

A friend familiar with ABAP development usually collects a program that can enter a transaction code to quickly find all the exits left by the system, and the following table is a simple reference program for detecting system enhancements being activated.

* The program can detect all active user enhancements for the system.

* by Stone Fu. On 2006/11/07.

* Used to find out all the activated user-exit of SAP.

Report Zfindactexit.

Tables:modsap,tfdir.

Data:begin of itab_exit occurs 0,

FuncName like Tfdir-funcname,

Mand like Tfdir-mand,

Name like Modsap-name,

End of Itab_exit.

Data:field1 (30).

Select A~funcname A~mand b~name

into table Itab_exit

From Tfdir as a

INNER JOIN MODSAP as B

On a~funcname = B~member

where A~mand = ' C '

and A~funcname = B~member.

Format color col_heading intensified on.

WRITE:/1 Sy-vline,

2 ' Enhancement Name ',

Sy-vline,

' Activated Exit Function ',

Sy-vline.

write:/(Sy-uline).

Loop at Itab_exit.

Format color Col_normal intensified off.

WRITE:/1 Sy-vline,

2 Itab_exit-name hotspot on,

Sy-vline,

Itab_exit-funcname,

Sy-vline.

Endloop.

At Line-selection.

Get cursor field field1.

Set parameter id ' MON ' field sy-lisel+1 (10).

Call transaction ' Smod ' and skip first screen.

There is a direct and effective way to find the user's export enhancement, which is to use the function Modx_function_active_check, as shown in Figure 1.

this.width=500; "Border=0>

Figure 1 of the judgment statement if Tfdir-mand = Aktiv_flag (constant c) is the Exit Function active flag = ' X ', indicating that the user exit is activated, the processing logic will be transferred from the standard program to the export function, the statement set the breakpoint and then run any transaction code, Call this function to determine if there is a user exit.

(iv) Enhanced application examples

Business Background : If the purchase order has already been verified by the invoice, the user is no longer allowed to modify the price.

Related programs: mm06efpo_pot_fuellen| Mm06ef0c_custscr1_item_set_dat

Related tcode:smod| CMOD

If you do not start the purchase approval function, the SAP standard function is to allow users to modify the purchase price at any time, different enterprises have different strategies for purchasing price control, a small enterprise size for the next few months to open a large purchase order, if the intermediate material price changes directly change the price of the line, Group B strictly control the purchase price, the purchase price is centralized maintenance by headquarters, each enterprise buyer only need to maintain the purchase quantity and so on, really because of this, the ERP system obviously does not prohibit the user to modify the price, if the enterprise really needs this, can be enhanced by the implementation.

You will soon find out how to enhance mm06e005 's exit_sapmm06e_ by setting breakpoints in the function Modx_function_active_check to track the user exits for each transaction reserved by the system. 017 user exports are well suited for this business context.

First, take a look at the enhanced exit_sapmm06e_017 user exit (hereinafter referred to as exit 017) processing process, the Include program Mm06efpo_pot_fuellen is specifically used to handle enhanced egress, called subroutines custscr1_ Item_set_data_

PAI ( corresponding to the next level include program Mm06ef0c_custscr1_item_set_dat), analyze the code of the include program Mm06ef0c_custscr1_item_set_dat, such as the following table, This procedure is originally copied from the system, note I added the note bold part :

*-----------------------------------------------------------------------

* User-exit dealt Positionsfelder Versorgen (PAI)

FORM Custscr1_item_set_data_pai USING im_no_screen like Fc_call.

"770427

Data:l_ucomm like Sy-ucomm,

L_enj_call TYPE c.

Statics:first_call (1) TYPE C VALUE ' X ',

Active like SY-CALLD.

Enhancement-point custscr1_item_set_data_pai_02 spots Es_mm06ef0c_custscr1_i_set_dat INCLUDE BOUND.

*$*$-start:custscr1_item_set_data_pai_02-------------------------------------------------------$*$*

Enhancement 1 Oi0_common_mm06ef0c_item_s_dat. The active version

* C5030897 I.twardowski implementation of BADI for OGSD

PERFORM Oi0_badiscr1_item_set_data_pai.

Endenhancement.

*$*$-end:custscr1_item_set_data_pai_02-------------------------------------------------------$*$*

IF not First_call is INITIAL.

CLEAR First_call.

* Note: Modx_function_active_check is used to check if 017 exits are activated, if activated.

Call FUNCTION ' Modx_function_active_check '

Exporting

Cprogname = ' sapmm06e '

Funcnumber = ' 017 '

Importing

Active = Active

EXCEPTIONS

Not_found = 1

OTHERS = 2.

IF not SY-SUBRC is INITIAL.

CLEAR Active.

ENDIF.

ENDIF.

CHECK not active is INITIAL.

IF Fc_vorga EQ cva_en.

L_enj_call = ' X '.

ELSE.

L_enj_call = space.

ENDIF.

*-define Data:

Data:lt_usr_tekpo like Bekpo occurs 0,

Lt_usr_teket like beket occurs 0,

Lt_usr_tekkn like EKKNU occurs 0,

Lt_usr_tkomv like TKOMV occurs 0.

*-copy Tables:

Lt_usr_tekpo[] = pot[].

Lt_usr_teket[] = ett[].

Lt_usr_tekkn[] = knt[].

Lt_usr_tkomv[] = tkomv[].

L_ucomm = Ok-code.

* Note: The general procedure for calling an exit is to define the data (Define), mostly the inner table or the workspace, and then assign the parameters to these inner tables (Copy Tables), which is equivalent to a mirror of the original parameters.

*-user Exit:

* if 017 export enhancement is activated then execute it.

Call FUNCTION ' exit_sapmm06e_017 '

Exporting

I_ekpo = Ekpo

I_ekpo_old = *ekpo

I_ekko = Ekko

I_aktyp = Aktyp

I_bstyp = Ekko-bstyp

I_no_screen = Im_no_screen "770427

I_LFA1 = LFA1

I_LFM1 = LFM1

I_rekpo = Rekpo

I_kekpo = Kekpo

I_aekpo = Aekpo

I_reban = Reban

i_mt06e = mt06e

I_eina = *eina

I_eine = *eine

I_komp = Komp

I_ucomm = L_ucomm

I_enj_call = L_enj_call

TABLES

Tekpo = Lt_usr_tekpo

Teket = Lt_usr_teket

TEKKN = Lt_usr_tekkn

TKOMV = LT_USR_TKOMV

EXCEPTIONS

OTHERS = 0.

EndForm. "Custscr1_item_set_data_pai

The above program code is very simple, I believe that smart readers see the ERP enhanced design ideas will begin to have a certain understanding.

Now you can understand, the enhancement is the ERP designer in the right place to set up some appropriate game rules and provide some meaningful game to the user to play! alone Lele, with people happy Music, who is happy? The fun things should be left to the users themselves happy ah.

The next step is to write an enhanced program that you can use Tcode:smod Direct activation enhancement or cmod to build a project that contains one or more enhancements, as shown in Figure 2, enter the enhanced mm06e005 and activate it, and then in the exit_ write code in the sapmm06e_017 exit function.

In Figure 2 , we found that the enhanced mm06e005 includes user egress and screen exit, and screen enhancements allow users to customize the user interface in the purchase order so that the purchase order contains more enterprise-customized information. This screen enhancement reform to the fullest in the fixed asset module.

this.width=500; "Border=0>

exit_sapmm06e_017 contains the program zxm06u42, the program zxm06u42 Sample code is the following table, this custom code logic is very simple, in order to facilitate the explanation, I commented out the input parameter of the Exit function, which has no output parameters, that is, you can only judge by the input parameters and cannot change any data:

* Example code for enhanced zxm06u42

*by Stone.fu 2007/01/02

* "*" Lokale Schnittstelle:

*importing/tables is a single parameter entered and the inner table parameter of the input

* "Importing

* "VALUE (I_ekpo) like Ekpo STRUCTURE Ekpo

* "VALUE" (I_aktyp)

* "VALUE (I_bstyp) like Ekko-bstyp

* "VALUE" (I_no_screen)

* "VALUE (I_LFA1) like LFA1 STRUCTURE LFA1

* "VALUE (I_LFM1) like LFM1 STRUCTURE LFM1

* "VALUE (I_ekko) like Ekko STRUCTURE Ekko

* "VALUE (I_rekpo) like Ekpo STRUCTURE Ekpo OPTIONAL

* "VALUE (I_kekpo) like Ekpo STRUCTURE Ekpo OPTIONAL

* "VALUE (I_aekpo) like Ekpo STRUCTURE Ekpo OPTIONAL

* "VALUE (I_reban) like Eban STRUCTURE Eban OPTIONAL

* "VALUE (i_mt06e) like mt06e STRUCTURE mt06e OPTIONAL

* "VALUE (I_eina) like Eina STRUCTURE Eina OPTIONAL

* "VALUE (i_eine) like EINE STRUCTURE EINE OPTIONAL

* "VALUE (i_ekpo_old) like Ekpo STRUCTURE Ekpo OPTIONAL

* "VALUE (i_komp) like Komp STRUCTURE Komp OPTIONAL

* "VALUE (I_ucomm) like Sy-ucomm OPTIONAL

* "VALUE (I_enj_call) OPTIONAL

* "TABLES

* "Tekpo STRUCTURE Bekpo OPTIONAL

* "Teket STRUCTURE beket OPTIONAL

* "Tekkn STRUCTURE ekknu OPTIONAL

* "Tkomv STRUCTURE komv OPTIONAL

*"----------------------------------------------------------------------

* Judge the program code as follows:

DATA Zwatekpo like Bekpo.

TABLES Ekbe.

* Input the internal table parameter Tekpo records all the original old data of the purchase order.

* The input I_ekpo parameter represents the currently processed PO line item, which contains the most recent update data for the purchase line item.

READ TABLE Tekpo into Zwatekpo with KEY ebelp = I_ekpo-ebelp.

Only for ME21N/22/23 to take effect.

Check Sy-tcode = ' me22n ' or sy-tcode = ' me22n ' or sy-tcode = ' me23n '.

EKBE is the PO history table, if there is a q,r to indicate that there is an invoice check histories, do not allow price change # #

SELECT Single * from EKBE

WHERE Ebeln = I_ekpo-ebeln

and ebelp = I_ekpo-ebelp

and (BEWTP = ' Q ' OR bewtp = ' R ').

* Price change is not allowed if SY-SUBRC =0 indicates that the invoice has been verified.

CHECK SY-SUBRC = 0.

* Determine whether the unit price of the new purchase line item is consistent with the unit price of the original line item read from the database after the data change

IF I_EKPO-NETPR <> ZWATEKPO-NETPR.

MESSAGE E001 with ' purchase order line item has been invoice verified and no longer allowed to modify price

ENDIF.

If you are familiar with the enhancements, you will find that some users are exporting old data and updated new data to facilitate comparison, unlike financial module substitution (Substitution), the ERP system is generally strict with respect to the enhancement of retention, usually only allowed in the export inspection work, which is similar to the check of the financial module (Validation).

(v) Re-analysis of the enhancement

this.width=500; "Border=0>

Enterprise implementation of one of the objectives of ERP is to achieve information sharing departments, to avoid data silos, a simple procurement receipts as an example, the warehouse personnel as long as the receipt of the purchase order number, receipt date, material receipt quantity and position, the system will automatically generate each module data, the financial data, The system locates the factory in the purchase order master data according to the purchase order number entered, finds the corresponding company code by the corresponding relationship between the factory and the company code set up in the organization structure, and finds the corresponding account by the valuation class and the movement type of receiving goods, by the receipt quantity * The purchase unit price obtains the stock amount of this material, obtains the business scope and the profit center through the material master data, so that the financial voucher data is collected automatically; If the item has a purchase discrepancy at the standard price and the cost object of the variance account corresponds to the Profit analysis segment, the data is written to the profit analysis module and so on; I'm saying, Behind these complex logic, any one module collection process exists in the verification, any verification failure of the ERP system will stop business transactions, such as the school acceptance goods date is not in the material period or the allowable range of accounting period, the validation failed to prompt the user error, such as the budget module can not find the corresponding fund Center TIP error Abort transaction, etc. When all the verification is complete, the system commits the data to the database, these checks are system standard, and the enhancement is reserved to the user, and the system is the same, in any module enhancements as long as the error will stop the business transaction. Keywords such as inspection/substitution/enhancement/field move/derivation, which appear in Figure 3 , actually can be seen as system enhancements, even with custom code to enhance standard functionality.

Interestingly, SAP's various enhanced code writing is extremely simple, like check/replace/field Move/deduce/derive users or even simply drag and drop the corresponding source field and Target field to associate the line, the code is generated automatically, even if it involves coding is very simple. Amazingly, as an SAP consultant you can even have no knowledge of programming and databases, in fact it is true that SAP consultants really do, you just focus on the business blueprint to achieve the line, which is worth the domestic management software design peer learning, in the management software design process, the same details determine success or failure.

Next-generation enhanced Badi (tcode:se17| SE18)

BADI (Business add-in) is a new feature enhancement concept that uses object-oriented concepts such as classes, interfaces, and methods to perform SAP enhancements using an object-oriented approach.

SAP Enhancement Instructions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.