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.


Tuesday, October 13, 2020

Billing Date validation In SAP ABAP.

Billing Date validation In SAP ABAP.

INCLUDE  RV60AFZZ 

FORM USEREXIT_ACCOUNT_PREP_KOMKCV.
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(1) Form USEREXIT_ACCOUNT_PREP_KOMKCV, Start                                                                                                          A
*$*$-Start: (1)---------------------------------------------------------------------------------$*$*
ENHANCEMENT 1  ZAK_INVOICE_VALID.    "active version

**TYPES: BEGIN OF ty_final,
**        vbeln TYPE vbeln_vl,
**        lfdat TYPE lfdat_v,
**       END OF ty_final.
**DATA: it_final TYPE STANDARD TABLE OF ty_final,
**      wa_final TYPE ty_final.
**
**      SELECT SINGLE vbeln lfdat
**        FROM likp
**        INTO wa_final
**        WHERE vbeln = vbrp-vgbel.
**
**      IF VBRK-FKDAT < wa_final-lfdat.
**        MESSAGE 'billing Date should not be less than delivery date' TYPE 'E'.
**        fcode = 'ENT1'.
**        PERFORM FOLGE_GLEICHSETZEN(SAPMV60A).
**        SET SCREEN 6105.
**        LEAVE SCREEN.
**      ENDIF.

How to make field Address required in transaction KE51 in SAP

How to make field Address required in transaction KE51 in SAP ABAP.

Normally SAP doesn’t provide us configuration and user exit to make fields in Address tab required in transaction KE51 . but after little bit of debug ABAP Code, i found the clue that you need to create enhancement point in include program LRKPMF05  in subroutine md_user_command_handle.

Example:

FORM md_user_command_handle CHANGING p_fcode.

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(1) Form MD_USER_COMMAND_HANDLE, Start                                                                                                                A

*$*$-Start: (1)---------------------------------------------------------------------------------$*$*

ENHANCEMENT 1  ZIMP_CO_REQUIRED_ADDR_KE51.    "active version

"Added By Rachmad Kurniawan

"Tgl 06/10/2016

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, October 1, 2020

What are the ways to find the Exits in SAP.

 What are the ways to find the Exits?


How to find the Exits in SAP.

                      I.        Using the Package name of the applications

                    II.        Using the T-code SE84

Ø  Find the package name of the required T-code.

Ø  Execute the T-code SE84.

Ø  Expand Enhancement folder

Ø  Double click on enhancements

Ø  Enter the required package name/Exit name

Ø  Click on execute icon

                   III.        Using the Find function in standard programs.

                  IV.        Using the standard Tables  MODSAP & MODACT.


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.

Tuesday, April 21, 2020

Vi01 validation for Userexit in J1IIN


Vi01 validation.



Userexit is J1IIN 
Create an Include in a billing program
At the time of SAVING the document
Find the reference delivery document number from Billing,
Enter shipment document in VFKP - REBEL and find VFKP-FKNUM
If number not exist, the display error message " SHIPMENT DOCUMENT NOT CREATED
user exit- J_1I7_USEREXIT_EXCISE_BEF_SAVE.

Friday, April 17, 2020

Posting date should not be less than PO document date(MIRO).


Posting date should not be less than PO document date. (MIRO).


When you run MIRO this (LMR1M001) program trigger for date validation
Exit name LMR1M001 and function module name EXIT_SAPLMRMP_010 and include program name is ZXM08U16.
Business scenario is when user enter posting date should not be less the PO documents date.
One Badi found for MIRO INVOICE_UPDATE but here i develop the scenario customer exit.

TYPES : BEGIN OF ty_ekko,
  ebeln 
TYPE ebeln,
  bedat 
TYPE bedat,
END OF ty_ekko.

DATA : lt_ekko TYPE STANDARD TABLE OF ty_ekko,
      ls_ekko 
TYPE ty_ekko.
READ TABLE e_tdrseg INDEX 1.
SELECT SINGLE ebeln bedat
FROM ekko
INTO ls_ekko
WHERE ebeln e_tdrseg-ebeln.
READ TABLE lt_ekko INTO ls_ekko INDEX 1.
IF  e_trbkpv-bldat < ls_ekko-bedat.
  
PERFORM folge_gleichsetzen(saplv00f).
  sy
-ucomm = 'ENT1'.
  
MESSAGE 'Invoice Date Should Not Be Less Than PO Doc. Date' TYPE 'E'.
  
SET SCREEN syst-dynnr.
  
LEAVE SCREEN.
ENDIF.

IF e_trbkpv-budat < ls_ekko-bedat.
  
PERFORM folge_gleichsetzen(saplv00f).
  sy
-ucomm = 'ENT1'.
  
MESSAGE 'Posting Date Should Not Be Less Than po Doc. Date' TYPE 'E'.
  
SET SCREEN syst-dynnr.
  
LEAVE SCREEN.
ENDIF.