Showing posts with label Enhancements.. Show all posts
Showing posts with label Enhancements.. Show all posts

Saturday, April 23, 2022

What is ENHANCEMENTS in SAP.

 ENHANCEMENTS in SAP ABAP. 

These are used to add extra intelligence to SAP standard programs to suit the business requirements. If we want to add extra code to SAP standard programs, if we go for change mode system asks for access key. Instead of this, SAP has provided hooks where we can write the code. These hooks are enhancement spots. If a code is written in theses spots along with the normal program the code written in these spots is also executed. There are two ways to enhance the SAP standard code.

User Exits

BADIS (Business Addins)


If user exits are used one time in any project it can not be reused. But Badis can 

be used any no of times.



There are 4 types user exits.

Function module exit

Field exit

screen exit

Menu exit


Exits are defined at package level. So we want to enhance any T-code first we 

have to find out the package for that T-code. Then we have to find out the exits present in that package. For finding the exits present in a package we have to use SMOD T-code. After finding the suitable exit for writing the code we have to use CMOD T-code.


Monday, September 21, 2020

Difference between Implicit & Explicit Enhancement In SAP ABAP.

Ques: What is the difference between Implicit & Explicit Enhancement?


Implicit & Explicit Enhancement in SAP ABAP.

Answer:

 Under implicit enhancement you can write your own code

 Adding Z-enhancement in already existing one is called Explicit enhancement

Example:

 Go to SE93

 Transaction Code: VA01

 Display

 Double click on Program Name

 You will find a spot given by SAP

 Enhance

 Right click ES_SAPMV45A

 Enhancement Implementation ----Create Implementation

Friday, August 28, 2020

VOFM Routine Create in SAP

 VOFM Routine Create in SAP step by step.





   Go to ->VOFM T-Code

A. Once the Menu Select as per your requirements 
B. After that you Enter any Number in between 600 to 999 this is for  Custom Developments.
C. When you  entering Pop Screen appears ask for Access Key(We have to remember that Every New Routine needs an Access Key)


D. Once the Access Key is get you can do modification.
E. After that enter the routine number ,description and insert the Access Key
F. Next new  ABAP Editor will open and required code can be copied from Standard SAP Routine and Custom Code Can be developed.
G. Next the coding is completed you  have to Activate the Routine
H. Select the Routine and Go to Edit – Activate
I. Ensure that Active check box is ticked upon Activation of the Routine.
J. Double click on the routine will enter into ABAP Editor, You  have to generate the Routine
K. Go to Program and select Generate
L.A screen pops up with the related Main Programs  and select all required main programs wherever the Routine is being called.
M. Next the Routine is Generated and Activated, You need to configure the Routine in the config.

Batch Validation COR1 in PP Module In SAP

Enhancement COR1 for Batch Validation In SAP  PP Module.



Include Name: ZXCO1U06 COR1 for Batch Validation.


IF sy-tcode =  'COR1' OR sy-tcode =  'COR2' ).
  IF header_imp-auart 'ZA02' OR header_imp-auart 'ZU02'
  OR header_imp-auart 'ZA01' OR header_imp-auart 'ZA03'
  OR header_imp-auart 'ZU01' OR header_imp-auart 'ZU10'.
*************************
    FIELD-SYMBOLS <fs_afpo1> TYPE any.
*************************
    DATA ls_afpo1 TYPE afpod.
    TYPESBEGIN OF ty_mch11,
              matnr TYPE matnr,     "Material
              charg TYPE charg_d,   "Batch No
              lvorm TYPE lvoc1,
              ersda TYPE ersda,     "Date
              END OF ty_mch11.
    TYPESBEGIN OF ty_batch11,
            charg TYPE charg_d,
            atwtb TYPE ersda,
            END OF ty_batch11.
    DATA wa_mch11 TYPE ty_mch11,
           wa_mch21 TYPE ty_mch11,
           i_mch11 TYPE STANDARD TABLE OF ty_mch11.
    DATAv_mcha1 TYPE mcha,
          class1 TYPE klah-class,
          w_batch2 TYPE clbatch,
          i_batch2 TYPE STANDARD TABLE OF clbatch,
          w_batch11 TYPE ty_batch11,
          i_batch11 TYPE STANDARD TABLE OF ty_batch11.
    DATAv_date1 TYPE sy-datum.
    DATArec1 TYPE i.
    DATAv_count1 TYPE i.   " counter for loop
    ASSIGN ('(SAPLCOKO)AFPOD'TO <fs_afpo1>.
    ls_afpo1 <fs_afpo1>.
    SELECT matnr
           charg
           lvorm
           ersda
           
           charg
           lvorm
           ersda
           FROM mch1 INTO TABLE i_mch11
           
           WHERE matnr header_imp-plnbez.
    DATA:lv_lvorm1 TYPE lvoc1.
    CLEAR:lv_lvorm1.
    SELECT SINGLE matnr
                  charg
                  lvorm
                  ersda
                  
                  charg
                  lvorm
                  ersda
                  FROM mch1 INTO wa_mch21
                  
                  WHERE matnr header_imp-plnbez
                    
                    AND charg ls_afpo1-charg.
    IF wa_mch21-lvorm 'X'.
      MESSAGE  e005(zbtch_msgWITH ls_afpo1-charg header_imp-plnbez.
    ENDIF.
  ENDIF.
ENDIF.

Thursday, July 23, 2020

MB_MIGO_BADI BADI USED TO POSTING DATA VALIDATION FOR MIGO

MB_MIGO_BADI BADI



method IF_EX_MB_MIGO_BADI~POST_DOCUMENT.

  BREAK-POINT.

  IF is_mkpf-budat < is_mkpf-BLDAT.

    sy-ucomm 'ENT1'.

    MESSAGE 'Posting Date Should Not Less Than Document Date'  TYPE 'E' .

    SET SCREEN syst-dynnr.

    LEAVE SCREEN.

  ENDIF.

endmethod.

Sunday, February 2, 2020

KE51 transaction how to make field (Address) required in SAP ABAP.


KE51 transaction how to make field (Address) required in SAP ABAP.
SAP does not provide any configuration and user exit to make fields in Address tab required in transaction KE51.After that debug ABAP Code, I found the way that you need to create enhancement point in include program LRKPMF05 in subroutine md_user_command_handle.

This example we want to make field Street, City, Country and Region is required when user click SAVE. Please check out this ABAP Code below.
FORM md_user_command_handle CHANGING p_fcode.
1) Form MD_USER_COMMAND_HANDLE, Start                                                                                                               
ENHANCEMENT 1  ZIMP_CO_REQUIRED_ADDR_KE51.    "active version
IF md_fcode = 'MD_SAVE'.

IF PRCT_V-STRAS EQ ''.
  MESSAGE 'You must input Street' TYPE 'E'.
ENDIF.


IF PRCT_V-ORT01 EQ ''.
 MESSAGE 'You must input Kota' TYPE 'E'.
ENDIF.

IF PRCT_V-LAND1 EQ ''.
 MESSAGE 'You must input Country' TYPE 'E'.
ENDIF.

IF PRCT_V-REGIO EQ ''.
 MESSAGE 'You must input Region' TYPE 'E'.
ENDIF.

ENDIF.
ENDENHANCEMENT.

Thursday, February 28, 2019

BADI For Material check In SAP ABAP.

BADI FOR MATERIAL CHECK

The Requirement for information message .When you creating a material if material group is A10 and division is: 05.
(This is only use for: As it needs two information for the material and user wants information message while saving the material. we can’t use field exit for this).
First step:
How to find appropriate BADI for this requirement??
Go to T-Code:--SE24
PUT:-- CL_EXITHANDLER.
NEXT:-Click display button.
Add the break- point into Class CL_EXITHANDLER’s GET_INSTANCE method.
Next:-Go to T-code MM01, After that you create a material and try to save it. it stops at many locations with different values of EXIT_NAME. (After checking into Se18 we got the BADI_MATERIAL_CHECK which can be used for our requirement.
    §  It has a method CHECK_DATA which is called before saving the material.
    §  It also has WMARA table as input data (Material Group and Division comes in MARA table).
Step 2:
Go to Transaction code SE18.
Open BADI: BADI_MATERIAL_CHECK.
Go to menu option Implementation  Create.
Step 3:
Put the name of implementation as ZMM_MAT_CHECK.
Step 4:
Double click on the method CHECK_DATA.If you notice the input parameters we have many data related to batch, material and storage location etc.
For our requirement we need material group and division which exist in WMARA. Put the below code inside the method then activate the class and method.

IF WMARA-MATKL EQ
‘A10’
AND WMARA-SPART EQ
’05’.
message
‘Material creation for this Group should be avoided for animal products!!’
TYPE
‘I’.

ENDIF.
This code is just checks the material group and division.
Step 5:
Go back and activate the implementation.
Step 6:
For this go to transaction MM01 and try to create a material.
(if you are confused use material name as CH004 ,
Industry sector as Animal Health and
Material Type as Beverages )
Click on the ENTER Button and from the view select BASIC DATA 1.


Wednesday, May 30, 2018

SAP ABAP:--BTE (Business Transaction and Event).


BTE (Business Transaction and Event).


Title : Perform Validation on t-code FB60 Using BTE Business Transaction and Event enhancement    process.
Using  InfoSystem  Processes:
 Step-1:  Go to t-code FB60 à System àStatus à Double Click on Program (screen) SAPMF05A 



Step-2: After Continue goto System Menu Status à double click on Program (Screen) àthen click on Find à Find = OPEN_FI_PERFORM àSelect Radio button in main Program à Continue.


Step-3: Select Appropriate Enhancement point/program regarding your requirement (Ex.Here we select MF05AFO0_OPEN_FI_SUBSTITUTION Enhancement point/program).


Step-4 : Put break-point  at the function to Check Our requirement à Double click on CALL FUNCTION ‘OPEN_FI_PERFORM_00001120_P àContinue àput break point à  select SAPMF02D àBack àBack.


Step-5: go to t-code FB60 and Enter Company code , Vendor , Invoice date , Posting Date , Amount ,GL account and Amount in Doc.curr , BaselineDt  à save


Step-6: Go to  T-code FIBF  à Environment àInfo System(P/S) à Enter Business Transaction Event =  00001120 (BTE for CALL FUNCTION OPEN_FI_PERFORM_00001120_P)  


è Next click on Sample code.
Step-7: First Of all Create a Function Group (ex. ZSN_BTE_FG) in t-code SE80  àActivate.
Step-8: Next click on Sample code à Copy Standard SAMPLE_INTERFACE_00001120 Function Module into  custom function Module (Ex. ZSN_BTE_FB60_FM).

Step-9: Change the custom Function Module ZSN_BTE_FB60_FM à Put Your Condition In This Function Module à Save à Activate
Step-10: Go to T-code FIBF à Setting à Product à Of a Customer àNew Enterries àProvide Product Name = ZSN_FB60 à text = Validation for FD60 à Save à Back .

Step-11: Go to Setting à Processes Module à Of a Customer àNew Enterries àProvide Event  = 00001120 à Product = ZSN_FB60 à Function Module = ZSN_BTE_FB60_FM à Save à Back
Note :  In Processes Module we can define /create Processes with Event (ex.00001120) single time only.(Single Implementation)

 Step-12: Go to  Setting à Product à Of a Customer à Provide Product Name = ZSN_FB60  à Active à Save à Back .

Step-13: Go to t-code FB60 àEnter Fields value.


 output